GNU bug report logs - #16993
advice-add hides docstring

Previous Next

Package: emacs;

Reported by: Juanma Barranquero <lekktu <at> gmail.com>

Date: Wed, 12 Mar 2014 04:39:01 UTC

Severity: important

Found in version 24.3.50

Done: Juanma Barranquero <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16993 in the body.
You can then email your comments to 16993 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Wed, 12 Mar 2014 04:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juanma Barranquero <lekktu <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 12 Mar 2014 04:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Bug-Gnu-Emacs <bug-gnu-emacs <at> gnu.org>
Subject: advice-add hides docstring
Date: Wed, 12 Mar 2014 05:38:03 +0100
Package: emacs
Version: 24.3.50

ISTR this was discussed before, but I cannot find a bug report about it...

Some advice-add'ed functions lose their docstring. Current examples
from "emacs -Q" include `insert-directory', `rename-buffer' and
`create-file-buffer'.

Others do no. After (require 'cl), `dolist', `dotimes' and `declare'
still have their docstrings.

After loading ses.el, both `yank' and `copy-region-as-kill' still have
their docstrings. However, in

C-h f yank <RET>

the around advice info

  :around advice: `ses--advice-yank'

isn't font-locked as it is in other cases.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Wed, 12 Mar 2014 19:35:01 GMT) Full text and rfc822 format available.

Message #8 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Wed, 12 Mar 2014 15:34:05 -0400
Juanma Barranquero wrote:

> C-h f yank <RET>
>
> the around advice info
>
>   :around advice: `ses--advice-yank'
>
> isn't font-locked as it is in other cases.

I think this is because substitute-command-keys (in describe-function-1)
removes text properties (per its documentation).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Wed, 12 Mar 2014 19:51:02 GMT) Full text and rfc822 format available.

Message #11 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Wed, 12 Mar 2014 20:49:52 +0100
On Wed, Mar 12, 2014 at 8:34 PM, Glenn Morris <rgm <at> gnu.org> wrote:

> I think this is because substitute-command-keys (in describe-function-1)
> removes text properties (per its documentation).

Aha, I tried with two test functions, one with a key binding in its
doc (\\[universal-argument]) and the other without, and indeed, the
first one gets its advice info's font-locking removed and the other
doesn't.

I'll try to come with an easy fix, if at all possible, unless you beat
me to it (feel free to ;-)

Still, the other problem (docstrings missing) is much more serious.

Thanks,

   J




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Wed, 12 Mar 2014 19:57:01 GMT) Full text and rfc822 format available.

Message #14 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Wed, 12 Mar 2014 15:55:57 -0400
Juanma Barranquero wrote:

> Aha, I tried with two test functions, one with a key binding in its
> doc (\\[universal-argument]) and the other without, and indeed, the
> first one gets its advice info's font-locking removed and the other
> doesn't.
>
> I'll try to come with an easy fix, if at all possible, unless you beat
> me to it (feel free to ;-)

I don't intend to work on it, but IMO substitute-command-keys should
preserve text properties.
AFAIK, there's no particular reason why it removes them; see e.g.

http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-11/msg00094.html

> Still, the other problem (docstrings missing) is much more serious.

I guess that's something to do with built-in functions.
(I don't see an issue with insert-directory.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Wed, 12 Mar 2014 20:17:01 GMT) Full text and rfc822 format available.

Message #17 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Wed, 12 Mar 2014 21:15:41 +0100
On Wed, Mar 12, 2014 at 8:55 PM, Glenn Morris <rgm <at> gnu.org> wrote:

> I don't intend to work on it, but IMO substitute-command-keys should
> preserve text properties.
> AFAIK, there's no particular reason why it removes them; see e.g.
>
> http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-11/msg00094.html

I'll look into it. Thanks.

> I guess that's something to do with built-in functions.
> (I don't see an issue with insert-directory.)

Because your Emacs doesn't use ls-lisp, I guess. Do you see the
problem if you load eshell?

    J




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Wed, 12 Mar 2014 20:32:02 GMT) Full text and rfc822 format available.

Message #20 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Wed, 12 Mar 2014 16:31:48 -0400
Juanma Barranquero wrote:

>> (I don't see an issue with insert-directory.)
>
> Because your Emacs doesn't use ls-lisp, I guess. Do you see the
> problem if you load eshell?

No. Nor if I load ls-lisp. Perhaps it has to loaded before dumping.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Wed, 12 Mar 2014 20:35:01 GMT) Full text and rfc822 format available.

Message #23 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Wed, 12 Mar 2014 21:33:56 +0100
On Wed, Mar 12, 2014 at 9:31 PM, Glenn Morris <rgm <at> gnu.org> wrote:

> No. Nor if I load ls-lisp. Perhaps it has to loaded before dumping.

Worth checking, I suppose.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Wed, 19 Mar 2014 16:55:01 GMT) Full text and rfc822 format available.

Message #26 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Wed, 19 Mar 2014 17:53:47 +0100
On Wed, Mar 12, 2014 at 8:55 PM, Glenn Morris <rgm <at> gnu.org> wrote:

> I don't intend to work on it, but IMO substitute-command-keys should
> preserve text properties.
> AFAIK, there's no particular reason why it removes them; see e.g.
>
> http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-11/msg00094.html

I'll raise the issue on emacs-devel after the freeze.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Wed, 19 Mar 2014 18:30:03 GMT) Full text and rfc822 format available.

