From: Nix <nix-razor-pit@esperi.demon.co.uk>
Subject: Re: Emacs internals + lisp guru question
Date: 29 Sep 2002 16:33:19 +0100 [thread overview]
Message-ID: <87y99k24lc.fsf@amaterasu.srvr.nix> (raw)
In-Reply-To: b00bb831.0209282218.740cbfc@posting.google.com
[followups drastically trimmed]
On 28 Sep 2002, gnuist stipulated:
> There are some functions that take a list as argument.
> Text can be read from the buffer as a string.
> There are some functions that take a "symbol" as an argument.
> A string can be converted to a symbol.
Yes, with `intern' or `make-symbol' (which do *very* different things).
> However, when symbol is provided to the function by converting a string
> it is not working.
>
> For example:
>
> (describe-function quoted-SYMBOL) works
> (make-symbol "describe-function") works
The symbols these functions yield are *different*: e.g.
(eq 'describe-function (make-symbol "describe-function"))
==> nil
Think of a symbol as a key in a lookup table mapping symbols to triples
of (function, value, property). (Lisp calls these tables `obarrays').
The Lisp reader (the thing that takes 'describe-function and transforms
it to a symbol) looks up its symbols in the obarray named, with great
originality, `obarray'. This is the one where all the Lisp symbols are
defined. There are other obarrays: abbrev puts its abbrevs in an
obarray, and the BBDB uses another one to store its address
book.
Obviously you don't want these entries to collide with Lisp symbols; so
they use different obarrays (which are normally *themselves* stored as
Lisp variables).
`make-symbol' makes a symbol that is in *no obarray at all*; so
regardless of its name no symbol given to the Lisp reader will be equal
to it, have the same value as it, &c, &c.
If you want to look up a symbol with a name given as a string in the
Lisp obarray, you need to use `intern'; this'll create the symbol if
it doesn't exist. If you want to avoid creating the symbol, you can
use `intern-soft', which returns nil if the symbol is nonexistent.
See <http://www.gnu.org/manual/elisp-manual-21-2.8/html_chapter/elisp_8.html#SEC106>.
> How can we get the code of describe-function?
(symbol-function 'describe-function), but it's not very useful; the
function is probably byte-compiled, so you'll get code in the bytecode
interpreter's language, not in Lisp.
Alternatively, look in `help.el' (I think it's there in GNU Emacs too;
I'm looking at XEmacs here).
> What is the meaning of the gibberish from
> (insert (format "%s" (symbol-function 'describe-function) ))
I see no gibberish there. Which bit do you find gibberishy?
> What is out there to learn more about emacs/emacs_lisp and become more
> sophisticated?
The Emacs Lisp Intro is very good:
<http://www.gnu.org/manual/emacs-lisp-intro/emacs-lisp-intro.html>.
Once you've read that, read the Lisp Reference for your flavour of
(X)Emacs and read lots of the lisp sources that come with the editor and
you should be enlightened.
--
`Let's have a round of applause for those daring young men
and their flying spellcheckers.' --- Meg Worley
prev parent reply other threads:[~2002-09-29 15:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-29 6:18 Emacs internals + lisp guru question gnuist006
2002-09-29 6:47 ` D. Goel
2002-09-29 18:15 ` D. Goel
2002-09-29 7:48 ` Thien-Thi Nguyen
2002-09-29 7:50 ` Tim Josling
2002-09-29 15:33 ` Nix [this message]
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=87y99k24lc.fsf@amaterasu.srvr.nix \
--to=nix-razor-pit@esperi.demon.co.uk \
--cc=$}xinix{$@esperi.demon.co.uk \
/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).