emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#16319: closed (24.3.50; `case' macro not expanded


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#16319: closed (24.3.50; `case' macro not expanded in advice)
Date: Thu, 02 Jan 2014 15:15:03 +0000

Your message dated Thu, 02 Jan 2014 10:14:46 -0500
with message-id <address@hidden>
and subject line Re: bug#16319: 24.3.50; `case' macro not expanded in advice
has caused the debbugs.gnu.org bug report #16319,
regarding 24.3.50; `case' macro not expanded in advice
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
16319: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16319
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.3.50; `case' macro not expanded in advice Date: Wed, 1 Jan 2014 14:05:18 -0800 (PST)
1. This bug:

emacs -Q

Put this in a file foo.el and byte-compile it.

(eval-when-compile (require 'cl)) ;; case, 

(when (fboundp 'file-cache-add-file)
  (defadvice file-cache-add-file (around bmkp-autofile-filecache activate)
    "Respect option `bmkp-autofile-filecache'."
    (case bmkp-autofile-filecache
      (autofile-only     (bmkp-autofile-set (ad-get-arg 0) nil nil 
'NO-UPDATE-P))
      (autofile+cache    (progn ad-do-it  (bmkp-autofile-set (ad-get-arg 0) nil 
nil 'NO-UPDATE-P 'MSG-P)))
      (cache-only        ad-do-it))))

emacs -Q
M-x load-file foo.elc

M-: (file-cache-add-file "foo.el")

Debugger entered--Lisp error: (void-function case)
  (case bmkp-autofile-filecache (autofile-only (bmkp-autofile-set file 
    nil nil (quote NO-UPDATE-P))) (autofile+cache (progn (setq
    ad-return-value (with-no-warnings (funcall ad--addoit-function
    file))) (bmkp-autofile-set file nil nil (quote NO-UPDATE-P) (quote
    MSG-P)))) (cache-only (setq ad-return-value (with-no-warnings
    (funcall ad--addoit-function file))))) 
  (let (ad-return-value) (case bmkp-autofile-filecache (autofile-only
    (bmkp-autofile-set file nil nil (quote NO-UPDATE-P)))
    (autofile+cache (progn (setq ad-return-value (with-no-warnings
    (funcall ad--addoit-function file))) (bmkp-autofile-set file nil nil
    (quote NO-UPDATE-P) (quote MSG-P)))) (cache-only (setq
    ad-return-value (with-no-warnings (funcall ad--addoit-function
    file))))) ad-return-value) 
  ad-Advice-file-cache-add-file(#[...])
  file-cache-add-file("foo.el")
  eval((file-cache-add-file "foo.el") nil)
  eval-expression((file-cache-add-file "foo.el") nil)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

2. Another (minor), related bug:

As a workaround, I defined a helper function, which has just the
`case' sexp, and I use that in the defadvice.  But then I get a
warning about `ad-do-it' being an undefined variable.  So I work
around that by adding (defvar ad-do-it).  But that's not right
either, since `ad-do-it' is not a variable.

Fixing #1 will take care of #2.  If you do not fix #1 then at least
the byte-compiler should not flag `ad-do-it' as an undefined
variable.

In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-12-27 on ODIEONE
Bzr revision: 115778 address@hidden
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3' LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'



--- End Message ---
--- Begin Message --- Subject: Re: bug#16319: 24.3.50; `case' macro not expanded in advice Date: Thu, 02 Jan 2014 10:14:46 -0500 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
Indeed macros in defadvice are expanded only at run-time.
Use advice-add which does not suffer from this problem.


        Stefan


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]