aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-12-30 22:44:36 +0000
committerRichard M. Stallman2005-12-30 22:44:36 +0000
commit16ecd4c5b1afa09575f0ed197718735f55505a16 (patch)
tree35ea940f275f0f7a0cb696618d529026b253cdc6
parenta073af58b1df09c24b4017af63d097be8408b786 (diff)
downloademacs-16ecd4c5b1afa09575f0ed197718735f55505a16.tar.gz
emacs-16ecd4c5b1afa09575f0ed197718735f55505a16.zip
(custom-save-loaded-themes): Call custom-save-delete.
(custom-save-all): Call custom-save-loaded-themes. (custom-save-variables): Don't delete or add custom-load-themes call.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/cus-edit.el113
2 files changed, 63 insertions, 56 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0a7f017aea0..3a3bb4d5352 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12005-12-30 Richard M. Stallman <rms@gnu.org>
2
3 * cus-edit.el (custom-save-loaded-themes): Call custom-save-delete.
4 (custom-save-all): Call custom-save-loaded-themes.
5 (custom-save-variables): Don't delete or add custom-load-themes call.
6
12005-12-30 Stefan Monnier <monnier@iro.umontreal.ca> 72005-12-30 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * cus-start.el: Add `visible-cursor'. 9 * cus-start.el: Add `visible-cursor'.
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 54d0fa23e52..5686d473231 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -4018,12 +4018,40 @@ if only the first line of the docstring is shown."))
4018 (old-buffer (find-buffer-visiting filename))) 4018 (old-buffer (find-buffer-visiting filename)))
4019 (with-current-buffer (or old-buffer (find-file-noselect filename)) 4019 (with-current-buffer (or old-buffer (find-file-noselect filename))
4020 (let ((inhibit-read-only t)) 4020 (let ((inhibit-read-only t))
4021 (custom-save-loaded-themes)
4021 (custom-save-variables) 4022 (custom-save-variables)
4022 (custom-save-faces)) 4023 (custom-save-faces))
4023 (let ((file-precious-flag t)) 4024 (let ((file-precious-flag t))
4024 (save-buffer)) 4025 (save-buffer))
4025 (unless old-buffer 4026 (unless old-buffer
4026 (kill-buffer (current-buffer)))))) 4027 (kill-buffer (current-buffer))))))
4028
4029;;;###autoload
4030(defun customize-save-customized ()
4031 "Save all user options which have been set in this session."
4032 (interactive)
4033 (mapatoms (lambda (symbol)
4034 (let ((face (get symbol 'customized-face))
4035 (value (get symbol 'customized-value))
4036 (face-comment (get symbol 'customized-face-comment))
4037 (variable-comment
4038 (get symbol 'customized-variable-comment)))
4039 (when face
4040 (put symbol 'saved-face face)
4041 (custom-push-theme 'theme-face symbol 'user 'set value)
4042 (put symbol 'customized-face nil))
4043 (when value
4044 (put symbol 'saved-value value)
4045 (custom-push-theme 'theme-value symbol 'user 'set value)
4046 (put symbol 'customized-value nil))
4047 (when variable-comment
4048 (put symbol 'saved-variable-comment variable-comment)
4049 (put symbol 'customized-variable-comment nil))
4050 (when face-comment
4051 (put symbol 'saved-face-comment face-comment)
4052 (put symbol 'customized-face-comment nil)))))
4053 ;; We really should update all custom buffers here.
4054 (custom-save-all))
4027 4055
4028;; Editing the custom file contents in a buffer. 4056;; Editing the custom file contents in a buffer.
4029 4057
@@ -4069,10 +4097,8 @@ This function does not save the buffer."
4069(defun custom-save-variables () 4097(defun custom-save-variables ()
4070 "Save all customized variables in `custom-file'." 4098 "Save all customized variables in `custom-file'."
4071 (save-excursion 4099 (save-excursion
4072 (custom-save-delete 'custom-load-themes)
4073 (custom-save-delete 'custom-reset-variables) 4100 (custom-save-delete 'custom-reset-variables)
4074 (custom-save-delete 'custom-set-variables) 4101 (custom-save-delete 'custom-set-variables)
4075 (custom-save-loaded-themes)
4076 (custom-save-resets 'theme-value 'custom-reset-variables nil) 4102 (custom-save-resets 'theme-value 'custom-reset-variables nil)
4077 (let ((standard-output (current-buffer)) 4103 (let ((standard-output (current-buffer))
4078 (saved-list (make-list 1 0)) 4104 (saved-list (make-list 1 0))
@@ -4131,6 +4157,33 @@ This function does not save the buffer."
4131 (unless (looking-at "\n") 4157 (unless (looking-at "\n")
4132 (princ "\n"))))) 4158 (princ "\n")))))
4133 4159
4160(defun custom-save-resets (property setter special)
4161 (let (started-writing ignored-special)
4162 ;; (custom-save-delete setter) Done by caller
4163 (let ((standard-output (current-buffer))
4164 (mapper `(lambda (object)
4165 (let ((spec (car-safe (get object (quote ,property)))))
4166 (when (and (not (memq object ignored-special))
4167 (eq (nth 0 spec) 'user)
4168 (eq (nth 1 spec) 'reset))
4169 ;; Do not write reset statements unless necessary.
4170 (unless started-writing
4171 (setq started-writing t)
4172 (unless (bolp)
4173 (princ "\n"))
4174 (princ "(")
4175 (princ (quote ,setter))
4176 (princ "\n '(")
4177 (prin1 object)
4178 (princ " ")
4179 (prin1 (nth 3 spec))
4180 (princ ")")))))))
4181 (mapc mapper special)
4182 (setq ignored-special special)
4183 (mapatoms mapper)
4184 (when started-writing
4185 (princ ")\n")))))
4186
4134(defun custom-save-faces () 4187(defun custom-save-faces ()
4135 "Save all customized faces in `custom-file'." 4188 "Save all customized faces in `custom-file'."
4136 (save-excursion 4189 (save-excursion
@@ -4188,34 +4241,9 @@ This function does not save the buffer."
4188 (unless (looking-at "\n") 4241 (unless (looking-at "\n")
4189 (princ "\n"))))) 4242 (princ "\n")))))
4190 4243
4191(defun custom-save-resets (property setter special)
4192 (let (started-writing ignored-special)
4193 ;; (custom-save-delete setter) Done by caller
4194 (let ((standard-output (current-buffer))
4195 (mapper `(lambda (object)
4196 (let ((spec (car-safe (get object (quote ,property)))))
4197 (when (and (not (memq object ignored-special))
4198 (eq (nth 0 spec) 'user)
4199 (eq (nth 1 spec) 'reset))
4200 ;; Do not write reset statements unless necessary.
4201 (unless started-writing
4202 (setq started-writing t)
4203 (unless (bolp)
4204 (princ "\n"))
4205 (princ "(")
4206 (princ (quote ,setter))
4207 (princ "\n '(")
4208 (prin1 object)
4209 (princ " ")
4210 (prin1 (nth 3 spec))
4211 (princ ")")))))))
4212 (mapc mapper special)
4213 (setq ignored-special special)
4214 (mapatoms mapper)
4215 (when started-writing
4216 (princ ")\n")))))
4217
4218(defun custom-save-loaded-themes () 4244(defun custom-save-loaded-themes ()
4245 "Update the `custom-load-themes' call in the buffer."
4246 (custom-save-delete 'custom-load-themes)
4219 (let ((themes (reverse (get 'user 'theme-loads-themes))) 4247 (let ((themes (reverse (get 'user 'theme-loads-themes)))
4220 (standard-output (current-buffer))) 4248 (standard-output (current-buffer)))
4221 (when themes 4249 (when themes
@@ -4225,33 +4253,6 @@ This function does not save the buffer."
4225 (princ "\n '") 4253 (princ "\n '")
4226 (prin1 theme)) themes) 4254 (prin1 theme)) themes)
4227 (princ " )\n")))) 4255 (princ " )\n"))))
4228
4229;;;###autoload
4230(defun customize-save-customized ()
4231 "Save all user options which have been set in this session."
4232 (interactive)
4233 (mapatoms (lambda (symbol)
4234 (let ((face (get symbol 'customized-face))
4235 (value (get symbol 'customized-value))
4236 (face-comment (get symbol 'customized-face-comment))
4237 (variable-comment
4238 (get symbol 'customized-variable-comment)))
4239 (when face
4240 (put symbol 'saved-face face)
4241 (custom-push-theme 'theme-face symbol 'user 'set value)
4242 (put symbol 'customized-face nil))
4243 (when value
4244 (put symbol 'saved-value value)
4245 (custom-push-theme 'theme-value symbol 'user 'set value)
4246 (put symbol 'customized-value nil))
4247 (when variable-comment
4248 (put symbol 'saved-variable-comment variable-comment)
4249 (put symbol 'customized-variable-comment nil))
4250 (when face-comment
4251 (put symbol 'saved-face-comment face-comment)
4252 (put symbol 'customized-face-comment nil)))))
4253 ;; We really should update all custom buffers here.
4254 (custom-save-all))
4255 4256
4256;;; The Customize Menu. 4257;;; The Customize Menu.
4257 4258