From 16e9b0dc459f3ac198495127498b2255eb94c1ce Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 4 Jun 2016 21:01:53 +0200 Subject: added ^E@ string building character * allows expansion of Q-Register contents with UNIX shell quoting * This especially improves the usefulness of the EC/EG commands as we can reliably determine that a TECO string (ie. Q-Register) will end up as a single argument to the spawned process. A previous workaround was to enclose ^EQ in quotes, but it does not work e.g. if the register contains the wrong kind of quotes or other magic shell characters. * NOTE: In order to be absolutely sure about the runtime behaviour of EC plus ^E@, you will have to enable UNIX98 shell emulation in portable macros. --- doc/sciteco.7.template | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'doc') diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template index eab26e5..9b31c7d 100644 --- a/doc/sciteco.7.template +++ b/doc/sciteco.7.template @@ -1398,9 +1398,12 @@ When \fB^V\fP is not followed by \fB^V\fP, a single character .BI ^W c Analogous to \fB^V\fP, but upper-cases characters. .TP -.BI ^EQ q -Expands to the string contents of the Q-Register specified by -\fIq\fP. +.BI ^E\(rs q +Expands to the formatted number stored in the +numeric part of Q-Register \fIq\fP. +The number is formatted according to the current +radix and exactly the same as the backslash (\fB\(rs\fP) +command would format it. Currently, long Q-Register names have a separate independant level of string building character processing, allowing you to build Q-Register names whose content is then expanded. @@ -1411,12 +1414,19 @@ part of Q-Register \fIq\fP. For instance if register \(lqA\(rq contains the code 66, \(lq^EUa\(rq expands to the character \(lqB\(rq. .TP -.BI ^E\(rs q -Expands to the formatted number stored in the -numeric part of Q-Register \fIq\fP. -The number is formatted according to the current -radix and exactly the same as the backslash (\fB\(rs\fP) -command would format it. +.BI ^EQ q +Expands to the string contents of the Q-Register specified by +\fIq\fP. +.TP +.BI ^E@ q +Expands to the quoted string contents of the Q-Register +specified by \fIq\fP. +The quoting will be such that an UNIX98 \(lq/bin/sh\(rq will +interpret the quoted string like the original contents of +\fIq\fP. +This is useful when generating UNIX shell code or when passing +registers with unknown contents as parameters to external +commands using the \fBEC\fP command. .TP .BI ^E c All remaining \fB^E\fP combinations are passed down -- cgit v1.2.3