unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Katsumi Yamaoka <yamaoka@jpl.org>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r111086: gmm-utils.el (gmm-flet, gmm-labels): New macros.
Date: Tue, 04 Dec 2012 13:52:28 -0500	[thread overview]
Message-ID: <jwvzk1tu01n.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1Tfocu-00056V-AU@vcs.savannah.gnu.org> (Katsumi Yamaoka's message of "Tue, 04 Dec 2012 08:22:12 +0000")

> +;; `flet' and `labels' got obsolete since Emacs 24.3.
> +(defmacro gmm-flet (bindings &rest body)
> +  "Make temporary overriding function definitions.
> +
> +\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
> +  `(let (fn origs)
> +     (dolist (bind ',bindings)
> +       (setq fn (car bind))
> +       (push (cons fn (and (fboundp fn) (symbol-function fn))) origs)
> +       (fset fn (cons 'lambda (cdr bind))))
> +     (unwind-protect
> +	 (progn ,@body)
> +       (dolist (orig origs)
> +	 (if (cdr orig)
> +	     (fset (car orig) (cdr orig))
> +	   (fmakunbound (car orig)))))))
> +(put 'gmm-flet 'lisp-indent-function 1)

Nooooooooooooooo!!!!!!!!!
Please don't!

If you really can't stand the warning, then just do something like

   (defmacro gmm-flet (&rest r)
     (if (fboundp 'cl-flet) `(cl-flet ,@r) `(flet ,@r)))

After making sure that your uses of `flet' are compatible with `cl-flet'
and the other uses are changed to use something like (cl-)letf or
(better) defadvice.

Same for gmm-labels!


        Stefan



       reply	other threads:[~2012-12-04 18:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1Tfocu-00056V-AU@vcs.savannah.gnu.org>
2012-12-04 18:52 ` Stefan Monnier [this message]
2012-12-04 22:39   ` [Emacs-diffs] /srv/bzr/emacs/trunk r111086: gmm-utils.el (gmm-flet, gmm-labels): New macros Katsumi Yamaoka
2012-12-04 23:05     ` Katsumi Yamaoka
2012-12-05  0:14       ` Katsumi Yamaoka
2012-12-05  2:26         ` Katsumi Yamaoka
2012-12-05  4:19       ` Stefan Monnier
2012-12-05  5:46         ` Katsumi Yamaoka
2012-12-05 19:29         ` Richard Stallman
2012-12-05 19:35           ` [Emacs-diffs] /srv/bzr/emacs/trunk r111086: gmm-utils.el(gmm-flet, " Drew Adams
2012-12-06  2:01           ` [Emacs-diffs] /srv/bzr/emacs/trunk r111086: gmm-utils.el (gmm-flet, " Katsumi Yamaoka
2012-12-06 13:27             ` Stefan Monnier
2012-12-06 22:46             ` Richard Stallman

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=jwvzk1tu01n.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=yamaoka@jpl.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).