From: Michael Heerdegen <michael_heerdegen@web.de>
To: Stephen Leake <stephen_leake@stephe-leake.org>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: flet vs cl-flet vs compilation-start
Date: Thu, 02 Feb 2017 10:16:15 +0100 [thread overview]
Message-ID: <8737fxkl5s.fsf@drachen> (raw)
In-Reply-To: <86mve51o6v.fsf@stephe-leake.org> (Stephen Leake's message of "Wed, 01 Feb 2017 17:33:28 -0600")
Stephen Leake <stephen_leake@stephe-leake.org> writes:
> I'm using compilation-mode to show results from running an external
> program; it produces output that looks like compilation errors (it's
> actually cross-reference info).
>
> Some users would like to preserve output from several calls to the
> external program.
>
> compilation-start does not provide an option for this; it calls
> (erase-buffer) unconditionally.
>
> So someone suggested this hack:
>
> (require 'cl)
> (flet ((erase-buffer nil (goto-char (point-max))))
> (compilation-start ... ))
>
> That works, but produces byte-compiler warnings about cl and flet.
>
> So I tried:
>
> (require 'cl-lib)
> (cl-flet ((erase-buffer nil (goto-char (point-max))))
> (compilation-start ... ))
>
> This does _not_ work. Apparently in the "flet" case, the local
> definition of 'erase-buffer' overrides the global one, but in the
> 'cl-flet' case it does not.
The cause is that the function bindings created by cl-flet and cl-labels
have lexical scope. And that is documented.
As already has been mentioned, as a last resort, use cl-letf in such
cases.
Michael.
prev parent reply other threads:[~2017-02-02 9:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 23:33 flet vs cl-flet vs compilation-start Stephen Leake
2017-02-01 23:49 ` John Mastro
2017-02-02 9:16 ` Michael Heerdegen [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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8737fxkl5s.fsf@drachen \
--to=michael_heerdegen@web.de \
--cc=emacs-devel@gnu.org \
--cc=stephen_leake@stephe-leake.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).