nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] Possible new feature: function interpolation


From: Marco Diego Aurélio Mesquita
Subject: [Nano-devel] Possible new feature: function interpolation
Date: Sun, 12 Aug 2018 03:12:09 -0300
User-agent: NeoMutt/20170113 (1.7.2)

Function interpolation is the interpretation of commands embedded in strings 
bound to keys (pre-recorded macros). The feature was (AFAICT) first talked 
about in http://lists.gnu.org/archive/html/nano-devel/2018-02/msg00006.html .

I think this is a desired feature and it is something I want myself. I have an 
implementation of the feature in a personal branch. My implementation differs 
from Brand's proposal in two points:

 - commands must be written between $'s instead of inside ${} and
 - a $ sign must be written as $$.

For example, the following pre-recorded macro:

        "$$word1 word2$cutwordleft$$$"

generates

        $word1 $

when ran. If a $ is left open, or an invalid command is used, it simply is not 
replaced.

Pros of this feature are:
 - it allows portable macros: macros will work independent of keybindings;
 - it may make macros easier to read and write.

Cons are:
 - it is not concise: for example, a ^H would have to be replaced by 
$cutwordleft$;
 - it may break current macros which already use $: this may not be a big 
problem since a command will only be interpreted if it is valid, so, today, 
very few macros would break because of it. Also, considering how new is the 
pre-recorded macro feature, I doubt any macro would break because of this.

Of course I want to know if more people want this before posting a patch. So, 
if anyone wants this, please manifest your desire for it.

Thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]