Questions tagged [doc-strings]

33 questions
14
votes
1 answer

How to retrieve docstrings from functions and variables?

I'm trying to write a function that will retrieve the docstrings from any sexps in a file that match (def.*). I'd want to both be able to retrieve any functions/macros, as well as any variables that are defined. For variables I would want the…
Jonathan Leech-Pepin
  • 4,307
  • 1
  • 19
  • 32
12
votes
2 answers

Is it possible to attach generated doc string to a lambda?

Emacs docs say that when doc string is put inside of lambda or defun it's “stored directly in the function object”. However, we can change docs of named functions like this: (put 'my-function-name 'function-documentation "Blah.") But the same trick…
Mark Karpov
  • 4,893
  • 1
  • 24
  • 53
12
votes
4 answers

Library for automatically inserting python docstring in Google style

I'm looking for an elisp package that automatically inserts Python docstring for a method. I found a package, which is very close to my purpose. But it's in reStructured text, not in Google…
sy2
  • 123
  • 1
  • 4
11
votes
3 answers

Is there a better way to handle multiline docstrings in elisp?

I hate the way that elisp (not sure if LISP in general) handles multiline docstrings. (defun foo () "This is a multi liner docstring" (do-stuff)) I sure do wish that I could do something like (defun foo () (eval-when-compile (concat …
Krazy Glew
  • 242
  • 2
  • 8
5
votes
1 answer

What is \= in doc strings?

Bleeding edge Emacs is starting to complain about certain uses of ' in doc strings. I am trying to resolve these. As a typical example, in a doc string I might include an example: (defun my-mode-indent-function (&optional _whole-exp) "Indent. To…
Greg Hendershott
  • 1,483
  • 12
  • 17
5
votes
2 answers

Change doc string summary of a function on the fly

Is it possible to change the first line of a docstring of a function, without editing the source code of this function? And if, how can I do this? Background: some packages come with a pretty useless doc string summary. (for example, fci-mode:…
jue
  • 4,476
  • 8
  • 20
5
votes
1 answer

display eldoc help info behind point

I have the following code to replace default eldoc display function: (defun my-eldoc-display-message-momentary (format-string &rest args) "Display eldoc message near point." (when format-string ;; (pos-tip-show (apply 'format…
stardiviner
  • 1,888
  • 26
  • 45
4
votes
2 answers

Emacs 29 docstring single quote escaping rules, compiler level event?

I've seen the following warning from the Emacs 29 compiler: In s-format: s.el:614:2: Warning: docstring has wrong usage of unescaped single quotes (use \= or different quoting) I haven't been able to find this documented. Can anyone…
ocodo
  • 1,202
  • 11
  • 20
4
votes
2 answers

Disabling quote conversion in docstrings

(defun foo () "`bar'") The ASCII quotes in this docstring are displayed as typographical quotes by describe-function. Is it possible to have them displayed in their original form?
Toothrot
  • 3,204
  • 1
  • 12
  • 30
4
votes
1 answer

What is the logic behind the weird lisp docstring (left) indentation?

Why is the third line in this code indented "too much" to the left? It feels "off" to me. (defun hello-world nil "Greet the world. This function implements the canonical example program." (interactive) (message "Hello world!"))
american-ninja-warrior
  • 3,773
  • 2
  • 21
  • 40
4
votes
2 answers

How can I record where a function is defined if it's done indirectly?

I've got a few functions in api-wrap.el that I'll refer to as 'macro code', here simplified to clarify the question: function (generate-form prefix kind &rest args) returns an unevaluated form that would define a new specific function macro…
Sean Allred
  • 6,861
  • 16
  • 85
4
votes
0 answers

"helm-documentation"? (search docstrings like apropos-documentation but with helm)

I just started using helm-apropos. It's great! Is there a helm equivalent for apropos-documentation or alternatively does helm-apropos have sources already available to narrow over docstrings?
ebpa
  • 7,319
  • 26
  • 53
3
votes
1 answer

Documenting keyboard macros Can I have a doc string for fset the same way as defun

I often create and save elaborate keyboard macros that I wish to use later, and hope to be prompted for the proper context to use them. I note that if I manually write a function to use as a command I can have a doc string (defun my-handy-command…
Chip Grandits
  • 267
  • 1
  • 6
3
votes
2 answers

How can I disable indentation rules within docstrings in python-mode?

When writing within docstrings in python-mode, I'm only able to tab/indent deeper than the leading edge of the string. For example: def foo(): """ | | << the only places I can "tab" to. """ pass I'd like to be able to tab deeper…
Phill Oldham
  • 227
  • 1
  • 9
3
votes
1 answer

FORM vs BODY in documentation?

Recently I was trapped by void-variable error on eval-after-load. That is not first time I forget to quote args like: (eval-after-load 'sql '(progn ...)) because eval-after-load docs say: (eval-after-load FILE FORM) I wrongly expect that…
gavenkoa
  • 3,352
  • 19
  • 36
1
2 3