• Re: Get function description

    From Aidan Kehoe@21:1/5 to All on Wed Mar 6 20:07:19 2024
    Ar an séiú lá de mí Márta, scríobh Daniel Cerqueira:

    I am using Emacs LISP and I want to get the description of some Elisp function.

    How can I do that?

    F1 f function-name RET

    For example, F1 f car RET brings up a buffer documenting that function:

    car is a built-in function in ‘C source code’.

    (car LIST)

    Return the car of LIST. If LIST is nil, return nil.
    Error if LIST is not nil and not a cons cell. See also ‘car-safe’.

    See Info node ‘(elisp)Cons Cells’ for a discussion of related basic
    Lisp concepts such as car, cdr, cons cell and list.

    Other relevant functions are documented in the list group.
    Probably introduced at or before Emacs version 1.2.
    This function does not change global state, including the match data.

    Also helpful for under-documented functions is M-x find-function RET , which will bring you to the source code of a function. E.g. M-x find-function RET find-file RET loads files.el and brings the cursor to the (defun ...) that defines #'find-file.


    --
    ‘As I sat looking up at the Guinness ad, I could never figure out /
    How your man stayed up on the surfboard after fourteen pints of stout’
    (C. Moore)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Daniel Cerqueira@21:1/5 to All on Wed Mar 6 19:43:56 2024
    I am using Emacs LISP and I want to get the description of some Elisp
    function.

    How can I do that?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Aidan Kehoe on Wed Mar 6 21:04:00 2024
    On Wed, 06 Mar 2024 20:07:19 +0000, Aidan Kehoe wrote:

    F1 f function-name RET

    CTRL/H or F1 is the prefix for all the help functions. E.g. CTRL/H-a to do
    an apropos search of command names, CTRL/H-c to get help for a key
    sequence, and of course CTRL/H-? to see what all the help functions are.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Daniel Cerqueira@21:1/5 to Aidan Kehoe on Thu Mar 7 10:18:06 2024
    Aidan Kehoe <kehoea@parhasard.net> writes:

    Ar an séiú lá de mí Márta, scríobh Daniel Cerqueira:

    I am using Emacs LISP and I want to get the description of some Elisp function.

    How can I do that?

    F1 f function-name RET

    For example, F1 f car RET brings up a buffer documenting that function:

    car is a built-in function in ‘C source code’.

    (car LIST)

    Return the car of LIST. If LIST is nil, return nil.
    Error if LIST is not nil and not a cons cell. See also ‘car-safe’.

    See Info node ‘(elisp)Cons Cells’ for a discussion of related basic
    Lisp concepts such as car, cdr, cons cell and list.

    Other relevant functions are documented in the list group.
    Probably introduced at or before Emacs version 1.2.
    This function does not change global state, including the match data.

    Also helpful for under-documented functions is M-x find-function RET , which will bring you to the source code of a function. E.g. M-x find-function RET find-file RET loads files.el and brings the cursor to the (defun ...) that defines #'find-file.

    Thanks. I did not explain my issue correctly.

    I want to, in Elisp code, get a string of a function description. Similar to Common LISP `description` function.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Landscheidt@21:1/5 to Daniel Cerqueira on Thu Mar 7 14:43:36 2024
    Daniel Cerqueira <dan.list@lispclub.com> wrote:

    […]

    I want to, in Elisp code, get a string of a function description. Similar to Common LISP `description` function.

    I don't know Common Lisp, but in Emacs Lisp you can:

    | ELISP> (defun tl-dummy nil (and t nil))
    | tl-dummy
    | ELISP> (pp-to-string (symbol-function 'tl-dummy))
    | "(closure
    | (t)
    | nil
    | (and t nil))
    | "
    | ELISP>

    But this will not work either for autoloaded functions nor
    functions defined in C:

    | ELISP> (pp-to-string (symbol-function 'rpm-spec-mode))
    | "(autoload \"rpm-spec-mode\" \"RPM spec mode.\" t nil)
    | "
    | ELISP> (pp-to-string (symbol-function 'car))
    | "#<subr car>"
    | ELISP>

    Tim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Aidan Kehoe@21:1/5 to All on Thu Mar 7 15:16:31 2024
    Ar an seachtú lá de mí Márta, scríobh Daniel Cerqueira:

    Aidan Kehoe <kehoea@parhasard.net> writes:

    Ar an séiú lá de mí Márta, scríobh Daniel Cerqueira:

    I am using Emacs LISP and I want to get the description of some Elisp function.

    How can I do that?

    F1 f function-name RET

    For example, F1 f car RET brings up a buffer documenting that function:

    car is a built-in function in ‘C source code’.

    (car LIST)

    Return the car of LIST. If LIST is nil, return nil.
    Error if LIST is not nil and not a cons cell. See also ‘car-safe’.

    See Info node ‘(elisp)Cons Cells’ for a discussion of related basic
    Lisp concepts such as car, cdr, cons cell and list.

    Other relevant functions are documented in the list group.
    Probably introduced at or before Emacs version 1.2.
    This function does not change global state, including the match data.

    Also helpful for under-documented functions is M-x find-function RET , which
    will bring you to the source code of a function. E.g. M-x find-function RET
    find-file RET loads files.el and brings the cursor to the (defun ...) that defines #'find-file.

    Thanks. I did not explain my issue correctly.

    I want to, in Elisp code, get a string of a function description. Similar to Common LISP `description` function.

    There’s nothing exactly like the Common Lisp #'describe function, but #'help-function-arglist may go part of the way to what you would like.

    --
    ‘As I sat looking up at the Guinness ad, I could never figure out /
    How your man stayed up on the surfboard after fourteen pints of stout’
    (C. Moore)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)