-;;; cus-edit.el --- Tools for customizating Emacs and Lisp packages.
+;;; cus-edit.el --- Tools for customizing Emacs and Lisp packages.
;;
;; Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
;;
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
;; Keywords: help, faces
-;; X-URL: http://www.dina.kvl.dk/~abraham/custom/ (probably obsolete)
;; This file is part of GNU Emacs.
(defun custom-quote (sexp)
"Quote SEXP iff it is not self quoting."
(if (or (memq sexp '(t nil))
- (and (symbolp sexp)
- (eq (aref (symbol-name sexp) 0) ?:))
+ (keywordp sexp)
(and (listp sexp)
(memq (car sexp) '(lambda)))
(stringp sexp)
;;; Unlispify.
(defvar custom-prefix-list nil
- "List of prefixes that should be ignored by `custom-unlispify'")
+ "List of prefixes that should be ignored by `custom-unlispify'.")
(defcustom custom-unlispify-menu-entries t
"Display menu entries as words instead of symbols if non nil."
:type 'boolean)
(defun custom-unlispify-menu-entry (symbol &optional no-suffix)
- "Convert symbol into a menu entry."
+ "Convert SYMBOL into a menu entry."
(cond ((not custom-unlispify-menu-entries)
(symbol-name symbol))
((get symbol 'custom-tag)
:type 'boolean)
(defun custom-unlispify-tag-name (symbol)
- "Convert symbol into a menu entry."
+ "Convert SYMBOL into a menu entry."
(let ((custom-unlispify-menu-entries custom-unlispify-tag-names))
(custom-unlispify-menu-entry symbol t)))
(defun custom-prefix-add (symbol prefixes)
- ;; Addd SYMBOL to list of ignored PREFIXES.
+ "Add SYMBOL to list of ignored PREFIXES."
(cons (or (get symbol 'custom-prefix)
(concat (symbol-name symbol) "-"))
prefixes))
("Erase Customization (use standard settings)" . 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
-lisp function taking the widget as an element which will be called
+Lisp function taking the widget as an element which will be called
when the action is chosen.")
(defun custom-reset (event)
(put var 'variable-comment comment))))
;;;###autoload
-(defun customize-set-variable (var val &optional comment)
+(defun customize-set-variable (variable value &optional comment)
"Set the default for VARIABLE to VALUE. VALUE is a Lisp object.
If VARIABLE has a `custom-set' property, that is used for setting
(interactive (custom-prompt-variable "Set variable: "
"Set customized value for %s to: "
current-prefix-arg))
- (funcall (or (get var 'custom-set) 'set-default) var val)
- (put var 'customized-value (list (custom-quote val)))
+ (funcall (or (get variable 'custom-set) 'set-default) variable value)
+ (put variable 'customized-value (list (custom-quote value)))
(cond ((string= comment "")
- (put var 'variable-comment nil)
- (put var 'customized-variable-comment nil))
+ (put variable 'variable-comment nil)
+ (put variable 'customized-variable-comment nil))
(comment
- (put var 'variable-comment comment)
- (put var 'customized-variable-comment comment))))
+ (put variable 'variable-comment comment)
+ (put variable 'customized-variable-comment comment))))
;;;###autoload
-(defun customize-save-variable (var val &optional comment)
+(defun customize-save-variable (var value &optional comment)
"Set the default for VARIABLE to VALUE, and save it for future sessions.
If VARIABLE has a `custom-set' property, that is used for setting
VARIABLE, otherwise `set-default' is used.
(interactive (custom-prompt-variable "Set and ave variable: "
"Set and save value for %s as: "
current-prefix-arg))
- (funcall (or (get var 'custom-set) 'set-default) var val)
- (put var 'saved-value (list (custom-quote val)))
+ (funcall (or (get var 'custom-set) 'set-default) var value)
+ (put var 'saved-value (list (custom-quote value)))
(cond ((string= comment "")
(put var 'variable-comment nil)
(put var 'saved-variable-comment nil))
;;;###autoload
(defun customize-face-other-window (&optional symbol)
- "Show customization buffer for FACE in other window."
+ "Show customization buffer for face SYMBOL in other window."
(interactive (list (completing-read "Customize face: "
obarray 'custom-facep t)))
(if (or (null symbol) (and (stringp symbol) (zerop (length symbol))))
'hidden)))
(defun custom-magic-value-create (widget)
- ;; Create compact status report for WIDGET.
+ "Create compact status report for WIDGET."
(let* ((parent (widget-get widget :parent))
(state (widget-get parent :custom-state))
(hidden (eq state 'hidden))
:match (lambda (widget value) (symbolp value)))
(defun custom-convert-widget (widget)
- ;; Initialize :value and :tag from :args in WIDGET.
+ "Initialize :value and :tag from :args in WIDGET."
(let ((args (widget-get widget :args)))
(when args
(widget-put widget :value (widget-apply widget
;;; The `custom-variable' Widget.
-(defface custom-variable-tag-face '((((class color)
+;; When this was underlined blue, users confused it with a
+;; Mosaic-style hyperlink...
+(defface custom-variable-tag-face `((((class color)
(background dark))
- (:foreground "light blue" :underline t))
+ (:foreground "light blue"
+ :bold t
+ :family "helv"
+ :height ,(floor (face-attribute
+ 'default :height) 0.9)))
(((class color)
(background light))
- (:foreground "blue" :underline t))
- (t (:underline t)))
+ (:foreground "blue" :family "helv"
+ :bold t
+ :height ,(floor (face-attribute
+ 'default :height) 0.9)))
+ (t (:bold t)))
"Face used for unpushable variable tags."
:group 'custom-faces)
(custom-redraw widget))
(defun custom-variable-edit-lisp (widget)
- "Edit the lisp representation of the value of WIDGET."
+ "Edit the Lisp representation of the value of WIDGET."
(widget-put widget :custom-state 'unknown)
(widget-put widget :custom-form 'lisp)
(custom-redraw widget))
;;; The `custom-face' Widget.
-(defface custom-face-tag-face '((t (:underline t)))
+(defface custom-face-tag-face `((t (:bold t :family "helv"
+ :height ,(floor (face-attribute
+ 'default :height) 0.9))))
"Face used for face tags."
:group 'custom-faces)
(custom-redraw widget))
(defun custom-face-edit-lisp (widget)
- "Edit the lisp representation of the value of WIDGET."
+ "Edit the Lisp representation of the value of WIDGET."
(widget-put widget :custom-state 'unknown)
(widget-put widget :custom-form 'lisp)
(custom-redraw widget))
:match '(lambda (widget value) (symbolp value)))
(defun widget-face-value-create (widget)
- ;; Create a `custom-face' child.
+ "Create a `custom-face' child."
(let* ((symbol (widget-value widget))
(custom-buffer-style 'face)
(child (widget-create-child-and-convert
(widget-put widget :children (list child))))
(defun widget-face-value-delete (widget)
- ;; Remove the child from the options.
+ "Remove the child from the options."
(let ((child (car (widget-get widget :children))))
(setq custom-options (delq child custom-options))
(widget-children-value-delete widget)))
:match (lambda (widget value)
(or (symbolp value)
(widget-group-match widget value)))
+ ;; Avoid adding undefined functions to the hook, especially for
+ ;; things like `find-file-hook' or even more basic ones, to avoid
+ ;; chaos.
+ :set (lambda (symbol value)
+ (mapc (lambda (elt)
+ (if (fboundp elt)
+ (add-hook symbol elt)))
+ value))
:convert-widget 'custom-hook-convert-widget
:tag "Hook")
:type '(repeat face)
:group 'custom-faces)
-(defface custom-group-tag-face-1 '((((class color)
+(defface custom-group-tag-face-1 `((((class color)
(background dark))
- (:foreground "pink" :underline t))
+ (:foreground "pink" :family "helv"
+ :height ,(floor (face-attribute
+ 'default :height) 0.9)
+ :bold t))
(((class color)
(background light))
- (:foreground "red" :underline t))
- (t (:underline t)))
+ (:foreground "red" :bold t
+ :height ,(floor (face-attribute
+ 'default :height) 0.9)))
+ (t (:bold t)))
"Face used for group tags.")
-(defface custom-group-tag-face '((((class color)
+(defface custom-group-tag-face `((((class color)
(background dark))
- (:foreground "light blue" :underline t))
+ (:foreground "light blue" :bold t
+ :height ,(floor (face-attribute
+ 'default :height) 0.9)))
(((class color)
(background light))
- (:foreground "blue" :underline t))
- (t (:underline t)))
+ (:foreground "blue" :bold t
+ :height ,(floor (face-attribute
+ 'default :height) 0.9)))
+ (t (:bold t)))
"Face used for low level group tags."
:group 'custom-faces)
(add-hook 'widget-edit-functions 'custom-state-buffer-message nil t)
(run-hooks 'custom-mode-hook))
+(add-to-list
+ 'debug-ignored-errors
+ "^No user options have changed defaults in recent Emacs versions$")
+
;;; The End.
(provide 'cus-edit)