[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Quoted function in `define-key'
From: |
Michael Heerdegen |
Subject: |
Re: Quoted function in `define-key' |
Date: |
Sat, 04 Feb 2017 13:05:10 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Narendra Joshi <narendraj9@gmail.com> writes:
> The following piece of code is confusing me. It is from `rinari-minor-mode'.
>
> (dolist (el (append (mapcar
> (lambda (el)
> (cons (concat "f" (second el))
> (read (format "'rinari-find-%S"
> (first el)))))
> rinari-jump-schema)
> rinari-minor-mode-keybindings))
> (eval `(define-key rinari-prefix-map ,(car el) ,(cdr el))))
>
>
> If I replace the last expression with:
>
> (define-key rinari-prefix-map (car el) (cdr el))
>
> why does it fail?
>
> (cdr el) is (quote function-name) which is exactly the same as
> 'function-name.
Sure, but this is then not evaluated again, and you want the DEF
argument of `define-key' to be function-name, not (quote function-name).
And yes, using `eval' in this context is indeed overkill (as well as
`read' which could be replaced with `intern').
Michael.
- Quoted function in `define-key', Narendra Joshi, 2017/02/04
- Re: Quoted function in `define-key', Narendra Joshi, 2017/02/04
- Re: Quoted function in `define-key',
Michael Heerdegen <=
- Re: Quoted function in `define-key', Narendra Joshi, 2017/02/04
- Re: Quoted function in `define-key', Michael Heerdegen, 2017/02/04
- Re: Quoted function in `define-key', Narendra Joshi, 2017/02/05
- Re: Quoted function in `define-key', Michael Heerdegen, 2017/02/05
- Re: Quoted function in `define-key', Narendra Joshi, 2017/02/05
- Re: Quoted function in `define-key', Michael Heerdegen, 2017/02/05
Re: Quoted function in `define-key', Stefan Monnier, 2017/02/04