all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* elisp from CL transition guide
@ 2007-08-16  9:14 Tamas Papp
  2007-08-16  9:47 ` Tassilo Horn
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Tamas Papp @ 2007-08-16  9:14 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I have some Common Lisp programming experience, and would like to use
Emacs Lisp for simple tasks.  I found introductions to Elisp, but what
I am looking for is some guide that would tell me the differences from
CL, to get started quicker.  I already found that there is no
defparameter or format etc.  Is there some page where these
differences are listed?

Thanks,

Tamas

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

* Re: elisp from CL transition guide
  2007-08-16  9:14 elisp from CL transition guide Tamas Papp
@ 2007-08-16  9:47 ` Tassilo Horn
  2007-08-16 10:05 ` Petter Gustad
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Tassilo Horn @ 2007-08-16  9:47 UTC (permalink / raw)
  To: help-gnu-emacs

Tamas Papp <tkpapp@gmail.com> writes:

Hi Tamas,

> I have some Common Lisp programming experience, and would like to use
> Emacs Lisp for simple tasks.  I found introductions to Elisp, but what
> I am looking for is some guide that would tell me the differences from
> CL, to get started quicker.  I already found that there is no
> defparameter or format etc.

There's `format' but it's quite different.

> Is there some page where these differences are listed?

The biggest difference is dynamical versus lexical scoping.

And check out the `cl' library.  It defines many functions and macros CL
hackers might be missing, for example the allmighty `loop' or `setf'.

Bye,
Tassilo
-- 
In the first  Jurassic Park movie, the Tyrannosaurus  Rex wasn't chasing
the jeep. Chuck Norris was chasing the Tyrannosaurus AND the jeep.

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

* Re: elisp from CL transition guide
  2007-08-16  9:14 elisp from CL transition guide Tamas Papp
  2007-08-16  9:47 ` Tassilo Horn
@ 2007-08-16 10:05 ` Petter Gustad
  2007-08-16 10:58 ` Daniel Jensen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Petter Gustad @ 2007-08-16 10:05 UTC (permalink / raw)
  To: help-gnu-emacs

Tamas Papp <tkpapp@gmail.com> writes:

> I have some Common Lisp programming experience, and would like to use
> Emacs Lisp for simple tasks.  I found introductions to Elisp, but what
> I am looking for is some guide that would tell me the differences from
> CL, to get started quicker.  I already found that there is no
> defparameter or format etc.  Is there some page where these
> differences are listed?

I don't know where such a list of differences can be found, but 

(require 'cl)

will make the list somewhat smaller. format is there but very limited
and C-centric (it should probably have been called printf): 

(format "%x" 44252)
"acdc"


Petter
-- 
________________________________________________________________________
Petter Gustad         8'h2B | ~8'h2B        http://www.gustad.com/petter

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

* Re: elisp from CL transition guide
  2007-08-16  9:14 elisp from CL transition guide Tamas Papp
  2007-08-16  9:47 ` Tassilo Horn
  2007-08-16 10:05 ` Petter Gustad
@ 2007-08-16 10:58 ` Daniel Jensen
  2007-08-16 12:18   ` Tamas Papp
  2007-08-16 15:24 ` Pascal Bourguignon
  2007-08-18  6:21 ` Tim Cross
  4 siblings, 1 reply; 11+ messages in thread
From: Daniel Jensen @ 2007-08-16 10:58 UTC (permalink / raw)
  To: help-gnu-emacs

Tamas Papp <tkpapp@gmail.com> writes:

> I have some Common Lisp programming experience, and would like to use
> Emacs Lisp for simple tasks.  I found introductions to Elisp, but what
> I am looking for is some guide that would tell me the differences from
> CL, to get started quicker.

I don't think that many of the differences between Emacs Lisp and Common
Lisp will come up while you're getting started. My advice is to take on
those simple tasks right now and learn by doing. The Emacs Lisp
Introduction is an excellent tutorial. It will teach you how to think
about writing Emacs commands. I think that's what you should focus on.
There is also plenty of source code to read and learn from.

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

* Re: elisp from CL transition guide
  2007-08-16 10:58 ` Daniel Jensen
@ 2007-08-16 12:18   ` Tamas Papp
  2007-08-16 12:43     ` Daniel Jensen
                       ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Tamas Papp @ 2007-08-16 12:18 UTC (permalink / raw)
  To: help-gnu-emacs

daniel@bigwalter.net (Daniel Jensen) writes:

