aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/qregisters.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-06-14 19:08:06 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-06-14 19:08:06 +0200
commit15409bae5ffdfce4ef17c4ccf14c8cd4c1b8f37e (patch)
tree852b915a69d57679a05ef5fec0ee6608cdcf2dee /src/qregisters.h
parent573951d4e2bb4fb1d14212583a59ce76344593cc (diff)
handle environment variables more consistently
* the registers beginning with "$" are exported into sub-process environments. Therefore macros can now modify the environment (variables) of commands executed via EC/EG. A variable can be modified temporarily, e.g.: [[$FOO] ^U[$FOO]bar$ EC...$ ][$FOO] * SciTECO accesses the global environment registers instead of using g_getenv(). Therefore now, tilde-expansion will always use the current value of the "$HOME" register. Previously, both register and environment variable could diverge. * This effectively fully maps the process environment to a subset of Q-Registers beginning with "$". * This hasn't been implemented by mapping those registers to special implementations that updates the process environment directly, since g_setenv() is non-thread-safe on UNIX and we're expected to have threads soon - at least in the GTK+ UI.
Diffstat (limited to 'src/qregisters.h')
-rw-r--r--src/qregisters.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/qregisters.h b/src/qregisters.h
index ec40bb4..0ca230e 100644
--- a/src/qregisters.h
+++ b/src/qregisters.h
@@ -255,6 +255,10 @@ public:
insert(QRegister *reg)
{
reg->must_undo = must_undo;
+ /* FIXME: Returns already existing regs with the same name.
+ This could be used to optimize commands that initialize
+ a register if it does not yet exist (saves one table
+ lookup): */
RBTree::insert(reg);
return reg;
}
@@ -283,6 +287,13 @@ public:
return operator [](buf);
}
+ inline QRegister *
+ nfind(const gchar *name)
+ {
+ QRegister reg(name);
+ return (QRegister *)RBTree::nfind(&reg);
+ }
+
void edit(QRegister *reg);
inline QRegister *
edit(const gchar *name)
@@ -295,6 +306,9 @@ public:
return reg;
}
+ void set_environ(void);
+ gchar **get_environ(void);
+
void clear(void);
};