Quantcast
Channel: Near-identical commands on multiple keys - Emacs Stack Exchange
Viewing all articles
Browse latest Browse all 4

Near-identical commands on multiple keys

$
0
0

Visual Studio has this nice feature where you can put the point on something, press C-f3 and it'll both find the next instance of the thing under the point and it'll remember it. You can then press f3 to find the next instance, and S-f3 to search for that same thing, but backwards.

I can do the same thing in Emacs using some elisp that I wrote. (It's bulky, and I'm sure bad, so I'll omit it).

What I would like to do is to enable similar functionality for, say, f2, f3, f4, and f5. Thus, pressing C-f2 searches for the thing under the point by saving that thing into a variable / association array / symbol somewhere, pressing C-f3 on a different thing causes emacs to save that second thing to be saved in to a distinct variable, and so I can search for the first thing by pressing f2 in the future, and I can search for the second thing by pressing f3 in the future.

I'd love to create a single function for the Control-X, another for just plain X, and a third for Shift-X, but I'm not sure how to approach this.

Is it better to have to have the function ask for the current key press (a la this-single-command-keys), or to find a way to pass a parameter from to the interactive function (without prompting the user, since they've already pressed a key)?

How does one pass additional information into an interactive function?


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images