[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does `describe-function' know where the source code of the funct

From: Eduardo Ochs
Subject: Re: How does `describe-function' know where the source code of the function is?
Date: Mon, 17 Jan 2022 01:27:10 -0300

On Mon, 17 Jan 2022 at 01:04, Marcin Borkowski <> 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"
  # (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:

Cheers & happy hacking, =)
  Eduardo Ochs

reply via email to

[Prev in Thread] Current Thread [Next in Thread]