From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: face customization saves custom-file twice Date: Tue, 17 Jan 2006 12:53:44 -0600 (CST) Message-ID: <200601171853.k0HIrif06643@raven.dms.auburn.edu> References: <642089.1137503380035.JavaMail.www@wwinf1621> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1137532275 3375 80.91.229.2 (17 Jan 2006 21:11:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 17 Jan 2006 21:11:15 +0000 (UTC) Cc: david@dponce.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 17 22:11:14 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Eyy6Z-0001ru-UO for ged-emacs-devel@m.gmane.org; Tue, 17 Jan 2006 22:11:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eyy8u-00071t-06 for ged-emacs-devel@m.gmane.org; Tue, 17 Jan 2006 16:13:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EywMV-0000Ex-4W for emacs-devel@gnu.org; Tue, 17 Jan 2006 14:19:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Eyw5v-00016U-Q2 for emacs-devel@gnu.org; Tue, 17 Jan 2006 14:02:17 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eyw33-0008Ug-KD for emacs-devel@gnu.org; Tue, 17 Jan 2006 13:59:17 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Eyw6m-0004xX-L7 for emacs-devel@gnu.org; Tue, 17 Jan 2006 14:03:08 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.13.3+Sun/8.13.3) with ESMTP id k0HIugjB002191; Tue, 17 Jan 2006 12:56:42 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id k0HIrif06643; Tue, 17 Jan 2006 12:53:44 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: david.ponce@wanadoo.fr In-reply-to: <642089.1137503380035.JavaMail.www@wwinf1621> (message from David PONCE on Tue, 17 Jan 2006 14:09:40 +0100 (CET)) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.1 (manatee.dms.auburn.edu [131.204.53.104]); Tue, 17 Jan 2006 12:56:42 -0600 (CST) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:49215 Archived-At: 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)) ============================================================