[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12895: 24.3.50; Replacement for flet
From: |
Katsumi Yamaoka |
Subject: |
bug#12895: 24.3.50; Replacement for flet |
Date: |
Fri, 16 Nov 2012 16:04:40 +0900 |
User-agent: |
Gnus/5.130006 (真 Gnus v0.6) Emacs/24.3.50 (i686-pc-cygwin) |
Stefan Monnier wrote:
> Such override should be done with an advice.
But why I haven't yet replaced flet used in
message-read-from-minibuffer is that I don't yet have a solution
better than this:
(flet ((mail-abbrev-in-expansion-header-p nil t))
(read-from-minibuffer prompt initial-contents))
;; This makes mail-abbrev-expand work even in a minibuffer, not
;; in a message header.
Not only this, there will probably be lots of situations where
flet is handy to use. Here's the one I've implemented in a
certain package so as to silence the byte compiler:
(defmacro my-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)))))))
- bug#12895: 24.3.50; Replacement for flet, (continued)
- bug#12895: 24.3.50; Replacement for flet, Stefan Monnier, 2012/11/15
- bug#12895: 24.3.50; Replacement for flet, Antoine Levitt, 2012/11/15
- bug#12895: 24.3.50; Replacement for flet, Glenn Morris, 2012/11/15
- bug#12895: 24.3.50; Replacement for flet, Antoine Levitt, 2012/11/15
- bug#12895: 24.3.50; Replacement for flet, Glenn Morris, 2012/11/15
- bug#12895: 24.3.50; Replacement for flet, Antoine Levitt, 2012/11/15
- bug#12895: 24.3.50; Replacement for flet, Glenn Morris, 2012/11/15
- bug#12895: 24.3.50; Replacement for flet, Stefan Monnier, 2012/11/16
- bug#12895: 24.3.50; Replacement for flet, Antoine Levitt, 2012/11/16
- bug#12895: 24.3.50; Replacement for flet, Stefan Monnier, 2012/11/16
bug#12895: 24.3.50; Replacement for flet,
Katsumi Yamaoka <=
bug#12895: 24.3.50; Replacement for flet, Michael Heerdegen, 2012/11/15