emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: recentf: custom-file


From: Richard M. Stallman
Subject: Re: recentf: custom-file
Date: Fri, 05 Aug 2005 07:59:30 -0400

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]