[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: face customization saves custom-file twice
From: |
Luc Teirlinck |
Subject: |
Re: face customization saves custom-file twice |
Date: |
Tue, 17 Jan 2006 12:53:44 -0600 (CST) |
David Ponce wrote:
After I customized a face via M-x customize-face and clicked on the
"State" button, "Save for Future Sessions" menu item, I noticed that
my `custom-file' has been saved twice. And because of that I lost the
backup copy of `custom-file'!
This buggy behavior has been in Custom since 1997, when a bug in
custom-face-save got fixed independently by two people in different ways.
I suppose it should be safe to remove the call to `custom-save-all'
from `custom-face-save-command'?
Yes, except that it would make custom-face-save-command and
custom-face-save aliases of each other in a bad way. Also the
current docstring of custom-face-save is wrong.
The patch below makes custom-face-save-command an alias of
custom-face-save in the standard way and corrects the custom-face-save
docstring. I believe that it is better to have custom-face-save the
actual function and custom-save-face-command the alias, since the name
custom-face-save is more in line with the names of all other similar
functions.
I can install if desired.
===File ~/cus-edit-diff=====================================
*** cus-edit.el 16 Jan 2006 22:27:03 -0600 1.278
--- cus-edit.el 17 Jan 2006 12:40:43 -0600
***************
*** 3323,3329 ****
(defvar custom-face-menu
`(("Set for Current Session" custom-face-set)
,@(when (or custom-file user-init-file)
! '(("Save for Future Sessions" custom-face-save-command)))
("Undo Edits" custom-redraw
(lambda (widget)
(memq (widget-get widget :custom-state) '(modified changed))))
--- 3323,3329 ----
(defvar custom-face-menu
`(("Set for Current Session" custom-face-set)
,@(when (or custom-file user-init-file)
! '(("Save for Future Sessions" custom-face-save)))
("Undo Edits" custom-redraw
(lambda (widget)
(memq (widget-get widget :custom-state) '(modified changed))))
***************
*** 3448,3460 ****
(custom-face-state-set widget)
(custom-redraw-magic widget)))
- (defun custom-face-save-command (widget)
- "Save in `.emacs' the face attributes in WIDGET."
- (custom-face-save widget)
- (custom-save-all))
-
(defun custom-face-save (widget)
! "Prepare for saving WIDGET's face attributes, but don't write `.emacs'."
(let* ((symbol (widget-value widget))
(child (car (widget-get widget :children)))
(value (custom-post-filter-face-spec (widget-value child)))
--- 3448,3455 ----
(custom-face-state-set widget)
(custom-redraw-magic widget)))
(defun custom-face-save (widget)
! "Save in `.emacs' the face attributes in WIDGET."
(let* ((symbol (widget-value widget))
(child (car (widget-get widget :children)))
(value (custom-post-filter-face-spec (widget-value child)))
***************
*** 3480,3485 ****
--- 3475,3483 ----
(custom-face-state-set widget)
(custom-redraw-magic widget)))
+ ;; For backward compatibility.
+ (defalias 'custom-face-save-command 'custom-face-save)
+
(defun custom-face-reset-saved (widget)
"Restore WIDGET to the face's default attributes."
(let* ((symbol (widget-value widget))
============================================================