[PATCH] emacs: Avoid deprecated function flet
Austin Clements
amdragon at MIT.EDU
Mon May 20 10:04:39 PDT 2013
Quoth David Bremner on May 20 at 12:45 pm:
> Austin Clements <amdragon at MIT.EDU> writes:
>
> > flet was deprecated in Emacs 24.3 and replaced with cl-flet. However,
> > cl-flet lexically binds the function symbol, while we depend on flet
> > dynamically binding the function symbol. Hence, this patch replaces
> > the deprecated flet use with letf, which lets us dynamically bind the
> > function symbol, while remaining compatible with both Emacs 23 and 24.
>
> The bad news: letf is also marked as obsolete, although there is no
> yelling from the byte-compiler yet.
>From what I understand, all non-cl-prefixed functions are now
considered obsolete, but the non-prefixed aliases are going to have to
stick around for a long time and we won't be able to use the prefixed
ones until we drop support for pre-24.3 Emacs.
flet is a more complicated story, since it was deprecated not just in
name, but in semantics, which I think is why the compiler singles it
out.
> In my simple tests, it _seemed_ to work to replace letf with cl-letf,
> although
>
> - that would require some kind of compatability alias
> - the docstring for letf mutters something about "deprecated usage of
> `symbol-function' in place forms.
>
> On the third hand,
>
> http://www.gnu.org/software/emacs/manual/html_node/elisp/Setting-Generalized-Variables.html#Setting-Generalized-Variables
>
> suggests using symbol-function with setf is legitimate.
My concern would be that letf is a cl function, and cl's documentation
does *not* list symbol-function as a supported generalized variable:
http://www.gnu.org/software/emacs/manual/html_mono/cl.html#Setf-Extensions
We should probably just use fset in an unwind-protect.
More information about the notmuch
mailing list