emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Customize Rogue


From: Luc Teirlinck
Subject: Re: Customize Rogue
Date: Fri, 7 Mar 2003 16:51:54 -0600 (CST)

Per Abrahamsen wrote:
   
   customize-set-variable will tell customize the variable has been set
   interactively, and call any speciel ":set" functions.

   The first property means it should never be called from ".emacs", but
   the second could be generally useful.  

   Maybe we should have a function that does the second (obey :set)
   without doing the first.  I'm not a Common Lisp programmer, but I
   suspect it would be natural to use setf for that purpose.  This way we
   could do things like

     (setf menu-bar-mode nil)

   and it would just work.

I do not believe that you can use setf for this.  `cl-macs' already
defines a function `setf' that emulates the Common Lisp function of
the same name.  In my opinion this function is very different from the
one you are describing.  In any case where setq is defined, setf is
synonymous with setq, that is, setf is a pure generalization of setq.
In fact, many CL programmers always use setf, even when setq would
work too.  I believe that just about any CL programmer would expect
(setf menu-bar-mode nil) to be synonymous with
(setq menu-bar-mode nil).

Do:
M-x load-library cl
C-h f setf.

Result:

setf is a Lisp macro in `cl-macs'.
(setf PLACE VAL PLACE VAL ...)

Set each PLACE to the value of its VAL.
This is a generalized version of `setq'; the PLACEs may be symbolic
references such as (car x) or (aref x i), as well as plain symbols.
For example, (setf (cadar x) y) is equivalent to (setcar (cdar x) y).
The return value is the last VAL in the list.

Sincerely,

Luc.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]