all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eduardo Ochs <eduardoochs@gmail.com>
To: Marcin Borkowski <mbork@mbork.pl>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: How does `describe-function' know where the source code of the function is?
Date: Mon, 17 Jan 2022 01:27:10 -0300	[thread overview]
Message-ID: <CADs++6hdwnTRgneT+obYG5gw9fDDV_iC3Z=0NY72gVGzTuw0CA@mail.gmail.com> (raw)
In-Reply-To: <87pmorf1p5.fsf@mbork.pl>

On Mon, 17 Jan 2022 at 01:04, Marcin Borkowski <mbork@mbork.pl> wrote:

> Hi all,
>
> If I define a function with `defun', C-h f gives me a link to the source
> code of the function.  I defined a macro defining a function (its
> expansion contained a `defun'), and C-h f'ing that function did /not/
> give me that link.  I tried saying M-: (symbol-plist 'my-function), but
> I haven't seen any property that would point to the source code.  So, my
> question is: how does `describe-function' know where the link should
> point to (and if it should be rendered at all)?  I skimmed its source
> code, but it seems pretty convoluted.  I found
> `help-fns-function-description-header', but it seems that the actual
> code finding the exact position of the function definition is buried
> deep down the call chain, so I'm asking here in the hope that someone
> could point me to the right place faster than me trying to edebug this
> or something.
>
>
Hi Marcin,

when we run `M-h M-f find-file' or this sexp in eev,

  (find-efunction-links 'find-file)

it shows a temporary buffer with lots of sexps about `find-file',
including some that are quite technical and that are mostly for people
who want to understand how the higher-level functions work. I ran that
now, and the contents of the temporary buffer were these:

  # (find-efunction-links 'find-file)
  # (eek "M-h M-f  find-file")
  # (find-eev-quick-intro "4.2. `find-ekey-links' and friends")

  # (find-efunctiondescr 'find-file)
  # (find-efunction 'find-file)
  # (find-efunctionpp 'find-file)
  # (find-efunctiond 'find-file)

  # (Info-goto-emacs-command-node 'find-file)
  # (find-enode "Command Index" "* find-file:")
  # (find-elnode "Index" "* find-file:")

  # (where-is 'find-file)
  # (symbol-file 'find-file 'defun)
  # (find-fline (symbol-file 'find-file 'defun))
  # (find-epp (assoc (symbol-file 'find-file 'defun) load-history))
  # (find-epp (assoc "/home/edrx/bigsrc/emacs28/lisp/files.elc"
load-history))
  # (find-eppp (mapcar 'car load-history))
  # (find-estring (mapconcat 'identity (mapcar 'car load-history) "\n"))
  # (find-estring (documentation 'find-file))
  # (find-estring (documentation 'find-file t))
  # (describe-function 'find-file)

I think that the sexps in the third block contain a lot of what you
want, and the eev-isms should be easy to ignore.

Btw, I made a video a few weeks ago about the functions of eev that
show lots of very technical sexps like the ones in the third block
above. The video is here:

  http://angg.twu.net/2021-ffll.html

Cheers & happy hacking, =)
  Eduardo Ochs
  http://angg.twu.net/#eev


  parent reply	other threads:[~2022-01-17  4:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17  4:03 How does `describe-function' know where the source code of the function is? Marcin Borkowski
2022-01-17  4:14 ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-01-17  4:27 ` Eduardo Ochs [this message]
2022-01-17 16:22 ` Michael Heerdegen
2022-01-18  2:51 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-01-18 17:41   ` Marcin Borkowski
2022-01-18 18:46     ` 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

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

  git send-email \
    --in-reply-to='CADs++6hdwnTRgneT+obYG5gw9fDDV_iC3Z=0NY72gVGzTuw0CA@mail.gmail.com' \
    --to=eduardoochs@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=mbork@mbork.pl \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.