nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] [PATCH] interpolate functions in string binds


From: Brand Huntsman
Subject: Re: [Nano-devel] [PATCH] interpolate functions in string binds
Date: Sun, 2 Sep 2018 15:50:03 -0600

On Sun, 2 Sep 2018 20:03:33 +0200
Benno Schulenberg <address@hidden> wrote:

> > Could it get another parameter that contains every menu the
> > function works in?  
> 
> If that is what you need to make your patch work...   But maybe it
> is easier to assume that add_to_sclist() lists the correct menus?

That doesn't work because a function can be unbound from a menu in sclist. I 
experienced this during testing when I had an old unbind for M-Q that was 
preventing me from using the findprevious function.

Adding all_menus to subnfunc would also allow the bind command to
verify validity of functions bound to menus, and warn if you bind
something like 'up' to a prompt. When binding to all menus, it can use
all_menus in subnfunc instead of menusymbols[NUMBER_OF_MENUS] which contains 
more menus than what a function might work in. Many times I've bound functions 
to wrong menus and couldn't figure out why the bind wasn't working, a warning 
would have been nice.


> First show me a nanorc of someone who uses a string bind.

I currently have 6 string binds. The feature would be more useful to more users 
if they could easily read string binds. And if they could copy&paste them from 
irc, forums, blogs, and so on.


> And then tell me why it is not possible to simply copy this file to
> wherever it is needed.  Why must it be copy-pasted with the mouse?

Why are we back to the copy&paste argument? Control characters aren't even the 
same across terminals on the same system, let alone different systems. My 
entire home row and half of the other keys have been rebound. Raw keycode 
string binds aren't portable, it has nothing to do with copy&pasting.


> This is an editor, a simple editor, not a spaceship.

Didn't piping buffer/selection to external command allow another feature to be 
removed? I wanted dedicated cut2end and cut2start functions, and was able to 
implement them with string binds instead of getting them added to the editor. 
Function interpolation, undo groups, named string binds, piping to external 
commands and maybe some simple scripting would allow nano to be extended by 
users via string binds instead of adding more code for every little feature 
someone wants.

A toggle bind feature could switch a key between multiple functions or named 
string binds. The cuttoend/cutfromcursor function could be removed and M-K 
could toggle ^K between cut function, cut2end string bind and cut2start string 
bind. Users can edit the M-K toggle bind in nanorc to add/remove any mode they 
want. This could be extended to other areas, like a toggle bind for different 
word bound modes and so on.




reply via email to

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