all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
[parent not found: <mailman.4674.1115829901.2819.help-gnu-emacs@gnu.org>]
[parent not found: <mailman.4474.1115750087.2819.help-gnu-emacs@gnu.org>]
[parent not found: <mailman.3782.1115404280.2819.help-gnu-emacs@gnu.org>]
[parent not found: <mailman.3356.1115247555.2819.help-gnu-emacs@gnu.org>]
* defcustom: changing from defvar - order of execution
@ 2005-05-03 15:50 Drew Adams
  2005-05-03 16:13 ` Drew Adams
       [not found] ` <mailman.3227.1115174847.2819.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 21+ messages in thread
From: Drew Adams @ 2005-05-03 15:50 UTC (permalink / raw)


I'm unclear on the recommended way to change Lisp code from using defvar for
user options to using defcustom. I guess I'm also unclear on just how
defcustom and Customize work. I couldn't find an explanation of this in Info
for Emacs or Emacs Lisp.

Initial setup - library foo.el has this:

 (defvar foovar nil)
 (defun foo-fn () foovar)

Initial setup - user has this in .emacs:

 (defvar foovar t)
 (load-library "foo")
 (foo-fn)

When .emacs is loaded, (foo-fn) is executed, foovar is `t', so (foo-fn)
returns `t'.


Second setup - library foo.el has this:

 (defcustom foovar nil)
 (defun foo-fn () foovar)

Second setup - user has this in .emacs, after customizing foovar to `t' with
Customize:

 (load-library "foo")
 (foo-fn)
 ...
 (custom-set-variables '(foovar t)...)

When .emacs is loaded, (foo-fn) is executed, foovar is (has default value)
`nil', so (foo-fn) returns `nil'.

That is, because (custom-set-variables...) is executed after (foo-fn), it
has no effect during foo-fn's execution.

What am I missing/confusing here? What is the proper way for library foo.el
to move from using defvar to using defcustom? Also, what difference does it
make, if any, whether a defcustom is executed at the top level or a lower
level of a file.

Thanks. - Drew

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

end of thread, other threads:[~2005-05-19 17:55 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.3763.1115399076.2819.help-gnu-emacs@gnu.org>
2005-05-06 17:38 ` defcustom: changing from defvar - order of execution Stefan Monnier
2005-05-06 18:19   ` Drew Adams
2005-05-10 16:14 ` Per Abrahamsen
2005-05-10 18:32   ` Drew Adams
2005-05-11 15:08     ` customization; std vs. personal libraries ken
     [not found]     ` <mailman.4670.1115825568.2819.help-gnu-emacs@gnu.org>
2005-05-11 23:12       ` Thien-Thi Nguyen
2005-05-19 15:22       ` Per Abrahamsen
2005-05-19 17:55         ` Kevin Rodgers
     [not found] <mailman.4674.1115829901.2819.help-gnu-emacs@gnu.org>
2005-05-11 18:32 ` defcustom: changing from defvar - order of execution Stefan Monnier
     [not found] <mailman.4474.1115750087.2819.help-gnu-emacs@gnu.org>
2005-05-11 14:07 ` Stefan Monnier
2005-05-11 16:36   ` Drew Adams
2005-05-11 16:37   ` Drew Adams
     [not found] <mailman.3782.1115404280.2819.help-gnu-emacs@gnu.org>
2005-05-07 15:56 ` Stefan Monnier
     [not found] <mailman.3356.1115247555.2819.help-gnu-emacs@gnu.org>
2005-05-06  3:20 ` Stefan Monnier
2005-05-06 17:00   ` Drew Adams
2005-05-03 15:50 Drew Adams
2005-05-03 16:13 ` Drew Adams
     [not found] ` <mailman.3227.1115174847.2819.help-gnu-emacs@gnu.org>
2005-05-04 15:03   ` Stefan Monnier
2005-05-04 22:49     ` Drew Adams
2005-05-04 15:51   ` rgb
2005-05-04 22:49     ` Drew Adams

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.