[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Partial wdired (edit just filename at the point)
From: |
Tomas Hlavaty |
Subject: |
Re: Partial wdired (edit just filename at the point) |
Date: |
Mon, 22 Mar 2021 21:08:16 +0100 |
On Mon 22 Mar 2021 at 09:11, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> Tomas Hlavaty [2021-03-21 23:17:38] wrote:
>> On Wed 17 Mar 2021 at 22:10, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>>> + (add-hook 'before-change-functions 'wdired--preprocess-line nil t)
>>> Please use #' rather than ' to quote functions (I know the rest of the
>>> code here doesn't (yet), but we should move towards more systematic
>>> use of #' so as to better catch obsolete functions and other issues). ]
>> That is a strange advice. I would expect #' to remove the indirection
>> via symbol with consequence, that redefining the named function would
>> not be reflected in the original #' value.
>> What is the difference between #' and ' in emacs lisp?
>> Is it different from Common Lisp?
>
> Yes, it's indeed different from Common Lisp: it doesn't have the same
> effect as `symbol-function`.
>
> In ELisp, when quoting a symbol, #' only tells Emacs that the intention
> is to refer to the function by that name more than the symbol itself,
> but semantically, it's almost identical to ' and almost always just
> returns the symbol. The "almost" is for the exception of references to
> lexically scoped functions (where #' works like in Common Lisp).
>
> Lexically-scoped functions occur most directly via `cl-flet` and
> `cl-labels`, but they can also occur more indirectly via things like
> `cl-defmethod` (where `cl-call-next-method` is lexically scoped) or
> `named-let` (which rely on `cl-flet` or `cl-labels` internally).
Thanks for the great explanation!
Emacs Lisp:
(type-of 'type-of)
-> symbol
(type-of #'type-of)
-> symbol
(type-of (lambda () 42))
-> cons
(type-of #'(lambda () 42))
-> cons
Common Lisp:
(type-of 'type-of)
-> SYMBOL
(type-of #'type-of)
-> FUNCTION
(type-of (lambda () 42))
-> FUNCTION
(type-of #'(lambda () 42))
-> FUNCTION
- Re: Partial wdired (edit just filename at the point), (continued)
- Re: Partial wdired (edit just filename at the point), Arthur Miller, 2021/03/19
- Re: Partial wdired (edit just filename at the point), Stefan Monnier, 2021/03/19
- Sv: Partial wdired (edit just filename at the point), arthur miller, 2021/03/19
- Re: Sv: Partial wdired (edit just filename at the point), Stefan Monnier, 2021/03/19
- Sv: Sv: Partial wdired (edit just filename at the point), arthur miller, 2021/03/20
- Re: Partial wdired (edit just filename at the point), Tomas Hlavaty, 2021/03/21
- Re: Partial wdired (edit just filename at the point), tomas, 2021/03/22
- Re: Partial wdired (edit just filename at the point), Arthur Miller, 2021/03/22
- Re: Partial wdired (edit just filename at the point), tomas, 2021/03/22
- Re: Partial wdired (edit just filename at the point), Stefan Monnier, 2021/03/22
- Re: Partial wdired (edit just filename at the point),
Tomas Hlavaty <=
- Re: Partial wdired (edit just filename at the point), Andreas Schwab, 2021/03/22
- Re: Partial wdired (edit just filename at the point), Stefan Monnier, 2021/03/22
- Re: Partial wdired (edit just filename at the point), Tomas Hlavaty, 2021/03/22
- Re: Partial wdired (edit just filename at the point), Stefan Monnier, 2021/03/22
- Re: Partial wdired (edit just filename at the point), Tomas Hlavaty, 2021/03/22
- Re: Partial wdired (edit just filename at the point), Andreas Schwab, 2021/03/22