unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16993: advice-add hides docstring
@ 2014-03-12  4:38 Juanma Barranquero
  2014-03-12 19:34 ` Glenn Morris
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Juanma Barranquero @ 2014-03-12  4:38 UTC (permalink / raw)
  To: 16993

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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-12  4:38 bug#16993: advice-add hides docstring Juanma Barranquero
@ 2014-03-12 19:34 ` Glenn Morris
  2014-03-12 19:49   ` Juanma Barranquero
  2014-03-19 18:29 ` Stefan
  2014-03-20 16:02 ` Stefan
  2 siblings, 1 reply; 17+ messages in thread
From: Glenn Morris @ 2014-03-12 19:34 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 16993

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).





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-12 19:34 ` Glenn Morris
@ 2014-03-12 19:49   ` Juanma Barranquero
  2014-03-12 19:55     ` Glenn Morris
  0 siblings, 1 reply; 17+ messages in thread
From: Juanma Barranquero @ 2014-03-12 19:49 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 16993

On Wed, Mar 12, 2014 at 8:34 PM, Glenn Morris <rgm@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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-12 19:49   ` Juanma Barranquero
@ 2014-03-12 19:55     ` Glenn Morris
  2014-03-12 20:15       ` Juanma Barranquero
  2014-03-19 16:53       ` Juanma Barranquero
  0 siblings, 2 replies; 17+ messages in thread
From: Glenn Morris @ 2014-03-12 19:55 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 16993

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.)





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-12 19:55     ` Glenn Morris
@ 2014-03-12 20:15       ` Juanma Barranquero
  2014-03-12 20:31         ` Glenn Morris
  2014-03-19 16:53       ` Juanma Barranquero
  1 sibling, 1 reply; 17+ messages in thread
From: Juanma Barranquero @ 2014-03-12 20:15 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 16993

On Wed, Mar 12, 2014 at 8:55 PM, Glenn Morris <rgm@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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-12 20:15       ` Juanma Barranquero
@ 2014-03-12 20:31         ` Glenn Morris
  2014-03-12 20:33           ` Juanma Barranquero
  0 siblings, 1 reply; 17+ messages in thread
From: Glenn Morris @ 2014-03-12 20:31 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 16993

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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-12 20:31         ` Glenn Morris
@ 2014-03-12 20:33           ` Juanma Barranquero
  0 siblings, 0 replies; 17+ messages in thread
From: Juanma Barranquero @ 2014-03-12 20:33 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 16993

On Wed, Mar 12, 2014 at 9:31 PM, Glenn Morris <rgm@gnu.org> wrote:

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

Worth checking, I suppose.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-12 19:55     ` Glenn Morris
  2014-03-12 20:15       ` Juanma Barranquero
@ 2014-03-19 16:53       ` Juanma Barranquero
  1 sibling, 0 replies; 17+ messages in thread
From: Juanma Barranquero @ 2014-03-19 16:53 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 16993

On Wed, Mar 12, 2014 at 8:55 PM, Glenn Morris <rgm@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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-12  4:38 bug#16993: advice-add hides docstring Juanma Barranquero
  2014-03-12 19:34 ` Glenn Morris
@ 2014-03-19 18:29 ` Stefan
  2014-03-20  5:18   ` Juanma Barranquero
  2014-03-20 16:02 ` Stefan
  2 siblings, 1 reply; 17+ messages in thread
From: Stefan @ 2014-03-19 18:29 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 16993

> 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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-19 18:29 ` Stefan
@ 2014-03-20  5:18   ` Juanma Barranquero
  2014-03-20 12:56     ` Stefan
  0 siblings, 1 reply; 17+ messages in thread
From: Juanma Barranquero @ 2014-03-20  5:18 UTC (permalink / raw)
  To: Stefan; +Cc: 16993

On Wed, Mar 19, 2014 at 7:29 PM, Stefan <monnier@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?





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-20  5:18   ` Juanma Barranquero
@ 2014-03-20 12:56     ` Stefan
  2014-03-20 13:56       ` Juanma Barranquero
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan @ 2014-03-20 12:56 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 16993

>> 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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-20 12:56     ` Stefan
@ 2014-03-20 13:56       ` Juanma Barranquero
  2014-03-20 15:57         ` Glenn Morris
  0 siblings, 1 reply; 17+ messages in thread
From: Juanma Barranquero @ 2014-03-20 13:56 UTC (permalink / raw)
  To: Stefan; +Cc: 16993

On Thu, Mar 20, 2014 at 1:56 PM, Stefan <monnier@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).





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-20 13:56       ` Juanma Barranquero
@ 2014-03-20 15:57         ` Glenn Morris
  0 siblings, 0 replies; 17+ messages in thread
From: Glenn Morris @ 2014-03-20 15:57 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 16993


This is http://debbugs.gnu.org/1338, BTW.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-12  4:38 bug#16993: advice-add hides docstring Juanma Barranquero
  2014-03-12 19:34 ` Glenn Morris
  2014-03-19 18:29 ` Stefan
@ 2014-03-20 16:02 ` Stefan
  2014-03-20 16:18   ` Juanma Barranquero
  2 siblings, 1 reply; 17+ messages in thread
From: Stefan @ 2014-03-20 16:02 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 16993

> 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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-20 16:02 ` Stefan
@ 2014-03-20 16:18   ` Juanma Barranquero
  2014-03-20 17:55     ` Stefan
  0 siblings, 1 reply; 17+ messages in thread
From: Juanma Barranquero @ 2014-03-20 16:18 UTC (permalink / raw)
  To: Stefan; +Cc: 16993

forcemerge 16993 1338
close 16993
quit

On Thu, Mar 20, 2014 at 5:02 PM, Stefan <monnier@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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-20 16:18   ` Juanma Barranquero
@ 2014-03-20 17:55     ` Stefan
  2014-03-20 17:59       ` Juanma Barranquero
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan @ 2014-03-20 17:55 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 16993

> 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





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#16993: advice-add hides docstring
  2014-03-20 17:55     ` Stefan
@ 2014-03-20 17:59       ` Juanma Barranquero
  0 siblings, 0 replies; 17+ messages in thread
From: Juanma Barranquero @ 2014-03-20 17:59 UTC (permalink / raw)
  To: Stefan; +Cc: 16993

> 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.





^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-03-20 17:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-12  4:38 bug#16993: advice-add hides docstring Juanma Barranquero
2014-03-12 19:34 ` Glenn Morris
2014-03-12 19:49   ` Juanma Barranquero
2014-03-12 19:55     ` Glenn Morris
2014-03-12 20:15       ` Juanma Barranquero
2014-03-12 20:31         ` Glenn Morris
2014-03-12 20:33           ` Juanma Barranquero
2014-03-19 16:53       ` Juanma Barranquero
2014-03-19 18:29 ` Stefan
2014-03-20  5:18   ` Juanma Barranquero
2014-03-20 12:56     ` Stefan
2014-03-20 13:56       ` Juanma Barranquero
2014-03-20 15:57         ` Glenn Morris
2014-03-20 16:02 ` Stefan
2014-03-20 16:18   ` Juanma Barranquero
2014-03-20 17:55     ` Stefan
2014-03-20 17:59       ` Juanma Barranquero

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).