Mercurial > emacs
changeset 68020:d8acae190ef7
* cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu)
(custom-variable-menu, custom-face-menu, custom-group-menu)
(custom-buffer-create-internal): Change "Reset" to "Show".
Reorder menu items.
(custom-link): New face for Info links.
(custom-buffer-create-internal, custom-manual): Use it.
* wid-edit.el (widget-default-mouse-face-get): New function.
(widget-specify-button): Handle mouse-face like button-face.
* custom.el (load-theme): Clear old theme settings if reloading.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 04 Jan 2006 15:56:08 +0000 |
parents | b9546af7814e |
children | 271ab3aed790 |
files | lisp/ChangeLog lisp/cus-edit.el lisp/custom.el lisp/wid-edit.el |
diffstat | 4 files changed, 129 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Wed Jan 04 04:13:45 2006 +0000 +++ b/lisp/ChangeLog Wed Jan 04 15:56:08 2006 +0000 @@ -1,3 +1,17 @@ +2006-01-04 Chong Yidong <cyd@stupidchicken.com> + + * cus-edit.el (custom-reset-menu, custom-reset, Custom-mode-menu) + (custom-variable-menu, custom-face-menu, custom-group-menu) + (custom-buffer-create-internal): Change "Reset" to "Show". + Reorder menu items. + (custom-link): New face for Info links. + (custom-buffer-create-internal, custom-manual): Use it. + + * wid-edit.el (widget-default-mouse-face-get): New function. + (widget-specify-button): Handle mouse-face like button-face. + + * custom.el (load-theme): Clear old theme settings if reloading. + 2006-01-03 Luc Teirlinck <teirllm@auburn.edu> * cus-edit.el (custom-buffer-create-internal): Move whole buffer
--- a/lisp/cus-edit.el Wed Jan 04 04:13:45 2006 +0000 +++ b/lisp/cus-edit.el Wed Jan 04 15:56:08 2006 +0000 @@ -768,8 +768,8 @@ (message "Aborted"))) (defvar custom-reset-menu - '(("Current" . Custom-reset-current) - ("Saved" . Custom-reset-saved) + '(("Show current settings" . Custom-reset-current) + ("Show saved settings" . Custom-reset-saved) ("Erase Customization (use standard values)" . Custom-reset-standard)) "Alist of actions for the `Reset' button. The key is a string containing the name of the action, the value is a @@ -779,7 +779,7 @@ (defun custom-reset (event) "Select item from reset menu." (let* ((completion-ignore-case t) - (answer (widget-choose "Reset to" + (answer (widget-choose "Reset buffer" custom-reset-menu event))) (if answer @@ -1456,50 +1456,39 @@ "Square brackets indicate"))) (widget-create 'info-link :tag "Custom file" + :button-face 'custom-link + :mouse-face 'highlight "(emacs)Saving Customizations") (widget-insert " for information on how to save in a different file.\n See ") (widget-create 'info-link :tag "Help" + :button-face 'custom-link + :mouse-face 'highlight :help-echo "Read the online help." "(emacs)Easy Customization") (widget-insert " for more information.\n\n") (widget-insert "Operate on everything in this buffer:\n ")) (widget-insert " ")) - (widget-create 'push-button - :tag "Set for Current Session" - :help-echo "\ -Make your editing in this buffer take effect for this session." - :action (lambda (widget &optional event) - (Custom-set))) - (when (or custom-file user-init-file) - (widget-insert " ") - (widget-create 'push-button - :tag "Save for Future Sessions" - :help-echo "\ -Make your editing in this buffer take effect for future Emacs sessions. -This updates your Emacs initialization file or creates a new one." - :action (lambda (widget &optional event) - (Custom-save)))) (if custom-reset-button-menu (progn (widget-insert " ") (widget-create 'push-button - :tag "Reset" + :tag "Reset buffer" :help-echo "Show a menu with reset operations." :mouse-down-action (lambda (&rest junk) t) :action (lambda (widget &optional event) (custom-reset event)))) (widget-insert "\n ") (widget-create 'push-button - :tag "Reset to Current" + :tag "Show Current Settings" :help-echo "\ Reset all edited text in this buffer to reflect current values." :action 'Custom-reset-current) (widget-insert " ") (widget-create 'push-button - :tag "Reset to Saved" + :tag "Show Saved Settings" :help-echo "\ Reset all settings in this buffer to their saved values." :action 'Custom-reset-saved) @@ -1510,13 +1499,31 @@ :help-echo "\ Un-customize all settings in this buffer--save them with standard values." :action 'Custom-reset-standard))) + (widget-insert "\n ") + (widget-create 'push-button + :tag "Set for Current Session" + :help-echo "\ +Make your editing in this buffer take effect for this session." + :action (lambda (widget &optional event) + (Custom-set))) (if (not custom-buffer-verbose-help) (progn (widget-insert " ") (widget-create 'info-link :tag "Help" + :button-face 'custom-link + :mouse-face 'highlight :help-echo "Read the online help." "(emacs)Easy Customization"))) + (when (or custom-file user-init-file) + (widget-insert " ") + (widget-create 'push-button + :tag "Save for Future Sessions" + :help-echo "\ +Make your editing in this buffer take effect for future Emacs sessions. +This updates your Emacs initialization file or creates a new one." + :action (lambda (widget &optional event) + (Custom-save)))) (widget-insert " ") (widget-create 'push-button :tag "Finish" @@ -1701,6 +1708,8 @@ (define-widget 'custom-manual 'info-link "Link to the manual entry for this customization option." :help-echo "Read the manual entry for this option." + :button-face 'custom-link + :mouse-face 'highlight :tag "Manual") ;;; The `custom-magic' Widget. @@ -2045,6 +2054,17 @@ ;; backward-compatibility alias (put 'custom-state-face 'face-alias 'custom-state) +(defface custom-link + '((((min-colors 88) + (class color) (background light)) :foreground "blue1" :underline t) + (((class color) (background light)) :foreground "blue" :underline t) + (((min-colors 88) + (class color) (background dark)) :foreground "cyan1" :underline t) + (((class color) (background dark)) :foreground "cyan" :underline t) + (t :underline t)) + "Face for Info links in customization buffers." + :group 'info) + (define-widget 'custom 'default "Customize a user option." :format "%v" @@ -2601,41 +2621,42 @@ (get (widget-value widget) 'standard-value)) (defvar custom-variable-menu - `(("Set for Current Session" custom-variable-set - (lambda (widget) - (eq (widget-get widget :custom-state) 'modified))) - ,@(when (or custom-file user-init-file) - '(("Save for Future Sessions" custom-variable-save - (lambda (widget) - (memq (widget-get widget :custom-state) '(modified set changed rogue)))))) - ("Reset to Current" custom-redraw + `(("Show current value" custom-redraw (lambda (widget) (and (default-boundp (widget-value widget)) (memq (widget-get widget :custom-state) '(modified changed))))) - ("Reset to Saved" custom-variable-reset-saved + ("Show saved value" custom-variable-reset-saved (lambda (widget) (and (or (get (widget-value widget) 'saved-value) (get (widget-value widget) 'saved-variable-comment)) (memq (widget-get widget :custom-state) '(modified set changed rogue))))) + ("Show backup value" custom-variable-reset-backup + (lambda (widget) + (get (widget-value widget) 'backup-value))) + ("---" ignore ignore) + ("Add comment" custom-comment-show custom-comment-invisible-p) + ("Show value widget" custom-variable-edit + (lambda (widget) + (eq (widget-get widget :custom-form) 'lisp))) + ("Show Lisp expression" custom-variable-edit-lisp + (lambda (widget) + (eq (widget-get widget :custom-form) 'edit))) + ("---" ignore ignore) ,@(when (or custom-file user-init-file) - '(("Erase Customization" custom-variable-reset-standard + '(("Erase customization" custom-variable-reset-standard (lambda (widget) (and (get (widget-value widget) 'standard-value) (memq (widget-get widget :custom-state) '(modified set changed saved rogue))))))) - ("Use Backup Value" custom-variable-reset-backup + ("Set for current session" custom-variable-set (lambda (widget) - (get (widget-value widget) 'backup-value))) - ("---" ignore ignore) - ("Add Comment" custom-comment-show custom-comment-invisible-p) - ("---" ignore ignore) - ("Don't show as Lisp expression" custom-variable-edit - (lambda (widget) - (eq (widget-get widget :custom-form) 'lisp))) - ("Show initial Lisp expression" custom-variable-edit-lisp - (lambda (widget) - (eq (widget-get widget :custom-form) 'edit)))) + (eq (widget-get widget :custom-state) 'modified))) + ,@(when (or custom-file user-init-file) + '(("Save for future sessions" custom-variable-save + (lambda (widget) + (memq (widget-get widget :custom-state) + '(modified set changed rogue))))))) "Alist of actions for the `custom-variable' widget. Each entry has the form (NAME ACTION FILTER) where NAME is the name of the menu entry, ACTION is the function to call on the widget when the @@ -3273,29 +3294,29 @@ (message "Creating face editor...done")))))) (defvar custom-face-menu - `(("Set for Current Session" custom-face-set) - ,@(when (or custom-file user-init-file) - '(("Save for Future Sessions" custom-face-save-command))) - ("Reset to Saved" custom-face-reset-saved + `(("Show saved face" custom-face-reset-saved (lambda (widget) (or (get (widget-value widget) 'saved-face) (get (widget-value widget) 'saved-face-comment)))) + ("---" ignore ignore) + ("Add comment" custom-comment-show custom-comment-invisible-p) + ("Show all attributes" custom-face-edit-all + (lambda (widget) + (not (eq (widget-get widget :custom-form) 'all)))) + ("Show current attributes" custom-face-edit-selected + (lambda (widget) + (not (eq (widget-get widget :custom-form) 'selected)))) + ("Show Lisp expression" custom-face-edit-lisp + (lambda (widget) + (not (eq (widget-get widget :custom-form) 'lisp)))) + ("---" ignore ignore) ,@(when (or custom-file user-init-file) - '(("Erase Customization" custom-face-reset-standard + '(("Erase customization" custom-face-reset-standard (lambda (widget) (get (widget-value widget) 'face-defface-spec))))) - ("---" ignore ignore) - ("Add Comment" custom-comment-show custom-comment-invisible-p) - ("---" ignore ignore) - ("Show all display specs" custom-face-edit-all - (lambda (widget) - (not (eq (widget-get widget :custom-form) 'all)))) - ("Just current attributes" custom-face-edit-selected - (lambda (widget) - (not (eq (widget-get widget :custom-form) 'selected)))) - ("Show as Lisp expression" custom-face-edit-lisp - (lambda (widget) - (not (eq (widget-get widget :custom-form) 'lisp))))) + ("Set for current session" custom-face-set) + ,@(when (or custom-file user-init-file) + '(("Save for future sessions" custom-face-save-command)))) "Alist of actions for the `custom-face' widget. Each entry has the form (NAME ACTION FILTER) where NAME is the name of the menu entry, ACTION is the function to call on the widget when the @@ -3869,23 +3890,24 @@ (insert "/\n"))))) (defvar custom-group-menu - `(("Set for Current Session" custom-group-set + `(("Show current settings" custom-group-reset-current + (lambda (widget) + (memq (widget-get widget :custom-state) '(modified)))) + ("Show saved settings" custom-group-reset-saved + (lambda (widget) + (memq (widget-get widget :custom-state) '(modified set)))) + ,@(when (or custom-file user-init-file) + '(("Show standard settings" custom-group-reset-standard + (lambda (widget) + (memq (widget-get widget :custom-state) '(modified set saved)))))) + ("---" ignore ignore) + ("Set for current session" custom-group-set (lambda (widget) (eq (widget-get widget :custom-state) 'modified))) ,@(when (or custom-file user-init-file) - '(("Save for Future Sessions" custom-group-save + '(("Save for future sessions" custom-group-save (lambda (widget) - (memq (widget-get widget :custom-state) '(modified set)))))) - ("Reset to Current" custom-group-reset-current - (lambda (widget) - (memq (widget-get widget :custom-state) '(modified)))) - ("Reset to Saved" custom-group-reset-saved - (lambda (widget) - (memq (widget-get widget :custom-state) '(modified set)))) - ,@(when (or custom-file user-init-file) - '(("Reset to standard setting" custom-group-reset-standard - (lambda (widget) - (memq (widget-get widget :custom-state) '(modified set saved))))))) + (memq (widget-get widget :custom-state) '(modified set))))))) "Alist of actions for the `custom-group' widget. Each entry has the form (NAME ACTION FILTER) where NAME is the name of the menu entry, ACTION is the function to call on the widget when the @@ -4342,9 +4364,9 @@ ,(customize-menu-create 'customize) ["Set" Custom-set t] ["Save" Custom-save t] - ["Reset to Current" Custom-reset-current t] - ["Reset to Saved" Custom-reset-saved t] - ["Reset to Standard Values" Custom-reset-standard t] + ["Show current settings" Custom-reset-current t] + ["Show saved settings" Custom-reset-saved t] + ["Erase customizations" Custom-reset-standard t] ["Info" (info "(emacs)Easy Customization") t])) (defun Custom-goto-parent ()
--- a/lisp/custom.el Wed Jan 04 04:13:45 2006 +0000 +++ b/lisp/custom.el Wed Jan 04 15:56:08 2006 +0000 @@ -1007,11 +1007,17 @@ (enable-theme 'user))) (defun load-theme (theme) - "Try to load a theme's settings from its file. + "Load a theme's settings from its file. This also enables the theme; use `disable-theme' to disable it." ;; Note we do no check for validity of the theme here. ;; This allows to pull in themes by a file-name convention (interactive "SCustom theme name: ") + ;; If reloading, clear out the old theme settings. + (when (custom-theme-p theme) + (disable-theme theme) + (put theme 'theme-settings nil) + (put theme 'theme-feature nil) + (put theme 'theme-documentation nil)) (let ((load-path (if (file-directory-p custom-theme-directory) (cons custom-theme-directory load-path) load-path)))
--- a/lisp/wid-edit.el Wed Jan 04 04:13:45 2006 +0000 +++ b/lisp/wid-edit.el Wed Jan 04 15:56:08 2006 +0000 @@ -403,7 +403,8 @@ ;; We want to avoid the face with image buttons. (unless (widget-get widget :suppress-face) (overlay-put overlay 'face (widget-apply widget :button-face-get)) - (overlay-put overlay 'mouse-face widget-mouse-face)) + (overlay-put overlay 'mouse-face + (widget-apply widget :mouse-face-get))) (overlay-put overlay 'pointer 'hand) (overlay-put overlay 'follow-link follow-link) (overlay-put overlay 'help-echo help-echo))) @@ -1391,6 +1392,7 @@ :offset 0 :format-handler 'widget-default-format-handler :button-face-get 'widget-default-button-face-get + :mouse-face-get 'widget-default-mouse-face-get :sample-face-get 'widget-default-sample-face-get :delete 'widget-default-delete :copy 'identity @@ -1535,6 +1537,14 @@ (widget-apply parent :button-face-get) widget-button-face)))) +(defun widget-default-mouse-face-get (widget) + ;; Use :mouse-face or widget-mouse-face + (or (widget-get widget :mouse-face) + (let ((parent (widget-get widget :parent))) + (if parent + (widget-apply parent :mouse-face-get) + widget-mouse-face)))) + (defun widget-default-sample-face-get (widget) ;; Use :sample-face. (widget-get widget :sample-face))