Subject: bug#8206: 24.0.50; flet breaks advised functions

From: Andreas Politz <[email-masked]>
Date: Tue, 08 Mar 2011 21:28:50 +0100

I just discovered that `flet' does not work with (at least some form of)
advised functions, such that it doesn't restore the original function.
The underlying problem is demonstrated by the following code and seems
to date back to at least Version 22.3.1 .

(progn
  (defun foo () 'defun)
  (defadvice foo (around foo activate)
    ad-do-it)
  (setq letf-save (symbol-function
                   ;;'ad-Orig-foo
                   'foo
                   ))
  (fset 'foo (lambda nil 'flet))
  (fset 'foo letf-save)
  (foo))

=> flet

-ap

In GNU Emacs 24.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1)
 of 2010-06-13 on raven
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
Important settings:
  value of $LC_ALL: C
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Article

Minor modes in effect:
  shell-dirtrack-mode: t
  yas/global-mode: t
  ido-hacks-mode: t
  easy-repeat-mode: t
  recentf-mode: t
  window-numbering-mode: t
  server-mode: t
  show-paren-mode: t
  global-hi-lock-mode: t
  display-time-mode: t
  savehist-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
o l u m n <return> C-. c E C-. b C-x o C-s e v a l 
C-s C-s C-s C-g C-s p r i n <return> <return> M-1 C-x 
b <return> C-x b <return> C-. b C-x b <return> M-p 
C-M-\ C-M-b M-f M-f C-M-f C-e C-n C-M-u C-M-u C-j C-M-f 
C-f C-j C-e C-p C-p C-p M-f M-f M-b M-d M-d M-d f i 
l l - c o l u m n <return> C-x C-b g C-r m i n i C-g 
C-x b <return> M-p C-r b u C-r C-r C-r M-f - C-n <return> 
M-p <return> C-x b <return> E C-n C-n C-n C-n C-n C-n 
C-p C-p C-p C-p C-p C-p M-p M-p <return> C-x b <return> 
M-p <return> M-p <return> M-: M-: C-g M-p <return> 
M-x M-x M-x C-g C-g C-g M-p <return> M-x M-x M-x M-x 
C-g M-p <return> C-x b m c <return> C-n M-f M-f M-f 
M-f M-f M-f M-f M-b M-x f f <tab> a p <tab> <tab> - 
l i <tab> t <tab> <tab> C-g C-M-x M-x f f <tab> a p 
- l <tab> i <tab> C-h <tab> t <tab> <tab> C-g M-2 C-x 
b m i n i M-h c o m p l e <return> C-, b q M-1 C-x 
C-f ~ / . b a s h r <return> C-e C-j e c h o SPC ' 
1 1 . 3 . SPC M a m a ' C-x C-s C-, s g C-n <return> 
<return> M-2 C-v C-l M-v M-1 q <return> <return> M-2 
C-n C-n C-n C-SPC M-} M-} M-} M-} M-w M-x e m a c s 
M-h r e p o r t <tab> b u g <return> C-g C-. f f s 
e t <return> M-x M-p <return>

Recent messages:
Reordering buffer... Done
Fetching headers for nntp+news.fh-trier:gnu.emacs.help...done
Generating summary...done
Fetching articles for nntp+news.fh-trier:gnu.emacs.help...
Auto-saving...done
Mark set
Quit
Starting new Ispell process [en] ...
Checking spelling of ADVISE...
ADVISE is correct

Load-path shadows:
/usr/share/emacs23/site-lisp/emacs-goodies-el/map-lines hides /usr/share/emacs/site-lisp/emacs-goodies-el/map-lines
/usr/share/emacs23/site-lisp/emacs-goodies-el/joc-toggle-buffer hides /usr/share/emacs/site-lisp/emacs-goodies-el/joc-toggle-buffer
/usr/share/emacs23/site-lisp/emacs-goodies-el/ctypes hides /usr/share/emacs/site-lisp/emacs-goodies-el/ctypes
/usr/share/emacs23/site-lisp/emacs-goodies-el/align-string hides /usr/share/emacs/site-lisp/emacs-goodies-el/align-string
/usr/share/emacs23/site-lisp/emacs-goodies-el/session hides /usr/share/emacs/site-lisp/emacs-goodies-el/session
/usr/share/emacs23/site-lisp/emacs-goodies-el/all hides /usr/share/emacs/site-lisp/emacs-goodies-el/all
/usr/share/emacs23/site-lisp/emacs-goodies-el/auto-fill-inhibit hides /usr/share/emacs/site-lisp/emacs-goodies-el/auto-fill-inhibit
/usr/share/emacs23/site-lisp/emacs-goodies-el/tlc hides /usr/share/emacs/site-lisp/emacs-goodies-el/tlc
/usr/share/emacs23/site-lisp/emacs-goodies-el/floatbg hides /usr/share/emacs/site-lisp/emacs-goodies-el/floatbg
/usr/share/emacs23/site-lisp/emacs-goodies-el/upstart-mode hides /usr/share/emacs/site-lisp/emacs-goodies-el/upstart-mode
/usr/share/emacs23/site-lisp/emacs-goodies-el/coffee hides /usr/share/emacs/site-lisp/emacs-goodies-el/coffee
/usr/share/emacs23/site-lisp/emacs-goodies-el/pack-windows hides /usr/share/emacs/site-lisp/emacs-goodies-el/pack-windows
/usr/share/emacs23/site-lisp/emacs-goodies-el/protocols hides /usr/share/emacs/site-lisp/emacs-goodies-el/protocols
/usr/share/emacs23/site-lisp/emacs-goodies-el/minibuffer-complete-cycle hides /usr/share/emacs/site-lisp/emacs-goodies-el/minibuffer-complete-cycle
/usr/share/emacs23/site-lisp/emacs-goodies-el/twiddle hides /usr/share/emacs/site-lisp/emacs-goodies-el/twiddle
/usr/share/emacs23/site-lisp/emacs-goodies-el/toggle-option hides /usr/share/emacs/site-lisp/emacs-goodies-el/toggle-option
/usr/share/emacs23/site-lisp/emacs-goodies-el/emacs-goodies-el hides /usr/share/emacs/site-lisp/emacs-goodies-el/emacs-goodies-el
/usr/share/emacs23/site-lisp/emacs-goodies-el/framepop hides /usr/share/emacs/site-lisp/emacs-goodies-el/framepop
/usr/share/emacs23/site-lisp/emacs-goodies-el/muttrc-mode hides /usr/share/emacs/site-lisp/emacs-goodies-el/muttrc-mode
/usr/share/emacs23/site-lisp/emacs-goodies-el/lcomp hides /usr/share/emacs/site-lisp/emacs-goodies-el/lcomp
/usr/share/emacs23/site-lisp/emacs-goodies-el/clipper hides /usr/share/emacs/site-lisp/emacs-goodies-el/clipper
/usr/share/emacs23/site-lisp/emacs-goodies-el/slang-mode hides /usr/share/emacs/site-lisp/emacs-goodies-el/slang-mode
/usr/share/emacs23/site-lisp/emacs-goodies-el/thinks hides /usr/share/emacs/site-lisp/emacs-goodies-el/thinks
/usr/share/emacs23/site-lisp/emacs-goodies-el/marker-visit hides /usr/share/emacs/site-lisp/emacs-goodies-el/marker-visit
/usr/share/emacs23/site-lisp/emacs-goodies-el/graphviz-dot-mode hides /usr/share/emacs/site-lisp/emacs-goodies-el/graphviz-dot-mode
/usr/share/emacs23/site-lisp/emacs-goodies-el/home-end hides /usr/share/emacs/site-lisp/emacs-goodies-el/home-end
/usr/share/emacs23/site-lisp/emacs-goodies-el/mutt-alias hides /usr/share/emacs/site-lisp/emacs-goodies-el/mutt-alias
/usr/share/emacs23/site-lisp/emacs-goodies-el/shell-command hides /usr/share/emacs/site-lisp/emacs-goodies-el/shell-command
/usr/share/emacs23/site-lisp/emacs-goodies-el/pp-c-l hides /usr/share/emacs/site-lisp/emacs-goodies-el/pp-c-l
/usr/share/emacs23/site-lisp/emacs-goodies-el/ff-paths hides /usr/share/emacs/site-lisp/emacs-goodies-el/ff-paths
/usr/share/emacs23/site-lisp/emacs-goodies-el/htmlize hides /usr/share/emacs/site-lisp/emacs-goodies-el/htmlize
/usr/share/emacs23/site-lisp/emacs-goodies-el/setnu hides /usr/share/emacs/site-lisp/emacs-goodies-el/setnu
/usr/share/emacs23/site-lisp/emacs-goodies-el/bar-cursor hides /usr/share/emacs/site-lisp/emacs-goodies-el/bar-cursor
/usr/share/emacs23/site-lisp/emacs-goodies-el/browse-kill-ring hides /usr/share/emacs/site-lisp/emacs-goodies-el/browse-kill-ring
/usr/share/emacs23/site-lisp/emacs-goodies-el/bm hides /usr/share/emacs/site-lisp/emacs-goodies-el/bm
/usr/share/emacs23/site-lisp/emacs-goodies-el/markdown-mode hides /usr/share/emacs/site-lisp/emacs-goodies-el/markdown-mode
/usr/share/emacs23/site-lisp/emacs-goodies-el/pod-mode hides /usr/share/emacs/site-lisp/emacs-goodies-el/pod-mode
/usr/share/emacs23/site-lisp/emacs-goodies-el/maplev hides /usr/share/emacs/site-lisp/emacs-goodies-el/maplev
/usr/share/emacs23/site-lisp/emacs-goodies-el/todoo hides /usr/share/emacs/site-lisp/emacs-goodies-el/todoo
/usr/share/emacs23/site-lisp/emacs-goodies-el/minibuf-electric hides /usr/share/emacs/site-lisp/emacs-goodies-el/minibuf-electric
/usr/share/emacs23/site-lisp/emacs-goodies-el/sys-apropos hides /usr/share/emacs/site-lisp/emacs-goodies-el/sys-apropos
/usr/share/emacs23/site-lisp/emacs-goodies-el/xrdb-mode hides /usr/share/emacs/site-lisp/emacs-goodies-el/xrdb-mode
/usr/share/emacs23/site-lisp/emacs-goodies-el/under hides /usr/share/emacs/site-lisp/emacs-goodies-el/under
/usr/share/emacs23/site-lisp/emacs-goodies-el/highlight-completion hides /usr/share/emacs/site-lisp/emacs-goodies-el/highlight-completion
/usr/share/emacs23/site-lisp/emacs-goodies-el/highlight-beyond-fill-column hides /usr/share/emacs/site-lisp/emacs-goodies-el/highlight-beyond-fill-column
/usr/share/emacs23/site-lisp/emacs-goodies-el/egocentric hides /usr/share/emacs/site-lisp/emacs-goodies-el/egocentric
/usr/share/emacs23/site-lisp/emacs-goodies-el/projects hides /usr/share/emacs/site-lisp/emacs-goodies-el/projects
/usr/share/emacs23/site-lisp/emacs-goodies-el/cwebm hides /usr/share/emacs/site-lisp/emacs-goodies-el/cwebm
/usr/share/emacs23/site-lisp/emacs-goodies-el/edit-env hides /usr/share/emacs/site-lisp/emacs-goodies-el/edit-env
/usr/share/emacs23/site-lisp/emacs-goodies-el/miniedit hides /usr/share/emacs/site-lisp/emacs-goodies-el/miniedit
/usr/share/emacs23/site-lisp/emacs-goodies-el/services hides /usr/share/emacs/site-lisp/emacs-goodies-el/services
/usr/share/emacs23/site-lisp/emacs-goodies-el/perldoc hides /usr/share/emacs/site-lisp/emacs-goodies-el/perldoc
/usr/share/emacs23/site-lisp/emacs-goodies-el/csv-mode hides /usr/share/emacs/site-lisp/emacs-goodies-el/csv-mode
/usr/share/emacs23/site-lisp/emacs-goodies-el/joc-toggle-case hides /usr/share/emacs/site-lisp/emacs-goodies-el/joc-toggle-case
/usr/share/emacs23/site-lisp/emacs-goodies-el/quack hides /usr/share/emacs/site-lisp/emacs-goodies-el/quack
/usr/share/emacs23/site-lisp/emacs-goodies-el/boxquote hides /usr/share/emacs/site-lisp/emacs-goodies-el/boxquote
/usr/share/emacs23/site-lisp/emacs-goodies-el/rfcview hides /usr/share/emacs/site-lisp/emacs-goodies-el/rfcview
/usr/share/emacs23/site-lisp/emacs-goodies-el/initsplit hides /usr/share/emacs/site-lisp/emacs-goodies-el/initsplit
/usr/share/emacs23/site-lisp/emacs-goodies-el/folding hides /usr/share/emacs/site-lisp/emacs-goodies-el/folding
/usr/share/emacs23/site-lisp/emacs-goodies-el/keydef hides /usr/share/emacs/site-lisp/emacs-goodies-el/keydef
/usr/share/emacs23/site-lisp/emacs-goodies-el/emacs-goodies-custom hides /usr/share/emacs/site-lisp/emacs-goodies-el/emacs-goodies-custom
/usr/share/emacs23/site-lisp/emacs-goodies-el/df hides /usr/share/emacs/site-lisp/emacs-goodies-el/df
/usr/share/emacs23/site-lisp/emacs-goodies-el/filladapt hides /usr/share/emacs/site-lisp/emacs-goodies-el/filladapt
/usr/share/emacs23/site-lisp/emacs-goodies-el/diminish hides /usr/share/emacs/site-lisp/emacs-goodies-el/diminish
/usr/share/emacs23/site-lisp/emacs-goodies-el/color-theme_seldefcustom hides /usr/share/emacs/site-lisp/emacs-goodies-el/color-theme_seldefcustom
/usr/share/emacs23/site-lisp/emacs-goodies-el/obfusurl hides /usr/share/emacs/site-lisp/emacs-goodies-el/obfusurl
/usr/share/emacs23/site-lisp/emacs-goodies-el/dedicated hides /usr/share/emacs/site-lisp/emacs-goodies-el/dedicated
/usr/share/emacs23/site-lisp/emacs-goodies-el/dict hides /usr/share/emacs/site-lisp/emacs-goodies-el/dict
/usr/share/emacs23/site-lisp/emacs-goodies-el/tail hides /usr/share/emacs/site-lisp/emacs-goodies-el/tail
/usr/share/emacs23/site-lisp/emacs-goodies-el/highlight-current-line hides /usr/share/emacs/site-lisp/emacs-goodies-el/highlight-current-line
/usr/share/emacs23/site-lisp/emacs-goodies-el/tabbar hides /usr/share/emacs/site-lisp/emacs-goodies-el/tabbar
/usr/share/emacs23/site-lisp/emacs-goodies-el/silly-mail hides /usr/share/emacs/site-lisp/emacs-goodies-el/silly-mail
/usr/share/emacs23/site-lisp/emacs-goodies-el/tld hides /usr/share/emacs/site-lisp/emacs-goodies-el/tld
/usr/share/emacs23/site-lisp/emacs-goodies-el/color-theme-library hides /usr/share/emacs/site-lisp/emacs-goodies-el/color-theme-library
/usr/share/emacs23/site-lisp/emacs-goodies-el/matlab hides /usr/share/emacs/site-lisp/emacs-goodies-el/matlab
/usr/share/emacs23/site-lisp/emacs-goodies-el/show-wspace hides /usr/share/emacs/site-lisp/emacs-goodies-el/show-wspace
/usr/share/emacs23/site-lisp/emacs-goodies-el/protbuf hides /usr/share/emacs/site-lisp/emacs-goodies-el/protbuf
/usr/share/emacs23/site-lisp/emacs-goodies-el/ascii hides /usr/share/emacs/site-lisp/emacs-goodies-el/ascii
/usr/share/emacs23/site-lisp/emacs-goodies-el/dir-locals hides /usr/share/emacs/site-lisp/emacs-goodies-el/dir-locals
/usr/share/emacs23/site-lisp/emacs-goodies-el/browse-huge-tar hides /usr/share/emacs/site-lisp/emacs-goodies-el/browse-huge-tar
/usr/share/emacs23/site-lisp/emacs-goodies-el/tc hides /usr/share/emacs/site-lisp/emacs-goodies-el/tc
/usr/share/emacs23/site-lisp/emacs-goodies-el/color-theme hides /usr/share/emacs/site-lisp/emacs-goodies-el/color-theme
/usr/share/emacs23/site-lisp/emacs-goodies-el/keywiz hides /usr/share/emacs/site-lisp/emacs-goodies-el/keywiz
/usr/share/emacs23/site-lisp/emacs-goodies-el/apache-mode hides /usr/share/emacs/site-lisp/emacs-goodies-el/apache-mode
/home/politza/.emacs.d/minor-modes/ido hides /home/politza/src/emacs/lisp/ido

Features:
(shadow quail fix-umlaut emacsbug skeleton sh-script executable
tramp-imap tramp-gw tramp-fish tramp-smb tramp-cache tramp-ftp
tramp-cmds tramp shell tramp-compat trampver w3m-cookie w3m-bookmark
w3m-tabmenu w3m-session w3m-search cc-mode cc-fonts cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs ielm cl-specs edebug
flow-fill w3m-form mule-util w3m doc-view jka-compr image-mode w3m-hist
w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc
w3m-util qp gnus-cite ansi-color gnus-async gnus-bcklg sort gnus-ml
gnus-demon parse-time nnfolder warnings byte-opt bytecomp byte-compile
nnmbox utf-7 utf7 auth-source netrc starttls nnimap imap nndraft nnmh
bbdb-gnus bbdb-snarf mail-extr bbdb-com nnnil gnus-agent gnus-srvr
gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015
epg-config mm-view smime password-cache dig mailcap nntp gnus-cache
gnus-sum nnoo gnus-group gnus-undo nnmail mail-source format-spec
benchmark elp find-func reposition replicant multi-isearch pp newcomment
debug thingatpt vc-git help-mode view vc-dispatcher vc-svn package linux
tex-site auto-loads bbdb-autoloads bbdb gnus-start gnus-spec gnus-int
gnus-range message rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils
mailheader gnus-win gnus gnus-ems nnheader gnus-util mail-utils mm-util
mail-prsvr yasnippet dropdown-list assoc generic org-install ispell
info-look imenu ido-hacks ibuf-macs ibuf-ext ibuffer dired-x dired-aux
dired dired-details info color-theme sendmail reporter minibuffer-regexp
kbd-helper edit-server ffap avoid easy-repeat repeat time-date recentf
tree-widget wid-edit easymenu hippie-exp my-anything anything foldout
noutline outline window-numbering ee-autoloads filladapt
browse-kill-ring derived saveplace timezone disp-table server edmacro
kmacro uniquify winner paren ido grep compile comint regexp-opt ring
hi-lock time cus-start cus-load advice advice-preload eldoc easy-mmode
help-fns savehist cl cl-19 tooltip ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register
page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind dynamic-setting
font-render-setting gtk x-toolkit x multi-tty emacs)