Message #29 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Stefan <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Wed, 19 Mar 2014 14:29:19 -0400
> Some advice-add'ed functions lose their docstring.  Current examples
> from "emacs -Q" include `insert-directory', `rename-buffer' and
> `create-file-buffer'.

That's an incompatibility with Snarf-documentation: Snarf-documentation
scans the DOC file, finds the doc of rename-buffer, and tries to stick
the corresponding DOC offset in rename-buffer's "docstring slot".
This should set the "docstring slot" of the #<subr rename-buffer>, but
instead (symbol-function 'rename-buffer) returns an `advice--p' object,
so Snarf-documentation tries to set the docstring slot of that object
(which fails because the vector doesn't have a slot for it, but even if
it succeeded it wouldn't be what we want).

We can either fix it by teaching Snarf-documentation about advised
function (yuck!) or by not advising functions that are documented in
DOC.  IOW the right fix is to get rid of those advices in uniquify.el.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Thu, 20 Mar 2014 05:19:02 GMT) Full text and rfc822 format available.

Message #32 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan <monnier <at> iro.umontreal.ca>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Thu, 20 Mar 2014 06:18:01 +0100
On Wed, Mar 19, 2014 at 7:29 PM, Stefan <monnier <at> iro.umontreal.ca> wrote:

> We can either fix it by teaching Snarf-documentation about advised
> function (yuck!) or by not advising functions that are documented in
> DOC.  IOW the right fix is to get rid of those advices in uniquify.el.

IIUC, you're not proposing to delay the advice-add calls, but remove
them altogether. How would you re-implement the current functionality
so rename-buffer and create-file-buffer still respect uniquify? Some
kind of hook in these functions?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Thu, 20 Mar 2014 12:57:03 GMT) Full text and rfc822 format available.

Message #35 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Stefan <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Thu, 20 Mar 2014 08:56:16 -0400
>> We can either fix it by teaching Snarf-documentation about advised
>> function (yuck!) or by not advising functions that are documented in
>> DOC.  IOW the right fix is to get rid of those advices in uniquify.el.
> IIUC, you're not proposing to delay the advice-add calls, but remove
> them altogether.

Right.

> How would you re-implement the current functionality so rename-buffer
> and create-file-buffer still respect uniquify? Some kind of hook in
> these functions?

I haven't looked at it yet, but last time I looked at removing
uniquify's advices (that was many years ago), I couldn't come up with
a good hook, so I expect that we'll "simply" change the current
code of those 2 functions by adding explicit calls to uniquify.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Thu, 20 Mar 2014 13:57:02 GMT) Full text and rfc822 format available.

Message #38 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan <monnier <at> iro.umontreal.ca>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Thu, 20 Mar 2014 14:56:08 +0100
On Thu, Mar 20, 2014 at 1:56 PM, Stefan <monnier <at> iro.umontreal.ca> wrote:

> I haven't looked at it yet, but last time I looked at removing
> uniquify's advices (that was many years ago), I couldn't come up with
> a good hook, so I expect that we'll "simply" change the current
> code of those 2 functions by adding explicit calls to uniquify.

OK. I'll raise this issue too After the Freeze (tm).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Thu, 20 Mar 2014 15:58:02 GMT) Full text and rfc822 format available.

Message #41 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: Stefan <monnier <at> iro.umontreal.ca>, 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Thu, 20 Mar 2014 11:57:21 -0400
This is http://debbugs.gnu.org/1338, BTW.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Thu, 20 Mar 2014 16:03:03 GMT) Full text and rfc822 format available.

Message #44 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Stefan <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Thu, 20 Mar 2014 12:02:25 -0400
> Some advice-add'ed functions lose their docstring. Current examples
> from "emacs -Q" include `insert-directory', `rename-buffer' and
> `create-file-buffer'.

I installed a workaround for these.

> the around advice info
>   :around advice: `ses--advice-yank'
> isn't font-locked as it is in other cases.

I think this will have to wait for 24.5 to be fixed :-(


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Thu, 20 Mar 2014 16:20:02 GMT) Full text and rfc822 format available.

Message #47 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan <monnier <at> iro.umontreal.ca>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Thu, 20 Mar 2014 17:18:45 +0100
forcemerge 16993 1338
close 16993
quit

On Thu, Mar 20, 2014 at 5:02 PM, Stefan <monnier <at> iro.umontreal.ca> wrote:

> I installed a workaround for these.

Thanks. I'm closing this one and #1338, and will file a separate bug
for substitute-command-keys.

> I think this will have to wait for 24.5 to be fixed :-(

Of course.




Forcibly Merged 1338 16993. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 20 Mar 2014 16:20:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 16993 <at> debbugs.gnu.org and Juanma Barranquero <lekktu <at> gmail.com> Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 20 Mar 2014 16:20:04 GMT) Full text and rfc822 format available.

Disconnected #1338 from all other report(s). Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 20 Mar 2014 16:36:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Thu, 20 Mar 2014 17:56:01 GMT) Full text and rfc822 format available.

Message #56 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Stefan <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Thu, 20 Mar 2014 13:55:45 -0400
> Thanks. I'm closing this one and #1338,

No, my patch doesn't eliminate the advice on rename-buffer, it just
makes C-h f rename-buffer find the right docstring (even tho it was put
at the wrong place).

> and will file a separate bug
> for substitute-command-keys.

Please do, thanks,


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16993; Package emacs. (Thu, 20 Mar 2014 18:00:04 GMT) Full text and rfc822 format available.

Message #59 received at 16993 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan <monnier <at> iro.umontreal.ca>
Cc: 16993 <at> debbugs.gnu.org
Subject: Re: bug#16993: advice-add hides docstring
Date: Thu, 20 Mar 2014 18:59:13 +0100
> No, my patch doesn't eliminate the advice on rename-buffer, it just
> makes C-h f rename-buffer find the right docstring (even tho it was put
> at the wrong place).

Yes, my mistake, I already re-opened bug#1338.

> Please do, thanks,

Done as bug#17052.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 18 Apr 2014 11:24:05 GMT) Full text and rfc822 format available.

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

Previous Next


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