unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: rms@gnu.org, monnier+gnu/emacs@rum.cs.yale.edu, emacs-devel@gnu.org
Subject: arglist in docstring (was: mentioning variable aliases in `describe-variable' )
Date: Wed, 17 Jul 2002 09:06:56 -0400	[thread overview]
Message-ID: <200207171306.g6HD6uN02339@rum.cs.yale.edu> (raw)
In-Reply-To: 20020717091513.F3D1.LEKTU@terra.es

> On Tue, 16 Jul 2002 21:04:45 -0600 (MDT), Richard Stallman <rms@gnu.org> wrote:
> 
> > Perhaps the best thing is simply to tell the user how to put in the
> > arglist info when making an alias for a builtin function.  That is
> > definitely a simple method.
> 
> I agree; it is much better than doing obscure tricks in `defalias', IMO.
> But it'd be also necessary to modify `help-split-fundoc' to allow for a
> different function name in the arglist info, so you can say:
> 
> (defalias 'get-item
>           'aref
>           "Return TABLE[INDEX].\n(get-item TABLE INDEX)")
> 
> and get the arglist info (now you don't).

It's definitely on my plan.  This is not just for the case you mention
but because I want to be able to put arglist in the docstring of
autoloaded functions, as well as change defun* to put the original
CL-style arglist in there, so that describe-function would say:

	(foobar ARG1 &key KEY1 (KEY2 default2))
instead of
	(foobar ARG1 &rest --CL21452--)

We just have to decide on a format to use.  The current format for subr's
"arglist in docstring" can be described as "\n\n(<subrname>\\( .*\\)?)\\'".
Using the subroutine's name in there is annoying since it might not
be the same as the symbol the subr is associated with, so the code currently
uses an ugly hack to find the subr's name.  I'm leaning towards allowing
any functions' docstring to end with "\n\n(fn\\( .*\\)?)\\'" instead.
So you'd say

  (defalias 'get-item 'aref "Return TABLE[INDEX].\n\n(fn TABLE INDEX)")

This is pretty easy to implement (I have the code mostly working,
with the only ugliness being "where to put the functions that
insert/extract this arglist info" since they are used by CL, help-fns.el,
eldoc.el, autoload.el, advice.el and maybe more.  I guess the trivial
answer is "in subr.el").

An alternative is to put this info not at the very end, but rather
near the beginning of the docstring.  The reason is that it works
better in the case where someone appends text to the docstring (try
(defadvice car (after foobar activate) 1) and then C-h f car RET
to see what I'm getting at).
Of course, putting it on the first line is probably out because
the first line is handled specially in a few places and it'd be better
not to have to change those.  But maybe we could put it on the
second line such that the regexp would be something like
"\\`.*\nUsage: (fn\\( .*\\)?)$".


	Stefan

  reply	other threads:[~2002-07-17 13:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-10  9:42 mentioning variable aliases in `describe-variable' John Paul Wallington
2002-07-11 19:25 ` Stefan Monnier
2002-07-12  0:30   ` John Paul Wallington
2002-07-12 10:17     ` Juanma Barranquero
2002-07-12 15:25       ` Stefan Monnier
2002-07-15 15:40         ` Juanma Barranquero
2002-07-16 11:31         ` Juanma Barranquero
2002-07-17  3:04           ` Richard Stallman
2002-07-17  8:02             ` Juanma Barranquero
2002-07-17 13:06               ` Stefan Monnier [this message]
2002-07-17 13:51                 ` arglist in docstring (was: mentioning variable aliases in `describe-variable' ) Juanma Barranquero
2002-07-17 14:33                   ` Stefan Monnier
2002-07-17 15:02                     ` Juanma Barranquero
2002-07-17 14:21                 ` Juanma Barranquero
2002-07-17 14:31                   ` Stefan Monnier
2002-07-17 15:15                     ` Juanma Barranquero
2002-07-18 14:55                   ` Richard Stallman
2002-07-18 15:25                     ` Juanma Barranquero
2002-07-18 21:14                       ` Richard Stallman
2002-07-19  6:28                         ` Juanma Barranquero
2002-07-12  7:18   ` mentioning variable aliases in `describe-variable' Juanma Barranquero
2002-07-12  7:55     ` John Paul Wallington
2002-07-12  8:00       ` Miles Bader
2002-07-12  8:47         ` John Paul Wallington
2002-07-12 10:26           ` Juanma Barranquero
2002-07-12 15:25         ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200207171306.g6HD6uN02339@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /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 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).