* face customization saves custom-file twice
@ 2006-01-17 13:09 David PONCE
2006-01-17 18:53 ` Luc Teirlinck
0 siblings, 1 reply; 4+ messages in thread
From: David PONCE @ 2006-01-17 13:09 UTC (permalink / raw)
Cc: david
Hi,
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'!
I suspect that the problem is in one of the functions:
`custom-face-save-command' which calls `custom-face-save', both
calling `custom-save-all'.
I suppose it should be safe to remove the call to `custom-save-all'
from `custom-face-save-command'?
However I prefer to let a custom guru fix that ;-)
Sincerely,
David
In GNU Emacs 22.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.6.10)
of 2006-01-17 on localhost
X server distributor `The X.Org Foundation', version 11.0.60802000
configured using `configure '--with-gtk''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8
default-enable-multibyte-characters: t
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: face customization saves custom-file twice
2006-01-17 13:09 face customization saves custom-file twice David PONCE
@ 2006-01-17 18:53 ` Luc Teirlinck
2006-01-17 21:05 ` David Ponce
2006-01-19 17:44 ` Richard M. Stallman
0 siblings, 2 replies; 4+ messages in thread
From: Luc Teirlinck @ 2006-01-17 18:53 UTC (permalink / raw)
Cc: david, emacs-devel
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))
============================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: face customization saves custom-file twice
2006-01-17 18:53 ` Luc Teirlinck
@ 2006-01-17 21:05 ` David Ponce
2006-01-19 17:44 ` Richard M. Stallman
1 sibling, 0 replies; 4+ messages in thread
From: David Ponce @ 2006-01-17 21:05 UTC (permalink / raw)
Cc: emacs-devel
[...]
> 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.
[...]
Your patch looks good to me. Now custom works better, and don't save my
custom-file twice when I customize a face :-)
Thanks!
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: face customization saves custom-file twice
2006-01-17 18:53 ` Luc Teirlinck
2006-01-17 21:05 ` David Ponce
@ 2006-01-19 17:44 ` Richard M. Stallman
1 sibling, 0 replies; 4+ messages in thread
From: Richard M. Stallman @ 2006-01-19 17:44 UTC (permalink / raw)
Cc: david, david.ponce, emacs-devel
If nobody objects to this patch in a few days, please install it.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-01-19 17:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-17 13:09 face customization saves custom-file twice David PONCE
2006-01-17 18:53 ` Luc Teirlinck
2006-01-17 21:05 ` David Ponce
2006-01-19 17:44 ` Richard M. Stallman
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.