unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs internals + lisp guru question
@ 2002-09-29  6:18 gnuist006
  2002-09-29  6:47 ` D. Goel
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: gnuist006 @ 2002-09-29  6:18 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs internals + lisp guru question
  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
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: D. Goel @ 2002-09-29  6:47 UTC (permalink / raw)


It is pleasing to see someone post under the name gnuist :=) Please do
note, however, that posting to multiple newsgroups is not considered
polite.  Also, a more descriptive subject will get more people to
actually open your mail and you will get more reply.  (Also, i am
copying you on this one, but read follow-ups in the same newsgroup in
general).

> 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

Do a C-h f make-symbol, to see that:

make-symbol is a built-in function.
(make-symbol NAME)

Return a newly allocated uninterned symbol whose name is NAME.
Its value and function definition are void, and its property list is nil.


viz. To repeat: Its value and function definitions are void.

Perhaps what you are looking for is "intern".

(describe-function (intern "describe-function")). 

Again, see manual. and use C-h f, and use M-x find-function. 


> 
> How can we get the code of describe-function?

M-x find-function. 

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

See manual and use C-h f. 

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

Emacs, by itself, has the most extensive self-documentation than
probably any other software.  Make sure you do have the elisp
manual, intro to emacs-lisp programming, emacs FAQ installed.

(On debian gnulinux, this means:  
apt-get install emacs-lisp-intro elisp-manual, 
in addition to the regular apt-get install emacs21). 

Now, here's one possible order in which to go through all the
documentation.  (mix and match as you please :=) -->

C-h t (tutorial) 
C-h i and read tutorial on Info. 
C-h i and go to the Emacs FAQ node. 
C-h i and EMACS FAQ
C-h i and EMACS manual
C-h i and Elisp intro (an awesome tutorial written by Robert Chassell)
C-h i and Emacs lisp manual 
browse the english and lisp in source-files.  
	(use M-x find-function, M-x finder-commentary etc. etc.)
Browse the Emacs's core C files for more internals! :-)


DG                                 http://24.197.159.102/~deego/
--

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs internals + lisp guru question
  2002-09-29  6:18 Emacs internals + lisp guru question gnuist006
  2002-09-29  6:47 ` D. Goel
@ 2002-09-29  7:48 ` Thien-Thi Nguyen
  2002-09-29  7:50 ` Tim Josling
  2002-09-29 15:33 ` Nix
  3 siblings, 0 replies; 6+ messages in thread
From: Thien-Thi Nguyen @ 2002-09-29  7:48 UTC (permalink / raw)


gnuist006@hotmail.com (gnuist006) writes:

> 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.

this is like poetry!

> However, when symbol is provided to the function by converting a string
>  it is not working.

move point after the close-paren for each of these forms and do C-x C-e:

(describe-function 'make-symbol)
(describe-function 'intern)
(describe-function (intern "describe-function"))

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

the only gibberish i see is the white space here...........^
(which might be significant according to some demented read-table
mungers).  which gibberish are you referring to, specifically?

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

grep the net for "elisp manual".  if that's too heavy, try ttn's elisp
tutorial (still incomplete but maybe you can help):

  http://www.glug.org/people/ttn/software/elisp-tutorial/

but be careful of trying to be too sophisticated:

  http://www.glug.org/people/random/flame.txt

[newsgroups trimmed.]

thi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs internals + lisp guru question
  2002-09-29  6:18 Emacs internals + lisp guru question gnuist006
  2002-09-29  6:47 ` D. Goel
  2002-09-29  7:48 ` Thien-Thi Nguyen
@ 2002-09-29  7:50 ` Tim Josling
  2002-09-29 15:33 ` Nix
  3 siblings, 0 replies; 6+ messages in thread
From: Tim Josling @ 2002-09-29  7:50 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs internals + lisp guru question
  2002-09-29  6:18 Emacs internals + lisp guru question gnuist006
                   ` (2 preceding siblings ...)
  2002-09-29  7:50 ` Tim Josling
@ 2002-09-29 15:33 ` Nix
  3 siblings, 0 replies; 6+ messages in thread
From: Nix @ 2002-09-29 15:33 UTC (permalink / raw)


[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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs internals + lisp guru question
  2002-09-29  6:47 ` D. Goel
@ 2002-09-29 18:15   ` D. Goel
  0 siblings, 0 replies; 6+ messages in thread
From: D. Goel @ 2002-09-29 18:15 UTC (permalink / raw)


To add some more items..


> 
> C-h t (tutorial) 
> C-h i and read tutorial on Info. 
> C-h i and go to the Emacs FAQ node. 
> C-h i and EMACS manual
> C-h i and Elisp intro (an awesome tutorial written by Robert Chassell)
> C-h i and Emacs lisp manual 
> browse the english and lisp in source-files.  
> 	(use M-x find-function, M-x finder-commentary etc. etc.)
> Browse the Emacs's core C files for more internals! :-)


Other Info files for Elisp programs, like tramp, eshell, gnus, 

Sites like emacswiki.org (and its new info-dump :-), emacs-lisp list,
	emacs webring and my.gnus.org,

Newsgroups like g.e.help, c.emacs, g.e.sources

#emacs on irc.openprojects.net 

Search google-groups, and google



DG                                 http://24.197.159.102/~deego/
--

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-09-29 18:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).