> Tamas Papp <tkpapp@gmail.com> writes:
>
>> I have some Common Lisp programming experience, and would like to use
>> Emacs Lisp for simple tasks.  I found introductions to Elisp, but what
>> I am looking for is some guide that would tell me the differences from
>> CL, to get started quicker.
>
> I don't think that many of the differences between Emacs Lisp and Common
> Lisp will come up while you're getting started. My advice is to take on
> those simple tasks right now and learn by doing. The Emacs Lisp
> Introduction is an excellent tutorial. It will teach you how to think
> about writing Emacs commands. I think that's what you should focus on.
> There is also plenty of source code to read and learn from.

One thing I don't understand yet is namespaces in Elisp: if I set fill-column in
a buffer (setq fill-column 80), that doesn't seem to affect fill-column in other
buffers.  But if I set some other variable eg (setq foo 12), foo will evaluate
to 12 in other buffers.  What would be a correct mental model for this?

Thanks

Tamas

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

* Re: elisp from CL transition guide
  2007-08-16 12:18   ` Tamas Papp
@ 2007-08-16 12:43     ` Daniel Jensen
  2007-08-16 12:58     ` Tassilo Horn
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Daniel Jensen @ 2007-08-16 12:43 UTC (permalink / raw)
  To: help-gnu-emacs

Tamas Papp <tkpapp@gmail.com> writes:

> One thing I don't understand yet is namespaces in Elisp: if I set fill-column in
> a buffer (setq fill-column 80), that doesn't seem to affect fill-column in other
> buffers.  But if I set some other variable eg (setq foo 12), foo will evaluate
> to 12 in other buffers.  What would be a correct mental model for this?

Think of it as a special kind of scoping; buffer-local scoping. To read
more, see the Elisp manual in (info "(elisp) Buffer-Local Variables").

You can see whether a variable is buffer-local when you describe it with
C-h v (describe-variable).

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

* Re: elisp from CL transition guide
  2007-08-16 12:18   ` Tamas Papp
  2007-08-16 12:43     ` Daniel Jensen
@ 2007-08-16 12:58     ` Tassilo Horn
  2007-08-16 13:30     ` How to indent sql lu
  2007-08-18  6:39     ` elisp from CL transition guide Tim Cross
  3 siblings, 0 replies; 11+ messages in thread
From: Tassilo Horn @ 2007-08-16 12:58 UTC (permalink / raw)
  To: help-gnu-emacs

Tamas Papp <tkpapp@gmail.com> writes:

Hi Tamas,

> One thing I don't understand yet is namespaces in Elisp: if I set
> fill-column in a buffer (setq fill-column 80), that doesn't seem to
> affect fill-column in other buffers.

Yes, `fill-column' is always buffer-local when set.

,----[ C-h v fill-column RET ]
| fill-column is a variable defined in `C source code'.
| Its value is 72
| Local in buffer *followup to Tamas Papp on gnu.emacs.help*; global value is 79
| Automatically becomes buffer-local when set in any fashion.
| 
| 
| This variable is safe as a file local variable if its value satisfies
| the predicate `integerp'.
| 
| Documentation:
| *Column beyond which automatic line-wrapping should happen.
| Interactively, you can set the buffer local value using C-x f.
`----

To set its default value for all buffers use `setq-default'.

> But if I set some other variable eg (setq foo 12), foo will evaluate
> to 12 in other buffers.

If you do

  (set (make-local-variable 'foo) 12)

I'll be twelve only in that buffer.

> What would be a correct mental model for this?

Some variables like `fill-column' always are buffer-local, but every
variable can be buffer-local.

See

,----[ (info "(elisp)Buffer-Local Variables") ]
| Global and local variable bindings are found in most programming
| languages in one form or another.  Emacs, however, also supports
| additional, unusual kinds of variable binding: "buffer-local"
| bindings, which apply only in one buffer, and "frame-local" bindings,
| which apply only in one frame.  Having different values for a variable
| in different buffers and/or frames is an important customization
| method.
`----

Bye,
Tassilo
-- 
If programmers deserve to  be rewarded for creating innovative programs,
by the same  token they deserve to be punished if  they restrict the use
of these programs. (Richard M. Stallman)

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

* How to indent sql
  2007-08-16 12:18   ` Tamas Papp
  2007-08-16 12:43     ` Daniel Jensen
  2007-08-16 12:58     ` Tassilo Horn
@ 2007-08-16 13:30     ` lu
  2007-08-18  6:39     ` elisp from CL transition guide Tim Cross
  3 siblings, 0 replies; 11+ messages in thread
From: lu @ 2007-08-16 13:30 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

   Which is the best way to indent sql?

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

* Re: elisp from CL transition guide
  2007-08-16  9:14 elisp from CL transition guide Tamas Papp
                   ` (2 preceding siblings ...)
  2007-08-16 10:58 ` Daniel Jensen
@ 2007-08-16 15:24 ` Pascal Bourguignon
  2007-08-18  6:21 ` Tim Cross
  4 siblings, 0 replies; 11+ messages in thread
