Subject: bug#12949: 24.3.50; request: use Customize to set local value (in addition to global/default)

From: "Drew Adams" <[email-masked]>
Date: Tue, 20 Nov 2012 16:09:19 -0800

Customize provides not only persistence but also (a) type-checking and
(b) a fairly easy (if less than ideal) user interface for non-Lispers.
 
It is about *setting* option values, in addition to - even independently
from - *saving* them persistently.  A user can want to set a value
temporarily for different reasons.
 
If an option is buffer-local (yes, nothing wrong with that), then
Customize sets or saves the *default* value.  That's normal.
 
But it can also be useful in some cases to use the Customize UI not to
save the default value but to set the local value for various buffers.
Why?  Simply because in some cases setting the value can be easier or
clearer using Customize than using Lisp.
 
This enhancement request is to add an item to the Customize State menu to
set the buffer-local value, for the buffer where `customize-option' (or
whatever) was invoked, to the value as edited in Customize.
 
That lets a user invoke Customize from different buffers and set their
buffer-local values using the GUI.
 
But that requires a user to repeat `M-x customize-option' in each such
buffer.
 
An alternative possibility would be to add a dropdown menu/list to let
the user choose an existing buffer (or even multiple such), to set its
local value to the edited value.
 
This could be combined with the State menu: add a `Set Local for XYZ'
menu item for each existing buffer (XYZ, in this example).  If there are
more than some small number of existing buffers then these menu items
could be placed in a submenu: Set Local Value > XZY etc.
 
When the option is buffer-local, the current menu item `Set for Current
Session' would be changed to something like `Set Default Value'.
 
Here is one example where this might be helpful:
 
Library highlight-chars.el lets you highlight any set of characters.
You can specify the characters in the set using any of these methods,
any number of times:
 
* Specify a string of chars, to include the chars in the string.
 
* Specify the start and end chars, to include the chars in the range.
 
* Specify a character class, to include the chars in the class.
 
* Specify a charset, to include its chars.
 
Now suppose you want to highlight Lao chars in Gnus buffers and
[:xdigit] in .css buffers.  In that case, you want to make the option
buffer-local.  And it would be handy to be able to use the GUI of
Customize to set the option in each buffer.
 
In this case, you could use (setq hc-other-chars '(lao)) for one and
(setq hc-other-chars '([:xdigit:])) for the other.  But to do that
you would need to know the required Lisp.
 
More complex values (and more complex options) would require more
complex Lisp sexps.
 
The point is that the Customize GUI can be leveraged for non-Lisp users
to set option values, including local values, regardless of whether
saving the values makes any sense (it does not, for a local value).

In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600)
 of 2012-11-05 on MS-W7-DANI
Bzr revision: 110809 [email-masked]
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -I../../libs/libXpm-3.5.10/include -I../../libs/libXpm-3.5.10/src
 -I../../libs/libpng-1.2.37-lib/include -I../../libs/zlib-1.2.5
 -I../../libs/giflib-4.1.4-1-lib/include
 -I../../libs/jpeg-6b-4-lib/include
 -I../../libs/tiff-3.8.2-1-lib/include
 -I../../libs/libxml2-2.7.8-w32-bin/include/libxml2
 -I../../libs/gnutls-3.0.9-w32-bin/include
 -I../../libs/libiconv-1.9.2-1-lib/include'