unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Display docstrings present in a buffer
@ 2024-08-16  1:45 Heime
  2024-08-16  2:01 ` Heime
  2024-08-17 12:28 ` Joel Reicher
  0 siblings, 2 replies; 4+ messages in thread
From: Heime @ 2024-08-16  1:45 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

Is there a way to display docstrings in a buffer ?  On at least to the first blank line.   





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

* Re: Display docstrings present in a buffer
  2024-08-16  1:45 Display docstrings present in a buffer Heime
@ 2024-08-16  2:01 ` Heime
  2024-08-16  9:11   ` Heime
  2024-08-17 12:28 ` Joel Reicher
  1 sibling, 1 reply; 4+ messages in thread
From: Heime @ 2024-08-16  2:01 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor


On Friday, August 16th, 2024 at 1:45 PM, Heime <heimeborgia@protonmail.com> wrote:

> Is there a way to display docstrings in a buffer ? On at least to the first blank line.

Did this but the buffer remains blank

(defun display-defun-lines ()
  "Display lines starting with `(defun` in a new buffer."
  (interactive)
  (let ((regexp "^\\s-*(defun.*")
        (output-buffer (get-buffer-create "*Defun Lines*")))
    (with-current-buffer output-buffer
      (erase-buffer)  ;; Clear previous contents
      (goto-char (point-min))
      (while (re-search-forward regexp nil t)
        (let ((line (match-string-no-properties 1)))
          (insert (concat line "\n"))))
      (display-buffer output-buffer))))

>



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

* Re: Display docstrings present in a buffer
  2024-08-16  2:01 ` Heime
@ 2024-08-16  9:11   ` Heime
  0 siblings, 0 replies; 4+ messages in thread
From: Heime @ 2024-08-16  9:11 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor


On Friday, August 16th, 2024 at 2:01 PM, Heime <heimeborgia@protonmail.com> wrote:

> On Friday, August 16th, 2024 at 1:45 PM, Heime heimeborgia@protonmail.com wrote:
> 
> > Is there a way to display docstrings in a buffer ? On at least to the first blank line.
> 
> 
> Did this but the buffer remains blank
> 
> (defun display-defun-lines ()
> "Display lines starting with `(defun` in a new buffer."
> (interactive)
> (let ((regexp "^\\s-(defun.")
> (output-buffer (get-buffer-create "Defun Lines")))
> (with-current-buffer output-buffer
> (erase-buffer) ;; Clear previous contents
> (goto-char (point-min))
> (while (re-search-forward regexp nil t)
> (let ((line (match-string-no-properties 1)))
> (insert (concat line "\n"))))
> (display-buffer output-buffer))))

I want to try something else,  Make a function that matches a starting "(defun"
up to either tho clause (interactive) or two blank lines.





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

* Re: Display docstrings present in a buffer
  2024-08-16  1:45 Display docstrings present in a buffer Heime
  2024-08-16  2:01 ` Heime
@ 2024-08-17 12:28 ` Joel Reicher
  1 sibling, 0 replies; 4+ messages in thread
From: Joel Reicher @ 2024-08-17 12:28 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

Heime <heimeborgia@protonmail.com> writes:

> Is there a way to display docstrings in a buffer ?  On at least 
> to the first blank line.

I know you've written further since this email, but just to offer 
you an alternative idea, if the function definitions in the buffer 
have already been evaluated, you can retrieve the docstring using 
the "documentation" function (info "(elisp) Accessing 
Documentation"). If this is something you can use, the problem 
reduces to retrieving the list of functions from the buffer, which 
you can perhaps do with imenu's index.

Cheers,

        - Joel



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

end of thread, other threads:[~2024-08-17 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16  1:45 Display docstrings present in a buffer Heime
2024-08-16  2:01 ` Heime
2024-08-16  9:11   ` Heime
2024-08-17 12:28 ` Joel Reicher

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