From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.devel Subject: Re: recentf: custom-file Date: Tue, 02 Aug 2005 12:05:39 -0600 Message-ID: References: <88B948B1-1E1B-412D-8BC8-B0DCA6B70BC8@gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1123006508 19676 80.91.229.2 (2 Aug 2005 18:15:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 2 Aug 2005 18:15:08 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 02 20:15:08 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E01Gl-00022z-Ow for ged-emacs-devel@m.gmane.org; Tue, 02 Aug 2005 20:13:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E01JT-0007EZ-LN for ged-emacs-devel@m.gmane.org; Tue, 02 Aug 2005 14:16:27 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E01He-0004iT-0g for emacs-devel@gnu.org; Tue, 02 Aug 2005 14:14:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E01HZ-0004fL-0H for emacs-devel@gnu.org; Tue, 02 Aug 2005 14:14:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E01HX-0004YJ-1B for emacs-devel@gnu.org; Tue, 02 Aug 2005 14:14:27 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1E01PB-00014T-1Y for emacs-devel@gnu.org; Tue, 02 Aug 2005 14:22:21 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1E01B7-0001AJ-2x for emacs-devel@gnu.org; Tue, 02 Aug 2005 20:07:49 +0200 Original-Received: from 207.167.42.60 ([207.167.42.60]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Aug 2005 20:07:49 +0200 Original-Received: from ihs_4664 by 207.167.42.60 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 02 Aug 2005 20:07:49 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 130 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.60 User-Agent: Mozilla Thunderbird 0.9 (X11/20041105) X-Accept-Language: en-us, en In-Reply-To: <88B948B1-1E1B-412D-8BC8-B0DCA6B70BC8@gmail.com> 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:41438 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41438 David Reitter wrote: > custom-file pops up in the recentf menu. The fix below addresses the > issue. Alternatives would be adding a check for custom-file to > recentf-keep, but that would prevent .emacs (or whatever custom-file > is) from turning up there even if the user loads it. There could be > better (more elaborate) solutions that preserve the effect of file- > precious-flag, of course. Using write-region also makes it susceptible to losing data (if custom-file is already being visited, in a narrowed buffer). I think a better solution would be to prevent custom-file from being added to recentf-list by the 2 functions in cus-edit.el that visit it, custom-save-delete and custom-save-all: *** emacs-21.3/lisp/cus-edit.el~ Tue Oct 15 08:21:42 2002 --- emacs-21.3/lisp/cus-edit.el Tue Aug 2 12:02:32 2005 *************** *** 3465,3471 **** "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)) (set-buffer (find-file-noselect (custom-file)))) (goto-char (point-min)) ;; Skip all whitespace and comments. --- 3465,3476 ---- "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 nil) ! (recentf-exclude (if recentf-mode ! (cons (concat "\\`" ! (regexp-quote (custom-file)) ! "\\'") ! recentf-exclude)))) (set-buffer (find-file-noselect (custom-file)))) (goto-char (point-min)) ;; Skip all whitespace and comments. *************** *** 3649,3655 **** (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))))) --- 3654,3665 ---- (custom-save-variables) (custom-save-faces) (save-excursion ! (let ((default-major-mode nil) ! (recentf-exclude (if recentf-mode ! (cons (concat "\\`" ! (regexp-quote (custom-file)) ! "\\'") ! recentf-exclude)))) (set-buffer (find-file-noselect (custom-file)))) (let ((file-precious-flag t)) (save-buffer))))) -- Kevin Rodgers David Reitter wrote: > custom-file pops up in the recentf menu. The fix below addresses the > issue. Alternatives would be adding a check for custom-file to > recentf-keep, but that would prevent .emacs (or whatever custom-file > is) from turning up there even if the user loads it. There could be > better (more elaborate) solutions that preserve the effect of file- > precious-flag, of course. Using write-region also makes it susceptible to losing data (if custom-file is already being visited, in a narrowed buffer). I think a better solution would be to prevent custom-file from being added to recentf-list by the 2 functions in cus-edit.el that visit it, custom-save-delete and custom-save-all: *** emacs-21.3/lisp/cus-edit.el~ Tue Oct 15 08:21:42 2002 --- emacs-21.3/lisp/cus-edit.el Tue Aug 2 12:02:32 2005 *************** *** 3465,3471 **** "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)) (set-buffer (find-file-noselect (custom-file)))) (goto-char (point-min)) ;; Skip all whitespace and comments. --- 3465,3476 ---- "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 nil) ! (recentf-exclude (if recentf-mode ! (cons (concat "\\`" ! (regexp-quote (custom-file)) ! "\\'") ! recentf-exclude)))) (set-buffer (find-file-noselect (custom-file)))) (goto-char (point-min)) ;; Skip all whitespace and comments. *************** *** 3649,3655 **** (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))))) --- 3654,3665 ---- (custom-save-variables) (custom-save-faces) (save-excursion ! (let ((default-major-mode nil) ! (recentf-exclude (if recentf-mode ! (cons (concat "\\`" ! (regexp-quote (custom-file)) ! "\\'") ! recentf-exclude)))) (set-buffer (find-file-noselect (custom-file)))) (let ((file-precious-flag t)) (save-buffer))))) -- Kevin Rodgers