emacs-devel
[Top][All Lists]
Advanced

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

Re: customize-style


From: Luc Teirlinck
Subject: Re: customize-style
Date: Tue, 18 Mar 2003 18:05:44 -0600 (CST)

Per Abrahamsen wrote:

   Richard Stallman <address@hidden> writes:

   > Perhaps we could add a general feature whereby a custom theme
   > can be put into effect buffer-locally.  

   I haven't tried it, but binding custom-local-buffer might do just
   that.

What binding `custom-local-buffer' does is completely up to what the
author of the :set function wants it to do.  That is, assuming that the
author of the :set function knows about it, it is not documented in the
documentation string of defcustom, nor in the Elisp manual.  The
documentation string of `custom-local-buffer' is ambiguous about what
is actually expected and the documentation strings of its two users in
custom.el, which an author of a :set function is likely to use as
guidance, are also ambiguous and seem to contradict the actual
behavior.  I personally have no idea which behavior is intended: the
actual one or the one I would infer from the documentation.

Concrete problems:

Do:

(setq custom-local-buffer "buf")
C-h v custom-local-buffer

Result:

custom-local-buffer's value is "buf"

Non-nil, in a Customization buffer, means customize a specific buffer.
If this variable is non-nil, it should be a buffer, and it means
customize the local bindings of that buffer.  This variable is a
permanent local, and it normally has a local binding in every
Customization buffer.

My remarks:

Note, that the global value got set, unlike what is claimed in the
documentation string.  The line:
(put 'custom-local-buffer 'permanent-local t)
in custom.el is not sufficient to actually make `custom-local-buffer'
buffer-local.

Second problem:

"and it means customize the local bindings of that buffer."

Does this mean: *if* the variable *already* has a buffer-local binding
or no matter what?  I believe that this should be clearly specified.
The quoted sentence suggests (to me) the latter, the actual behavior
is the former, for the two important :set functions described below:

C-h f custom-set-default

Result:

custom-set-default is a compiled Lisp function in `custom'.
(custom-set-default VARIABLE VALUE)

Default :set function for a customizable variable.
Normally, this sets the default value of VARIABLE to VALUE,
but if `custom-local-buffer' is non-nil,
this sets the local binding in that buffer instead.
 
My remarks:

"this sets the local binding in that buffer instead."

Actual behavior: sets the local binding *if* it already has one.
Again, I believe this should be clarified.  The way I would read it:
unconditionally sets the local binding.

C-h f custom-set-minor-mode

Result:

custom-set-minor-mode is a compiled Lisp function in `custom'.
(custom-set-minor-mode VARIABLE VALUE)

:set function for minor mode variables.
Normally, this sets the default value of VARIABLE to nil if VALUE
is nil and to t otherwise,
but if `custom-local-buffer' is non-nil,
this sets the local binding in that buffer instead.

My remarks:

Actual behavior: sets the local "binding" (kind of, we are calling a
function not just setting a variable, but that is OK, at least to me)
for "local" minor modes, the default value for "global" minor modes.
As it is actually possible, and sometimes useful, to give some
"global" minor modes buffer local values, I believe that it should be
clarified that setting `custom-local-buffer' and using Custom is not
going to do that for you.

Sincerely,

Luc.




reply via email to

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