From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Richard M. Stallman" Newsgroups: gmane.emacs.devel Subject: Re: recentf: custom-file Date: Fri, 05 Aug 2005 07:59:30 -0400 Message-ID: References: <88B948B1-1E1B-412D-8BC8-B0DCA6B70BC8@gmail.com> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1123245924 30873 80.91.229.2 (5 Aug 2005 12:45:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 5 Aug 2005 12:45:24 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 05 14:45:22 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E11Xc-0002Na-0a for ged-emacs-devel@m.gmane.org; Fri, 05 Aug 2005 14:43:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E11aS-0004bi-7y for ged-emacs-devel@m.gmane.org; Fri, 05 Aug 2005 08:46:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E11Yx-0004Hc-4S for emacs-devel@gnu.org; Fri, 05 Aug 2005 08:44:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E11Yu-0004GI-WA for emacs-devel@gnu.org; Fri, 05 Aug 2005 08:44:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E11S5-00024F-G8 for emacs-devel@gnu.org; Fri, 05 Aug 2005 08:37:29 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1E115s-000155-T8 for emacs-devel@gnu.org; Fri, 05 Aug 2005 08:14:32 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1E10rK-0005yd-4z; Fri, 05 Aug 2005 07:59:30 -0400 Original-To: Kevin Rodgers In-reply-to: (message from Kevin Rodgers on Tue, 02 Aug 2005 12:05:39 -0600) 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:41533 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41533 Your patch would work. Here's another patch that I wrote in the same area, but I have not had a chance to test it, so I have not installed it. Could you test it for me? =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/cus-edit.el,v retrieving revision 1.228 diff -c -c -r1.228 cus-edit.el *** cus-edit.el 19 Jul 2005 11:21:30 -0000 1.228 --- cus-edit.el 4 Aug 2005 20:47:16 -0000 *************** *** 3835,3842 **** (setq magics (cdr magics))))) (widget-put widget :custom-state found))) (custom-magic-reset widget)) - ;;; The `custom-save-all' Function. ;;;###autoload (defcustom custom-file nil "File used for storing customization information. --- 3835,3843 ---- (setq magics (cdr magics))))) (widget-put widget :custom-state found))) (custom-magic-reset widget)) + + ;;; Reading and writing the custom file. ;;;###autoload (defcustom custom-file nil "File used for storing customization information. *************** *** 3897,3908 **** (setq user-init-file default-init-file)) user-init-file)))) (defun custom-save-delete (symbol) ! "Visit `custom-file' and delete all calls to SYMBOL from it. Leave point at the old location of the first such call, ! or (if there were none) at the end of the buffer." ! (let ((default-major-mode 'emacs-lisp-mode)) ! (set-buffer (find-file-noselect (custom-file)))) (goto-char (point-min)) ;; Skip all whitespace and comments. (while (forward-comment 1)) --- 3898,3925 ---- (setq user-init-file default-init-file)) user-init-file)))) + ;;;###autoload + (defun custom-save-all () + "Save all customizations in `custom-file'." + (let* ((filename (custom-file)) + (old-buffer (find-buffer-visiting filename))) + (with-current-buffer (or old-buffer (find-file-noselect filename)) + (let ((inhibit-read-only t)) + (custom-save-variables) + (custom-save-faces)) + (let ((file-precious-flag t)) + (save-buffer)) + (unless old-buffer + (kill-buffer (current-buffer)))))) + + ;; Editing the custom file contents in a buffer. + (defun custom-save-delete (symbol) ! "Delete all calls to SYMBOL from the contents of the custom file. Leave point at the old location of the first such call, ! or (if there were none) at the end of the buffer. ! ! This function does not save the buffer back in the custom file." (goto-char (point-min)) ;; Skip all whitespace and comments. (while (forward-comment 1)) *************** *** 4122,4140 **** (put symbol 'customized-face-comment nil))))) ;; We really should update all custom buffers here. (custom-save-all)) ! ! ;;;###autoload ! (defun custom-save-all () ! "Save all customizations in `custom-file'." ! (let ((inhibit-read-only t)) ! (custom-save-variables) ! (custom-save-faces) ! (save-excursion ! (let ((default-major-mode nil)) ! (set-buffer (find-file-noselect (custom-file)))) ! (let ((file-precious-flag t)) ! (save-buffer))))) ! ;;; The Customize Menu. ;;; Menu support --- 4139,4145 ---- (put symbol 'customized-face-comment nil))))) ;; We really should update all custom buffers here. (custom-save-all)) ! ;;; The Customize Menu. ;;; Menu support