From: gnuist006
Subject: Emacs internals + lisp guru question
Date: 
Message-ID: <b00bb831.0209282218.740cbfc@posting.google.com>
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.
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

but

(describe-function (make-symbol "describe-function")) is not working.

Is there a way to fix it?

How can we get the code of describe-function?

What is the meaning of the gibberish from
(insert (format "%s" (symbol-function 'describe-function) ))

What is out there to learn more about emacs/emacs_lisp and become more
sophisticated?

Many thanks to the gurus and novices for their very kind contributions.

From: Nix
Subject: Re: Emacs internals + lisp guru question
Date: 
Message-ID: <87y99k24lc.fsf@amaterasu.srvr.nix>
[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
From: Tim Josling
Subject: Re: Emacs internals + lisp guru question
Date: 
Message-ID: <3D96B0AF.E2E3416B@melbpc.org.au>
gnuist006 wrote:
> 
> 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.
> 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
> 
> but
> 
> (describe-function (make-symbol "describe-function")) is not working.
> 
> Is there a way to fix it?
> 
> How can we get the code of describe-function?
> 
> What is the meaning of the gibberish from
> (insert (format "%s" (symbol-function 'describe-function) ))
> 
> What is out there to learn more about emacs/emacs_lisp and become more
> sophisticated?
> 
> Many thanks to the gurus and novices for their very kind contributions.

There are manuals for emacs and for emacs lisp all over the net. You can
download them or read them online. Any linux CD would also have the source and
document.

If you do c-h a ,<then enter describe-function>, and then click on help in the
other buffer it will show you the source for describe-function and the rest of
the help module.

Tim Josling