unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Harald Hanche-Olsen <hanche@math.ntnu.no>
To: help-gnu-emacs@gnu.org
Subject: Re: How do I get the definition of a function ?
Date: Sat, 20 Oct 2007 23:42:06 +0200	[thread overview]
Message-ID: <pcoy7dxfopd.fsf@shuttle.math.ntnu.no> (raw)
In-Reply-To: 1192913731.881996.244460@v29g2000prd.googlegroups.com

+ gnuist006@gmail.com:

> How do I get the definition, ie source code of a function in emacs
> lisp ?

The easiest way is to type C-h f and give the name of the function, or
C-h k followed by the keystrokes that invoke the function, if it is an
interactive command.

You get a window saying something like this:

C-c C-c runs the command message-send-and-exit
   which is an interactive compiled Lisp function in `message'.

where the word "message" (the filename where the function was defined)
is a clickable link.  Click on it.

> But if it shows some binary or opcode string.

It won't.  Oh, you mean if you evaluate a form like this one:
(symbol-function 'message-send-and-exit)
Since the function was byte-compiled, you do get an array including
some bytecode, and also a dotted pair like
("/local/share/emacs/23.0.0/lisp/gnus/message.elc" . 106082)
which clearly points at the source code file and the appropriate
position in it.

You had more questions that I don't know how to answer.  Maybe someone
else did.

I have set followups to gnu.emacs.help.  Don't know why you involved
the other two lisp groups.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

  reply	other threads:[~2007-10-20 21:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-20 20:55 How do I get the definition of a function ? gnuist006
2007-10-20 21:42 ` Harald Hanche-Olsen [this message]
2007-10-20 23:24 ` Bastien
2007-10-23 14:24 ` Jason

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=pcoy7dxfopd.fsf@shuttle.math.ntnu.no \
    --to=hanche@math.ntnu.no \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).