help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Eval keymapp in a macros


From: Yuri Khan
Subject: Re: Eval keymapp in a macros
Date: Wed, 4 Aug 2021 11:54:02 +0700

On Wed, 4 Aug 2021 at 04:20, Arthur Miller <arthur.miller@live.com> wrote:

> Here is example from my init file (with conses):
>
>              (with-key-map global
>                            ;; Window-buffer operations
>                            ("C-<insert>"    . term-toggle)
>                            ("<insert>"      . term-toggle-eshell)
>                            ([f9]            . ispell-word)
>                            ([S-f10]         . next-buffer)
>                            ([f10]           . previous-buffer)
>                            ([f12]           . kill-buffer-but-not-some)
>                            ([M-f12]         . kill-buffer-other-window)
>                            ([C-M-f12]       . only-current-buffer))

Two observations from the side:

* “with-*” naming is usually used for context manager macros. That is,
a macro initializes some resource or performs some temporary changes,
then executes the body, then does any necessary cleanup. You don’t
have any of that here.

* If you sacrifice a quote and a pair of braces, you can have your
typing saving as a simple function:

    (my-define-keys global-map
      '(("C-<insert>" . term-toggle)
        ("<insert>" . term-toggle-eshell)
        …))



reply via email to

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