emacs-devel
[Top][All Lists]
Advanced

[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 22:52:08 +0100

On Mon 22 Mar 2021 at 17:00, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> As Andreas points out, the last two depend on whether the code is
> compiled or not.

interesting

   ELISP> (eval (byte-compile '(type-of '(lambda () 42))))
   cons

cons obviously, it was probably meant this:

   ELISP> (eval (byte-compile '(type-of (lambda () 42))))
   compiled-function

which is the same as the result of:

   ELISP> (eval (byte-compile '(type-of #'(lambda () 42))))
   compiled-function

> And FWIW, I'd like to get to the point where (type-of (lambda () 42))
> never returns `cons` but always some kind of "function" type instead,
> indeed.

Do you mean more like the Common Lisp behaviour?

Getting back to the original advice, in compiled code or in such `some
kind of "function"' future, using #' will make it not possible to
redefine wdired--preprocess-line in the hook:

   (add-hook 'before-change-functions #'wdired--preprocess-line nil t)

while this will keep it possible to redefine wdired--preprocess-line in
the hook:

   (add-hook 'before-change-functions 'wdired--preprocess-line nil t)

Is that correct?  Or will `some kind of "function"' still behave like a
symbol (backwards compatible)?

I would like to understand when to prefer #' and when '.  In Common
Lisp, using #' for lambda is redundant; and if I know that a function
will not change I prefer #' (e.g. #'cons) but if I want to make it
possible to easily redefine the function, I prefer '
(e.g. 'my-function).  I am struggling to come up with a strategy when to
prefer #' or ' taking into account current and future Emacs Lisp
befaviour of #'.  It seems to me that using #' everywhere will make it
harder to redefine functions.



reply via email to

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