GNU bug report logs - #3984
23.0.96; defadvice of call-interactively defeats interactive-p

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Thu, 30 Jul 2009 22:45:04 UTC

Severity: minor

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ryan <rct <at> thompsonclan.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 3984 <at> debbugs.gnu.org
Subject: bug#3984: 
Date: Fri, 20 Sep 2013 09:50:34 -0700
>> Ok, I have written a couple of tests, two of which are currently failing
>> (mine are the ones with numbered suffixes 2 through 5). I am
>> attaching a patch that adds these tests. ERT output is below:
> Thanks.  Just a few questions, before installing the patch.
>
>> +(defun clear-advice (symbol)
>> +  "Reset SYMBOL's function to its original unadvised definition."
>> +  (let ((func (symbol-function symbol)))
>> +    (while (advice--p func)
>> +      (setq func (advice--cdr func)))
>> +    (fset symbol func)))
> Why do you need that?  AFAICT you only use it after defining sm-test7.2,
> and I don't see why that call is needed.
Oh, that's actually not necessary. I put it in so I could re-run the 
test without restarting emacs or manually resetting the advice, and I 
forgot to remove it.

>> +(defmacro post-restore-func (func &rest body)
>> +  (let ((fdef (symbol-function func)))
>> +    `(unwind-protect
>> +	 (progn ,@body)
>> +       (fset ',func ,fdef))))
>> +(put 'post-restore-func 'lisp-indent-function
>> +     (get 'prog1 'lisp-indent-function))
> Since it's only used once, I don't think it's worth defining a macro for it.

Probably true. I wasn't sure how much I would end up using it, and it 
seemed like a potentially useful macro to have lying around when testing 
advice that might break core functions of emacs.

Anyway, I wasn't very creative with my test names or function names, and 
I'd be happy to submit a new patch with more informative names (as well 
as the above changes). Is there a naming convention for tests/functions 
that I should adhere to?




This bug report was last modified 11 years and 243 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.