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

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

Re: Proper use of function form


From: Noam Postavsky
Subject: Re: Proper use of function form
Date: Sun, 26 Apr 2020 20:48:37 -0400

On Sun, 26 Apr 2020 at 19:27, Tim Johnson <tim@akwebsoft.com> wrote:

> (setq my-keypairs '("h" my-h-func "g" my-g-func "f" my-f-func))
>
> and using iteration to *programmatically* call define-key for multiple
> key definitions as in
>
> (define-key mymap                               ;; add to keymap
>      (kbd (concat ldr (nth ndx mylist)))    ;; sequence as in "g"
>      (nth (+ ndx 1) mylist))                      ;; command as in my-g-func
>
> The form above is indeed a snippet from a defun that I have used for years
>
> Would it be better to change (nth (+ ndx 1) mylist) to (function (nth (+
> ndx 1) mylist)) ?

No, you would put the function in the `my-keypairs' initializer:

(setq my-keypairs `("h" ,#'my-h-func "g" ,#'my-g-func "f" ,#'my-func))

I usually don't bother sharp-quoting in lists of functions though.



reply via email to

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