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
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel