From: Bill Wohler <wohler@newt.com>
To: emacs-devel@gnu.org
Cc: mh-e-devel@lists.sourceforge.net
Subject: Re: Where to put fix for #22317, mh-e: wrong usage of cl-flet
Date: Mon, 30 May 2016 17:04:51 -0700 [thread overview]
Message-ID: <87vb1vqeho.fsf@olgas.newt.com> (raw)
In-Reply-To: jwvy47tf526.fsf-monnier+gmane.emacs.devel@gnu.org
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> +(defmacro mh-flet (bindings &rest body)
>> + "Make temporary overriding function definitions.
>> +This is an analogue of a dynamically scoped `let' that operates on
>> +the function cell of FUNCs rather than their value cell.
>> +
>> +\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
>> + (if (fboundp 'cl-letf)
>> + `(cl-letf ,(mapcar (lambda (binding)
>> + `((symbol-function ',(car binding))
>> + (lambda ,@(cdr binding))))
>> + bindings)
>> + ,@body)
>> + `(flet ,bindings ,@body)))
>
> As long as you use (require 'cl), then I see no reason to stop using `flet'.
> If you're annoyed by the warning, then add a `with-no-warnings'.
> Or use `letf' unconditionally.
>
> The other option is to stop using (require 'cl) and start using (require
> 'cl-lib) instead, in which case you'll want to always use cl-letf.
> `cl-lib' is distributed in GNU ELPA and should work on XEmacs and Emacs≥22.
>
> In neither of those 3 solutions do you need to switch between
> 2 different expansions.
>
>> +(put 'mh-flet 'lisp-indent-function 1)
>> +(put 'mh-flet 'edebug-form-spec
>> + '((&rest (sexp sexp &rest form)) &rest form))
>
> I think even the oldest emacsen you support can handle
>
> (declare (indent 1) (debug ((&rest (sexp sexp &rest form)) &rest form)))
>
> so I recommend you use that instead.
I just committed Katsumi's version to the emacs-25 branch as it had been
well tested. I'd be interested in hearing his opinion on your
suggestions to improve the code.
--
Bill Wohler <wohler@newt.com> aka <Bill.Wohler@nasa.gov>
http://www.newt.com/wohler/
GnuPG ID:610BD9AD
prev parent reply other threads:[~2016-05-31 0:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 2:19 Where to put fix for #22317, mh-e: wrong usage of cl-flet Bill Wohler
2016-05-02 2:39 ` Eli Zaretskii
2016-05-02 4:49 ` Stefan Monnier
2016-05-31 0:04 ` Bill Wohler [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vb1vqeho.fsf@olgas.newt.com \
--to=wohler@newt.com \
--cc=emacs-devel@gnu.org \
--cc=mh-e-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.