unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* writing an own version of setq?
@ 2002-10-09 10:34 Klaus Berndl
  2002-10-09 13:09 ` Thomas Link
  2002-10-10 11:53 ` Dave Pearson
  0 siblings, 2 replies; 6+ messages in thread
From: Klaus Berndl @ 2002-10-09 10:34 UTC (permalink / raw)



I have written the code below to give me a save setq which only sets the new
value if the symbol is not already saved via customize:

,----
| (defmacro custom-saved-p (option)
|   "Return only not nil if OPTION is a defcustom-option and has a saved
| value. "
|   `(and (get ,option 'custom-type)
|         (get ,option 'saved-value)))
| 
| (defmacro setq-save (option value)
|   "Sets OPTION to VALUE if and only if OPTION is not already saved by
| customize."
|   `(and (not (custom-saved-p ,option))
|         (set ,option ,value)))
`----

OK, calls like (setq-save 'klaus (+ 1 2)) work fine but I'm not really
satisfied because i want to write (setq-save klaus (+ 1 2)). Note the missing
quote! How can i achieve this?

(I know, for a complete setq-save i have to add the semantic for many
symbol-value-pairs like in the *setq* but this should not be a big problem...)

many thanks in advance!
Klaus
   

-- 
Klaus Berndl			mailto: klaus.berndl@sdm.de
sd&m AG				http://www.sdm.de
software design & management	
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220

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

end of thread, other threads:[~2002-10-10 11:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-09 10:34 writing an own version of setq? Klaus Berndl
2002-10-09 13:09 ` Thomas Link
2002-10-09 13:48   ` Klaus Berndl
2002-10-09 14:20     ` Thomas Link
2002-10-09 14:44       ` Klaus Berndl
2002-10-10 11:53 ` Dave Pearson

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