From: Pascal Bourguignon @ 2007-08-16 15:24 UTC (permalink / raw)
  To: help-gnu-emacs

Tamas Papp <tkpapp@gmail.com> writes:
> I have some Common Lisp programming experience, and would like to use
> Emacs Lisp for simple tasks.  I found introductions to Elisp, but what
> I am looking for is some guide that would tell me the differences from
> CL, to get started quicker.  I already found that there is no
> defparameter or format etc.  Is there some page where these
> differences are listed?

The main gotcha is that in emacs lisp there is only dynamic binding,
no lexical binding (and therefore no closure).

What you could do is to still use Common Lisp to program emacs lisp
stuff, with emacs-cl, which is a CL implementation.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.

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

* Re: elisp from CL transition guide
  2007-08-16  9:14 elisp from CL transition guide Tamas Papp
                   ` (3 preceding siblings ...)
  2007-08-16 15:24 ` Pascal Bourguignon
@ 2007-08-18  6:21 ` Tim Cross
  4 siblings, 0 replies; 11+ messages in thread
From: Tim Cross @ 2007-08-18  6:21 UTC (permalink / raw)
  To: help-gnu-emacs

Tamas Papp <tkpapp@gmail.com> writes:

> Hi,
>
> I have some Common Lisp programming experience, and would like to use
> Emacs Lisp for simple tasks.  I found introductions to Elisp, but what
> I am looking for is some guide that would tell me the differences from
> CL, to get started quicker.  I already found that there is no
> defparameter or format etc.  Is there some page where these
> differences are listed?
>

Not exactly answering your question, but you could just put 

(require 'cl)

and you will then have access to many of the CL constructs you are use to
from within elisp.

Tim


-- 
Tim Cross
tcross@rapttech.com.au

There are two types of people in IT - those who do not manage what they 
understand and those who do not understand what they manage.

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

* Re: elisp from CL transition guide
  2007-08-16 12:18   ` Tamas Papp
                       ` (2 preceding siblings ...)
  2007-08-16 13:30     ` How to indent sql lu
@ 2007-08-18  6:39     ` Tim Cross
  3 siblings, 0 replies; 11+ messages in thread
From: Tim Cross @ 2007-08-18  6:39 UTC (permalink / raw)
  To: help-gnu-emacs

Tamas Papp <tkpapp@gmail.com> writes:

> daniel@bigwalter.net (Daniel Jensen) writes:
>
>> Tamas Papp <tkpapp@gmail.com> writes:
>>
>>> I have some Common Lisp programming experience, and would like to use
>>> Emacs Lisp for simple tasks.  I found introductions to Elisp, but what
>>> I am looking for is some guide that would tell me the differences from
>>> CL, to get started quicker.
>>
>> I don't think that many of the differences between Emacs Lisp and Common
>> Lisp will come up while you're getting started. My advice is to take on
>> those simple tasks right now and learn by doing. The Emacs Lisp
>> Introduction is an excellent tutorial. It will teach you how to think
>> about writing Emacs commands. I think that's what you should focus on.
>> There is also plenty of source code to read and learn from.
>
> One thing I don't understand yet is namespaces in Elisp: if I set fill-column in
> a buffer (setq fill-column 80), that doesn't seem to affect fill-column in other
> buffers.  But if I set some other variable eg (setq foo 12), foo will evaluate
> to 12 in other buffers.  What would be a correct mental model for this?
>
Probably Schizophrenia !

Actually, emacs has the concept of 'buffer local variables', where the
variable binding is local to a buffer.  usually, if a buffer local variable
is not set directly in a buffer, it will default to the same value as the
global variable. However, once it is set, it becomes local to that
buffer. When you set it, it doesn't set the global value. 

Emacs doesn't have package namespaces like CL, which is why most variables
are prefixed with the name of the package they belong to. 

have a look at the documentation for make-local-variable

Tim


-- 
Tim Cross
tcross@rapttech.com.au

There are two types of people in IT - those who do not manage what they 
understand and those who do not understand what they manage.

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

end of thread, other threads:[~2007-08-18  6:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-16  9:14 elisp from CL transition guide Tamas Papp
2007-08-16  9:47 ` Tassilo Horn
2007-08-16 10:05 ` Petter Gustad
2007-08-16 10:58 ` Daniel Jensen
2007-08-16 12:18   ` Tamas Papp
2007-08-16 12:43     ` Daniel Jensen
2007-08-16 12:58     ` Tassilo Horn
2007-08-16 13:30     ` How to indent sql lu
2007-08-18  6:39     ` elisp from CL transition guide Tim Cross
2007-08-16 15:24 ` Pascal Bourguignon
2007-08-18  6:21 ` Tim Cross

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.