diff options
Diffstat (limited to 'lisp/cus-edit.el')
-rw-r--r-- | lisp/cus-edit.el | 97 |
1 files changed, 53 insertions, 44 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 490d9055ecf..a62b623c44f 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -408,10 +408,6 @@ Use group `text' for this instead. This group is deprecated." "Input from the menus." :group 'environment) -(defgroup dnd nil - "Handling data from drag and drop." - :group 'environment) - (defgroup auto-save nil "Preventing accidental loss of data." :group 'files) @@ -485,10 +481,8 @@ Return a list suitable for use in `interactive'." (default (and (symbolp v) (custom-variable-p v) (symbol-name v))) (enable-recursive-minibuffers t) val) - (setq val (completing-read - (if default (format "Customize variable (default %s): " default) - "Customize variable: ") - obarray 'custom-variable-p t nil nil default)) + (setq val (completing-read (format-prompt "Customize variable" default) + obarray 'custom-variable-p t nil nil default)) (list (if (equal val "") (if (symbolp v) v nil) (intern val))))) @@ -561,7 +555,7 @@ value unless you are sure you know what it does." (unless no-suffix (goto-char (point-max)) (insert "...")) - (buffer-string))))) + (propertize (buffer-string) 'custom-data symbol))))) (defcustom custom-unlispify-tag-names t "Display tag names as words instead of symbols if non-nil." @@ -801,16 +795,19 @@ has been executed, nil otherwise." If a setting was edited and set before, this saves it. If a setting was merely edited before, this sets it then saves it." (interactive) - (when (custom-command-apply - (lambda (child) - (when (memq (widget-get child :custom-state) - '(modified set changed rogue)) - (widget-apply child :custom-mark-to-save))) - "Save all settings in this buffer? " t) - ;; Save changes to buffer and redraw. - (custom-save-all) - (dolist (child custom-options) - (widget-apply child :custom-state-set-and-redraw)))) + (let (edited-widgets) + (when (custom-command-apply + (lambda (child) + (when (memq (widget-get child :custom-state) + '(modified set changed rogue)) + (push child edited-widgets) + (widget-apply child :custom-mark-to-save))) + "Save all settings in this buffer? " t) + ;; Save changes to buffer. + (custom-save-all) + ;; Redraw and recalculate the state when necessary. + (dolist (widget edited-widgets) + (widget-apply widget :custom-state-set-and-redraw))))) (defun custom-reset (_widget &optional event) "Select item from reset menu." @@ -1081,9 +1078,7 @@ for the MODE to customize." (if (and group (not current-prefix-arg)) major-mode (intern - (completing-read (if group - (format "Mode (default %s): " major-mode) - "Mode: ") + (completing-read (format-prompt "Mode" (and group major-mode)) obarray 'custom-group-of-mode t nil nil (if group (symbol-name major-mode)))))))) @@ -1216,8 +1211,8 @@ that were added or redefined since that version." (interactive (list (read-from-minibuffer - (format "Customize options changed, since version (default %s): " - customize-changed-options-previous-release)))) + (format-prompt "Customize options changed, since version" + customize-changed-options-previous-release)))) (if (equal since-version "") (setq since-version nil) (unless (condition-case nil @@ -2682,7 +2677,7 @@ try matching its doc string against `custom-guess-doc-alist'." :sample-face (if obsolete 'custom-variable-obsolete 'custom-variable-tag) - tag) + :tag tag) buttons) (push (widget-create-child-and-convert widget type @@ -3565,19 +3560,24 @@ the present value is saved to its :shown-value property instead." (widget-put widget :buttons buttons)) ;; Draw an ordinary `custom-face' widget - (let ((opoint (point))) - ;; Visibility indicator. - (push (widget-create-child-and-convert - widget 'custom-visibility - :help-echo "Hide or show this face." - :on "Hide" :off "Show" - :on-glyph "down" :off-glyph "right" - :action 'custom-toggle-hide-face - (not hiddenp)) - buttons) - ;; Face name (tag). - (insert " " tag) - (widget-specify-sample widget opoint (point))) + ;; Visibility indicator. + (push (widget-create-child-and-convert + widget 'custom-visibility + :help-echo "Hide or show this face." + :on "Hide" :off "Show" + :on-glyph "down" :off-glyph "right" + :action 'custom-toggle-hide-face + (not hiddenp)) + buttons) + ;; Face name (tag). + (insert " ") + (push (widget-create-child-and-convert + widget 'face-link + :button-face 'link + :tag tag + :action (lambda (&rest _x) + (find-face-definition symbol))) + buttons) (insert (cond ((eq custom-buffer-style 'face) " ") ((string-match-p "face\\'" tag) ":") @@ -3825,7 +3825,17 @@ Optional EVENT is the location for the menu." (defun custom-face-save (widget) "Save the face edited by WIDGET." - (custom-face-mark-to-save widget) + (let ((form (widget-get widget :custom-form))) + (if (memq form '(all lisp)) + (custom-face-mark-to-save widget) + ;; The user is working on only a selected terminal type; + ;; make sure we save the entire spec to `custom-file'. (Bug #40866) + (custom-face-edit-all widget) + (custom-face-mark-to-save widget) + (if (eq form 'selected) + (custom-face-edit-selected widget) + ;; `form' is edit or mismatch; can't happen. + (widget-put widget :custom-form form)))) (custom-save-all) (custom-face-state-set-and-redraw widget)) @@ -4831,7 +4841,10 @@ The format is suitable for use with `easy-menu-define'." (error "You can't edit this part of the Custom buffer")) (defun Custom-newline (pos &optional event) - "Invoke button at POS, or refuse to allow editing of Custom buffer." + "Invoke button at POS, or refuse to allow editing of Custom buffer. + +To see what function the widget will call, use the +`widget-describe' command." (interactive "@d") (let ((button (get-char-property pos 'button))) ;; If there is no button at point, then use the one at the start @@ -4855,8 +4868,6 @@ If several parents are listed, go to the first of them." (parent (downcase (widget-get button :tag)))) (customize-group parent))))) -(define-obsolete-variable-alias 'custom-mode-hook 'Custom-mode-hook "23.1") - (defcustom Custom-mode-hook nil "Hook called when entering Custom mode." :type 'hook @@ -4927,8 +4938,6 @@ if that value is non-nil." (put 'Custom-mode 'mode-class 'special) -(define-obsolete-function-alias 'custom-mode 'Custom-mode "23.1") - ;;; The End. (provide 'cus-edit) |