diff options
| author | Richard M. Stallman | 2005-08-30 10:35:09 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-08-30 10:35:09 +0000 |
| commit | f8d869d15ade9bf5ffa0e8d76c3018e34a4d28e5 (patch) | |
| tree | f9f666ebdc5a5fb5f1bef671eaa61df7ec457e40 | |
| parent | d9df5bffac090389cdd163ba04feeb11f0e2d8b8 (diff) | |
| download | emacs-f8d869d15ade9bf5ffa0e8d76c3018e34a4d28e5.tar.gz emacs-f8d869d15ade9bf5ffa0e8d76c3018e34a4d28e5.zip | |
(custom-buffer-sort-alphabetically): Default to t.
(custom-save-all): Visit the file if necessary;
kill the buffer if we created it.
(custom-save-delete): Don't visit file or kill buffer here.
| -rw-r--r-- | lisp/cus-edit.el | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index c0e54b4add3..9827ab7d594 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -670,7 +670,7 @@ If `last', order groups after non-groups." | |||
| 670 | :type 'boolean | 670 | :type 'boolean |
| 671 | :group 'custom-browse) | 671 | :group 'custom-browse) |
| 672 | 672 | ||
| 673 | (defcustom custom-buffer-sort-alphabetically nil | 673 | (defcustom custom-buffer-sort-alphabetically t |
| 674 | "If non-nil, sort members of each customization group alphabetically." | 674 | "If non-nil, sort members of each customization group alphabetically." |
| 675 | :type 'boolean | 675 | :type 'boolean |
| 676 | :group 'custom-buffer) | 676 | :group 'custom-buffer) |
| @@ -3836,8 +3836,9 @@ Optional EVENT is the location for the menu." | |||
| 3836 | (setq magics (cdr magics))))) | 3836 | (setq magics (cdr magics))))) |
| 3837 | (widget-put widget :custom-state found))) | 3837 | (widget-put widget :custom-state found))) |
| 3838 | (custom-magic-reset widget)) | 3838 | (custom-magic-reset widget)) |
| 3839 | |||
| 3840 | ;;; Reading and writing the custom file. | ||
| 3839 | 3841 | ||
| 3840 | ;;; The `custom-save-all' Function. | ||
| 3841 | ;;;###autoload | 3842 | ;;;###autoload |
| 3842 | (defcustom custom-file nil | 3843 | (defcustom custom-file nil |
| 3843 | "File used for storing customization information. | 3844 | "File used for storing customization information. |
| @@ -3898,17 +3899,33 @@ if only the first line of the docstring is shown.")) | |||
| 3898 | (setq user-init-file default-init-file)) | 3899 | (setq user-init-file default-init-file)) |
| 3899 | user-init-file)))) | 3900 | user-init-file)))) |
| 3900 | 3901 | ||
| 3902 | ;;;###autoload | ||
| 3903 | (defun custom-save-all () | ||
| 3904 | "Save all customizations in `custom-file'." | ||
| 3905 | (let* ((filename (custom-file)) | ||
| 3906 | (recentf-exclude (if recentf-mode | ||
| 3907 | (cons (concat "\\`" | ||
| 3908 | (regexp-quote (custom-file)) | ||
| 3909 | "\\'") | ||
| 3910 | recentf-exclude))) | ||
| 3911 | (old-buffer (find-buffer-visiting filename))) | ||
| 3912 | (with-current-buffer (or old-buffer (find-file-noselect filename)) | ||
| 3913 | (let ((inhibit-read-only t)) | ||
| 3914 | (custom-save-variables) | ||
| 3915 | (custom-save-faces)) | ||
| 3916 | (let ((file-precious-flag t)) | ||
| 3917 | (save-buffer)) | ||
| 3918 | (unless old-buffer | ||
| 3919 | (kill-buffer (current-buffer)))))) | ||
| 3920 | |||
| 3921 | ;; Editing the custom file contents in a buffer. | ||
| 3922 | |||
| 3901 | (defun custom-save-delete (symbol) | 3923 | (defun custom-save-delete (symbol) |
| 3902 | "Visit `custom-file' and delete all calls to SYMBOL from it. | 3924 | "Delete all calls to SYMBOL from the contents of the current buffer. |
| 3903 | Leave point at the old location of the first such call, | 3925 | Leave point at the old location of the first such call, |
| 3904 | or (if there were none) at the end of the buffer." | 3926 | or (if there were none) at the end of the buffer. |
| 3905 | (let ((default-major-mode 'emacs-lisp-mode) | 3927 | |
| 3906 | (recentf-exclude (if recentf-mode | 3928 | This function does not save the buffer." |
| 3907 | (cons (concat "\\`" | ||
| 3908 | (regexp-quote (custom-file)) | ||
| 3909 | "\\'") | ||
| 3910 | recentf-exclude)))) | ||
| 3911 | (set-buffer (find-file-noselect (custom-file)))) | ||
| 3912 | (goto-char (point-min)) | 3929 | (goto-char (point-min)) |
| 3913 | ;; Skip all whitespace and comments. | 3930 | ;; Skip all whitespace and comments. |
| 3914 | (while (forward-comment 1)) | 3931 | (while (forward-comment 1)) |
| @@ -4128,24 +4145,7 @@ or (if there were none) at the end of the buffer." | |||
| 4128 | (put symbol 'customized-face-comment nil))))) | 4145 | (put symbol 'customized-face-comment nil))))) |
| 4129 | ;; We really should update all custom buffers here. | 4146 | ;; We really should update all custom buffers here. |
| 4130 | (custom-save-all)) | 4147 | (custom-save-all)) |
| 4131 | 4148 | ||
| 4132 | ;;;###autoload | ||
| 4133 | (defun custom-save-all () | ||
| 4134 | "Save all customizations in `custom-file'." | ||
| 4135 | (let ((inhibit-read-only t)) | ||
| 4136 | (custom-save-variables) | ||
| 4137 | (custom-save-faces) | ||
| 4138 | (save-excursion | ||
| 4139 | (let ((default-major-mode nil) | ||
| 4140 | (recentf-exclude (if recentf-mode | ||
| 4141 | (cons (concat "\\`" | ||
| 4142 | (regexp-quote (custom-file)) | ||
| 4143 | "\\'") | ||
| 4144 | recentf-exclude)))) | ||
| 4145 | (set-buffer (find-file-noselect (custom-file)))) | ||
| 4146 | (let ((file-precious-flag t)) | ||
| 4147 | (save-buffer))))) | ||
| 4148 | |||
| 4149 | ;;; The Customize Menu. | 4149 | ;;; The Customize Menu. |
| 4150 | 4150 | ||
| 4151 | ;;; Menu support | 4151 | ;;; Menu support |