all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: recentf: custom-file
Date: Tue, 02 Aug 2005 12:05:39 -0600	[thread overview]
Message-ID: <dcocll$hck$1@sea.gmane.org> (raw)
In-Reply-To: <88B948B1-1E1B-412D-8BC8-B0DCA6B70BC8@gmail.com>

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

  reply	other threads:[~2005-08-02 18:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-31 21:12 recentf: custom-file David Reitter
2005-08-02 18:05 ` Kevin Rodgers [this message]
2005-08-02 18:58   ` David Reitter
2005-08-05 11:59   ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='dcocll$hck$1@sea.gmane.org' \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.