Emacs keystroke representation confusion

前端 未结 3 2034
渐次进展
渐次进展 2021-01-14 07:34

I usually define new keybindings in emacs using

\"C-x (\" --> (command kmacro-start-macro)
\"C-x )\" --> (kmacro-end-macro)
(name-last-kbd-macro)
(insert-kbd-macro)

3条回答
  •  广开言路
    2021-01-14 08:19

    I made a package that allows pretty much exactly this at https://github.com/Silex/elmacro

    It has some quirks but it works pretty well... for example, the following macro:

    F3 C-e M-b M-u C-a C-n F4
    

    Generates the following elisp:

    (defun upcase-last-word ()
      "Change me!"
      (interactive)
      (move-end-of-line 1)
      (backward-word 1)
      (upcase-word 1)
      (move-beginning-of-line 1)
      (next-line 1 1))
    

提交回复
热议问题