# HG changeset patch # User Stefan Monnier # Date 1044059998 0 # Node ID e8de2a4807e5e42f8aa927fd646e9f05203d3018 # Parent 4d20af97e0f85c9e64992a3676870195cbe37df0 (custom-unlispify-menu-entry): Use with-current-buffer. (custom-save-variables): Use dolist, simplify. Output a message if a `requests' entry looks suspicious. (custom-save-faces): Use dolist, simplify. diff -r 4d20af97e0f8 -r e8de2a4807e5 lisp/cus-edit.el --- a/lisp/cus-edit.el Fri Jan 31 20:43:22 2003 +0000 +++ b/lisp/cus-edit.el Sat Feb 01 00:39:58 2003 +0000 @@ -440,8 +440,7 @@ (get symbol 'custom-tag) (concat (get symbol 'custom-tag) "..."))) (t - (save-excursion - (set-buffer (get-buffer-create " *Custom-Work*")) + (with-current-buffer (get-buffer-create " *Custom-Work*") (erase-buffer) (princ symbol (current-buffer)) (goto-char (point-min)) @@ -3695,49 +3694,42 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right.\n") - (mapcar - (lambda (symbol) - (let ((spec (car-safe (get symbol 'theme-value))) - (value (get symbol 'saved-value)) - (requests (get symbol 'custom-requests)) - (now (not (or (custom-variable-p symbol) - (and (not (boundp symbol)) - (not (eq (get symbol 'force-value) - 'rogue)))))) - (comment (get symbol 'saved-variable-comment)) - sep) - (when (or (and spec - (eq (nth 0 spec) 'user) - (eq (nth 1 spec) 'set)) - comment - (and (null spec) (get symbol 'saved-value))) - (unless (bolp) - (princ "\n")) - (princ " '(") - (prin1 symbol) - (princ " ") - (prin1 (car value)) - (cond ((or now requests comment) - (princ " ") - (if now - (princ "t") - (princ "nil")) - (cond ((or requests comment) - (princ " ") - (if requests - (prin1 requests) - (princ "nil")) - (cond (comment - (princ " ") - (prin1 comment) - (princ ")")) - (t - (princ ")")))) - (t - (princ ")")))) - (t - (princ ")")))))) - saved-list) + (dolist (symbol saved-list) + (let ((spec (car-safe (get symbol 'theme-value))) + (value (get symbol 'saved-value)) + (requests (get symbol 'custom-requests)) + (now (not (or (custom-variable-p symbol) + (and (not (boundp symbol)) + (not (eq (get symbol 'force-value) + 'rogue)))))) + (comment (get symbol 'saved-variable-comment)) + sep) + ;; Check `requests'. + (dolist (request requests) + (when (and (symbolp request) (not (featurep request))) + (message "Unknown requested feature: %s" request) + (setq requests (delq request requests)))) + (when (or (and spec + (eq (nth 0 spec) 'user) + (eq (nth 1 spec) 'set)) + comment + (and (null spec) (get symbol 'saved-value))) + (unless (bolp) + (princ "\n")) + (princ " '(") + (prin1 symbol) + (princ " ") + (prin1 (car value)) + (when (or now requests comment) + (princ " ") + (prin1 now) + (when (or requests comment) + (princ " ") + (prin1 requests) + (when comment + (princ " ") + (prin1 comment)))) + (princ ")")))) (if (bolp) (princ " ")) (princ ")") @@ -3769,40 +3761,32 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right.\n") - (mapcar - (lambda (symbol) - (let ((theme-spec (car-safe (get symbol 'theme-face))) - (value (get symbol 'saved-face)) - (now (not (or (get symbol 'face-defface-spec) - (and (not (custom-facep symbol)) - (not (get symbol 'force-face)))))) - (comment (get symbol 'saved-face-comment))) - (when (or (and theme-spec - (eq (nth 0 theme-spec) 'user) - (eq (nth 1 theme-spec) 'set)) - comment - (and (null theme-spec) (get symbol 'saved-face))) - ;; Don't print default face here. - (unless (bolp) - (princ "\n")) - (princ " '(") - (prin1 symbol) - (princ " ") - (prin1 value) - (cond ((or now comment) - (princ " ") - (if now - (princ "t") - (princ "nil")) - (cond (comment - (princ " ") - (prin1 comment) - (princ ")")) - (t - (princ ")")))) - (t - (princ ")")))))) - saved-list) + (dolist (symbol saved-list) + (let ((spec (car-safe (get symbol 'theme-face))) + (value (get symbol 'saved-face)) + (now (not (or (get symbol 'face-defface-spec) + (and (not (custom-facep symbol)) + (not (get symbol 'force-face)))))) + (comment (get symbol 'saved-face-comment))) + (when (or (and spec + (eq (nth 0 spec) 'user) + (eq (nth 1 spec) 'set)) + comment + (and (null spec) (get symbol 'saved-face))) + ;; Don't print default face here. + (unless (bolp) + (princ "\n")) + (princ " '(") + (prin1 symbol) + (princ " ") + (prin1 value) + (when (or now comment) + (princ " ") + (prin1 now) + (when comment + (princ " ") + (prin1 comment))) + (princ ")")))) (if (bolp) (princ " ")) (princ ")")