From: Tassilo Horn <tsdh@gnu.org>
To: Perry Smith <pedzsan@gmail.com>
Cc: "help-gnu-emacs@gnu.org Help" <help-gnu-emacs@gnu.org>
Subject: Re: Is this a bug?
Date: Tue, 03 Dec 2013 09:46:19 +0100 [thread overview]
Message-ID: <87y5428gpw.fsf@tsdh.uni-koblenz.de> (raw)
In-Reply-To: <A11BAD37-3514-4D61-98AA-61C98EAC4322@gmail.com> (Perry Smith's message of "Mon, 2 Dec 2013 07:51:30 -0600")
Perry Smith <pedzsan@gmail.com> writes:
Hi Perry,
> Now the non-working case. Repeat the above after adding advice:
>
> (defadvice load (before load-log activate)
> (message "Loading %s" (ad-get-arg 0)))
>
> and I get an error with the stack:
>
> Debugger entered--Lisp error: (wrong-type-argument subrp (lambda (file
> &optional noerror nomessage n$
> subr-name((lambda (file &optional noerror nomessage nosuffix must-suffix)
It seems like a bug in 24.3 since your example now works with the
current bzr trunk. Nevertheless, the docs explicitly warn about
advising subrs like `load':
,----[ (info "(elisp)Advising Functions") ]
| Unless you know what you are doing, do _not_ advise a primitive
| (*note What Is a Function::). Some primitives are used by the advice
| mechanism; advising them could cause an infinite recursion. Also, many
| primitives are called directly from C code. Calls to the primitive from
| Lisp code will take note of the advice, but calls from C code will
| ignore the advice.
`----
The concrete problem is that `help-C-file-name' assumes that a function
defined in C is a subr. But when you add a piece of advice, the subr
is wrapped in a lisp function, and then `subr-name' fails.
--8<---------------cut here---------------start------------->8---
ELISP> (symbol-function 'load)
#<subr load>
ELISP> (defadvice load (before load-log activate)
(message "Loading %s" (ad-get-arg 0)))
load
ELISP> (symbol-function 'load)
#[128 "\300\301\302.#\207"
[apply ad-Advice-load #<subr load> nil]
5
#("Advised function" 0 16
(dynamic-docstring-function advice--make-docstring))]
--8<---------------cut here---------------end--------------->8---
After defining the advice with the current bzr version, the help buffer
states "load is a compiled Lisp function" without any file link. That's
better than an error, but still not perfect. One could get the original
subr with (ad-get-orig-definition 'load) to also include a link to the C
source.
I just checked: with emacs 23, when you advised load or any other subr,
C-h f still had a link to the C source, so IMHO that counts as a
regression.
Bye,
Tassilo
next prev parent reply other threads:[~2013-12-03 8:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-02 13:51 Is this a bug? Perry Smith
2013-12-03 8:46 ` Tassilo Horn [this message]
2013-12-03 9:16 ` Tassilo Horn
-- strict thread matches above, loose matches on Subject: below --
2022-06-17 17:16 hput
2012-09-27 9:36 Is this a bug ? horse_rivers
2012-09-27 17:12 ` Eli Zaretskii
2012-09-28 0:27 ` horse_rivers
2012-09-28 7:30 ` Eli Zaretskii
2009-09-16 22:31 Is this a bug? Leo
2008-03-28 21:27 is " David Roderick
2008-03-28 22:10 ` Pascal Bourguignon
2008-03-29 3:02 ` Barry Margolin
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y5428gpw.fsf@tsdh.uni-koblenz.de \
--to=tsdh@gnu.org \
--cc=help-gnu-emacs@gnu.org \
--cc=pedzsan@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.