Jan Vroonhof <vroonhof(a)math.ethz.ch> writes:
sperber(a)informatik.uni-tuebingen.de (Michael Sperber [Mr.
Preprocessor]) writes:
> What's a politically correct (and preferably simple) to determine the
> set/region of forms in ~/.emacs under the control of customize? Can I
> search for (custom-load-themes ...) or (custom-set-variables ...) and
> take the region from there to the end of the file? Or can I take all
> forms starting with (custom-... ...). Or what?
(defun migrate-custom (oldfile newfile)
(require 'cus-edit)
(let ((custom-file oldfile))
(mapc 'custom-save-delete
'(custom-load-themes custom-reset-variables
custom-set-variables
custom-set-faces
custom-reset-faces)))
(setq custom-file newfile)
(custom-save-all))
I'm impressed.
Ironically, it doesn't pick one thing, and that one is not really
Custom-related:
(put 'narrow-to-page 'disabled nil)
I have no idea how that leaked into my `.xemacs-custom', but I'm sure
I didn't put it there. Oh, now I see:
(defun enable-command (command)
"Allow COMMAND to be executed without special confirmation from now on.
The user's `custom-file' is altered so that this will apply
to future sessions."
...
(defun disable-command (command)
"Require special confirmation to execute COMMAND from now on.
The user's `custom-file' is altered so that this will apply
to future sessions."
...
And, if you look real hard:
1997-09-18 Colin Rafferty <craffert(a)ml.com>
* prim/novice.el (disable-command): Made it modify
`custom-file' instead of `user-init-file'.
Stop multiple disable/enable-command calls from adding extra
newlines.
Not that I blame Colin -- the patch must have made sense at the time.