I wish to customize my
f6key so it corresponds to a fast way of doing
M-x imenu, then
Pr RET. I've added the following to my
(global-set-key [f6] 'imenu)
Then I've tried to add different stuff after
'imenu, but all has failed and I've tried to google Emacs forums and google, but didn't find an obvious solution.
M-x imenu is started it gives the user 4 possibilities:
I always want to go into
Procedures so it's enough to type
RET. And that explains the full key-sequence:
M-x imenu, then
How can I proceed from the
(global-set-key [f6] 'imenu) step and make the
F6 key work as described above...
UPDATE: Thanks a lot so far (also for "pretty"-fying the question), however something new happened: Based on the answer from RichieHH I tried adding the following to my ~/.emacs file (although on a different system/computer, please bear over with that):
(fset 'lastMacro (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([120 31 escape 120 105 109 101 110 117] 0 "%d")) arg))) (global-set-key [f5] 'lastMacro) (fset 'yep (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([escape 120 105 109 101 110 117 return 109 97 105 110 return] 0 "%d")) arg))) (global-set-key [f6] 'yep)
Thing thing is that now the F5-key works - but not the F6-key. If you want to use the same "test file" as I'm using, grab the example at https://raw.githubusercontent.com/orlp/pdqsort/master/bench/bench.cpp and then
M-x imenu should allow to quickly jump to different sections in that file. The problem seems to be: I'm running the X11 version of emacs (didn't try terminal-only) and if I type
M-x imenu a "text-menu" pops up. If I instead use the F5-key, a GUI/X11-menu pops up, at the mouse cursor location... And that's probably why the F6-key doesn't work... I appreciate if anyone could please explain that behaviour and if I'm doing something wrong (reading the answer incorrect)?