diff options
| author | Stefan Monnier | 2003-02-01 00:39:58 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-02-01 00:39:58 +0000 |
| commit | d9f6713411787fd98b79b9114712ceda8292d8aa (patch) | |
| tree | 2346c81e7fa7a94a40ef9891ae630d7f8a83b638 | |
| parent | 4e7fbbc69bb5cb53d0ac00bd855a1bcc317ebec2 (diff) | |
| download | emacs-d9f6713411787fd98b79b9114712ceda8292d8aa.tar.gz emacs-d9f6713411787fd98b79b9114712ceda8292d8aa.zip | |
(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.
| -rw-r--r-- | lisp/cus-edit.el | 142 |
1 files changed, 63 insertions, 79 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 484ec0c0475..c85b2a67ac9 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -440,8 +440,7 @@ WIDGET is the widget to apply the filter entries of MENU on." | |||
| 440 | (get symbol 'custom-tag) | 440 | (get symbol 'custom-tag) |
| 441 | (concat (get symbol 'custom-tag) "..."))) | 441 | (concat (get symbol 'custom-tag) "..."))) |
| 442 | (t | 442 | (t |
| 443 | (save-excursion | 443 | (with-current-buffer (get-buffer-create " *Custom-Work*") |
| 444 | (set-buffer (get-buffer-create " *Custom-Work*")) | ||
| 445 | (erase-buffer) | 444 | (erase-buffer) |
| 446 | (princ symbol (current-buffer)) | 445 | (princ symbol (current-buffer)) |
| 447 | (goto-char (point-min)) | 446 | (goto-char (point-min)) |
| @@ -3695,49 +3694,42 @@ or (if there were none) at the end of the buffer." | |||
| 3695 | ;; If you edit it by hand, you could mess it up, so be careful. | 3694 | ;; If you edit it by hand, you could mess it up, so be careful. |
| 3696 | ;; Your init file should contain only one such instance. | 3695 | ;; Your init file should contain only one such instance. |
| 3697 | ;; If there is more than one, they won't work right.\n") | 3696 | ;; If there is more than one, they won't work right.\n") |
| 3698 | (mapcar | 3697 | (dolist (symbol saved-list) |
| 3699 | (lambda (symbol) | 3698 | (let ((spec (car-safe (get symbol 'theme-value))) |
| 3700 | (let ((spec (car-safe (get symbol 'theme-value))) | 3699 | (value (get symbol 'saved-value)) |
| 3701 | (value (get symbol 'saved-value)) | 3700 | (requests (get symbol 'custom-requests)) |
| 3702 | (requests (get symbol 'custom-requests)) | 3701 | (now (not (or (custom-variable-p symbol) |
| 3703 | (now (not (or (custom-variable-p symbol) | 3702 | (and (not (boundp symbol)) |
| 3704 | (and (not (boundp symbol)) | 3703 | (not (eq (get symbol 'force-value) |
| 3705 | (not (eq (get symbol 'force-value) | 3704 | 'rogue)))))) |
| 3706 | 'rogue)))))) | 3705 | (comment (get symbol 'saved-variable-comment)) |
| 3707 | (comment (get symbol 'saved-variable-comment)) | 3706 | sep) |
| 3708 | sep) | 3707 | ;; Check `requests'. |
| 3709 | (when (or (and spec | 3708 | (dolist (request requests) |
| 3710 | (eq (nth 0 spec) 'user) | 3709 | (when (and (symbolp request) (not (featurep request))) |
| 3711 | (eq (nth 1 spec) 'set)) | 3710 | (message "Unknown requested feature: %s" request) |
| 3712 | comment | 3711 | (setq requests (delq request requests)))) |
| 3713 | (and (null spec) (get symbol 'saved-value))) | 3712 | (when (or (and spec |
| 3714 | (unless (bolp) | 3713 | (eq (nth 0 spec) 'user) |
| 3715 | (princ "\n")) | 3714 | (eq (nth 1 spec) 'set)) |
| 3716 | (princ " '(") | 3715 | comment |
| 3717 | (prin1 symbol) | 3716 | (and (null spec) (get symbol 'saved-value))) |
| 3718 | (princ " ") | 3717 | (unless (bolp) |
| 3719 | (prin1 (car value)) | 3718 | (princ "\n")) |
| 3720 | (cond ((or now requests comment) | 3719 | (princ " '(") |
| 3721 | (princ " ") | 3720 | (prin1 symbol) |
| 3722 | (if now | 3721 | (princ " ") |
| 3723 | (princ "t") | 3722 | (prin1 (car value)) |
| 3724 | (princ "nil")) | 3723 | (when (or now requests comment) |
| 3725 | (cond ((or requests comment) | 3724 | (princ " ") |
| 3726 | (princ " ") | 3725 | (prin1 now) |
| 3727 | (if requests | 3726 | (when (or requests comment) |
| 3728 | (prin1 requests) | 3727 | (princ " ") |
| 3729 | (princ "nil")) | 3728 | (prin1 requests) |
| 3730 | (cond (comment | 3729 | (when comment |
| 3731 | (princ " ") | 3730 | (princ " ") |
| 3732 | (prin1 comment) | 3731 | (prin1 comment)))) |
| 3733 | (princ ")")) | 3732 | (princ ")")))) |
| 3734 | (t | ||
| 3735 | (princ ")")))) | ||
| 3736 | (t | ||
| 3737 | (princ ")")))) | ||
| 3738 | (t | ||
| 3739 | (princ ")")))))) | ||
| 3740 | saved-list) | ||
| 3741 | (if (bolp) | 3733 | (if (bolp) |
| 3742 | (princ " ")) | 3734 | (princ " ")) |
| 3743 | (princ ")") | 3735 | (princ ")") |
| @@ -3769,40 +3761,32 @@ or (if there were none) at the end of the buffer." | |||
| 3769 | ;; If you edit it by hand, you could mess it up, so be careful. | 3761 | ;; If you edit it by hand, you could mess it up, so be careful. |
| 3770 | ;; Your init file should contain only one such instance. | 3762 | ;; Your init file should contain only one such instance. |
| 3771 | ;; If there is more than one, they won't work right.\n") | 3763 | ;; If there is more than one, they won't work right.\n") |
| 3772 | (mapcar | 3764 | (dolist (symbol saved-list) |
| 3773 | (lambda (symbol) | 3765 | (let ((spec (car-safe (get symbol 'theme-face))) |
| 3774 | (let ((theme-spec (car-safe (get symbol 'theme-face))) | 3766 | (value (get symbol 'saved-face)) |
| 3775 | (value (get symbol 'saved-face)) | 3767 | (now (not (or (get symbol 'face-defface-spec) |
| 3776 | (now (not (or (get symbol 'face-defface-spec) | 3768 | (and (not (custom-facep symbol)) |
| 3777 | (and (not (custom-facep symbol)) | 3769 | (not (get symbol 'force-face)))))) |
| 3778 | (not (get symbol 'force-face)))))) | 3770 | (comment (get symbol 'saved-face-comment))) |
| 3779 | (comment (get symbol 'saved-face-comment))) | 3771 | (when (or (and spec |
| 3780 | (when (or (and theme-spec | 3772 | (eq (nth 0 spec) 'user) |
| 3781 | (eq (nth 0 theme-spec) 'user) | 3773 | (eq (nth 1 spec) 'set)) |
| 3782 | (eq (nth 1 theme-spec) 'set)) | 3774 | comment |
| 3783 | comment | 3775 | (and (null spec) (get symbol 'saved-face))) |
| 3784 | (and (null theme-spec) (get symbol 'saved-face))) | 3776 | ;; Don't print default face here. |
| 3785 | ;; Don't print default face here. | 3777 | (unless (bolp) |
| 3786 | (unless (bolp) | 3778 | (princ "\n")) |
| 3787 | (princ "\n")) | 3779 | (princ " '(") |
| 3788 | (princ " '(") | 3780 | (prin1 symbol) |
| 3789 | (prin1 symbol) | 3781 | (princ " ") |
| 3790 | (princ " ") | 3782 | (prin1 value) |
| 3791 | (prin1 value) | 3783 | (when (or now comment) |
| 3792 | (cond ((or now comment) | 3784 | (princ " ") |
| 3793 | (princ " ") | 3785 | (prin1 now) |
| 3794 | (if now | 3786 | (when comment |
| 3795 | (princ "t") | 3787 | (princ " ") |
| 3796 | (princ "nil")) | 3788 | (prin1 comment))) |
| 3797 | (cond (comment | 3789 | (princ ")")))) |
| 3798 | (princ " ") | ||
| 3799 | (prin1 comment) | ||
| 3800 | (princ ")")) | ||
| 3801 | (t | ||
| 3802 | (princ ")")))) | ||
| 3803 | (t | ||
| 3804 | (princ ")")))))) | ||
| 3805 | saved-list) | ||
| 3806 | (if (bolp) | 3790 | (if (bolp) |
| 3807 | (princ " ")) | 3791 | (princ " ")) |
| 3808 | (princ ")") | 3792 | (princ ")") |