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

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

bug#48768: [External] : bug#48768: Introducing ability to append to docs


From: Drew Adams
Subject: bug#48768: [External] : bug#48768: Introducing ability to append to docstring
Date: Tue, 1 Jun 2021 14:44:16 +0000

> >   > A useful capability would allow one to append to a defun docstring
> >   > using a defvar.
> >   > User could write a brief description for the docstring, and later
> >   > append more details
> >   > from a defvar.
> >
> > Could you show an example of what this would look like, in use?
> >
> > I'm trying to guess -- though I don't have confidence in my guess --
> > and I think this might be a useful feature but would be easier to use
> > with a different interface.
> 
> We already have the `function-documentation' symbol property, no?
> 
> I wonder what use cases the OP has in mind for that that interface we
> have is not sufficient and why the suggested interface would be more
> appropriate.

Not to mention that you can add to an existing doc string
using advice (old advice or new nadvice, AFAIK).
___


In the days before nadvice, the doc addition appeared
in-line, as part of the doc you see when you use `C-h f'.
Now (unfortunately) we instead insert a link in the
`C-h f' help display, and only if you click that link
do you see (only) that added doc in *Help*.

IOW, you don't get an integrated view of the doc.  One
could argue that this is a plus, not a minus, as it
separates what is provided by the advice.  I think this
is a loss, but I can see that it could be good for each
behavior (integrated or separate) to be possible.
Unfortunately, we only have the separate-display (link)
behavior, not the integrated-doc behavior.

There's one such link for each bit of advice for the
function, and there's no indication that any given bit
of advice provides more doc.

E.g. In my setup command `dired' has two bits of advice,
and this is (the start of) what `C-h f dired' shows:

,----
| dired is an interactive autoloaded compiled Lisp function in
| 'dired.el'.
| 
| It is bound to C-x d, menu-bar file dired.
| 
| (dired DIRNAME &optional SWITCHES)
| 
| :around advice: 'ad-Advice-dired'
| :around advice: 'ls-lisp--dired'
| 
| "Edit" directory DIRNAME--delete, rename, print, etc. some files in it.
| Optional second argument SWITCHES specifies the `ls' options used.
| (Interactively, use a prefix argument to be able to specify SWITCHES.)
| ...
`----

'ad-Advice-dired' and 'ls-lisp--dired' are help links.

That first bit of advice, named `ad-Advice-dired',
only adds doc to the doc string.  Clicking that link
shows (only) that additional doc.

The second bit of advice adds no doc - it is provided
by vanilla Emacs itself (in ls-lisp.el).  Clicking
that second link shows only this in *Help*:

,----
| ls-lisp--dired is an interactive compiled Lisp function in
| 'ls-lisp.el'.
| 
| (ls-lisp--dired ORIG-FUN DIR-OR-LIST &optional SWITCHES)
`----
___

I thought Emacs has a general policy for its code
not to use advice, but `ls-lisp.el' does use it:

  (advice-add 'dired :around #'ls-lisp--dired)





reply via email to

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