From: Stefan Monnier Date: Wed, 25 Apr 2001 15:22:53 +0000 (+0000) Subject: (modify-face): Add compatibility for non-interactive use. X-Git-Tag: emacs-pretest-21.0.103~117 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7cd512f22f12d22e29a35aafceab613e5aefadee;p=emacs.git (modify-face): Add compatibility for non-interactive use. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 71ee463a5b1..f22a1d6e597 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2001-04-25 Stefan Monnier + + * faces.el (modify-face): Add compatibility for non-interactive use. + 2001-04-24 John Wiegley * eshell/esh-cmd.el (eshell-find-alias-function): Corrected the @@ -34,11 +38,9 @@ * eshell/eshell.el (eshell-command): Made a few changes so that `eshell-command' could be called programmatically. - * eshell/esh-mode.el: Moved `eshell-non-interactive-p' to - eshell.el. + * eshell/esh-mode.el (eshell-non-interactive-p): Moved to eshell.el. - * eshell/eshell.el (eshell-non-interactive-p): Moved this variable - here. + * eshell/eshell.el (eshell-non-interactive-p): Moved from esh-mode.el. 2001-04-23 John Wiegley @@ -59,16 +61,16 @@ 2001-04-23 Eli Zaretskii * calendar/calendar.el (diary-entry-marker) - (calendar-today-marker, calendar-holiday-marker): Use - display-color-p instead of window-system. + (calendar-today-marker, calendar-holiday-marker): + Use display-color-p instead of window-system. (calendar-mode-map, calendar-mode): Use display-popup-menus-p instead of window-system. (calendar-hide-window): Use display-multi-frame-p instead of window-system. * calendar/cal-x.el (calendar-two-frame-setup) - (calendar-only-one-frame-setup, calendar-one-frame-setup): Use - display-multi-frame-p instead of window-system. + (calendar-only-one-frame-setup, calendar-one-frame-setup): + Use display-multi-frame-p instead of window-system. 2001-04-23 Gerd Moellmann @@ -80,14 +82,12 @@ 2001-04-23 Alex Schroeder * goto-addr.el: Instead of defining line-beginning-position and - line-end-position a defalias is used for point-at-bol and - point-at-eol. - + line-end-position a defalias is used for point-at-bol and point-at-eol. + 2001-04-23 Alex Schroeder * goto-addr.el: Added XEmacs compatibility code. - (goto-address-highlight-keymap): Made keybindings XEmacs - compatible. + (goto-address-highlight-keymap): Made keybindings XEmacs compatible. 2001-04-22 Eli Zaretskii @@ -96,8 +96,7 @@ 2001-04-20 Alex Schroeder * sql.el (sql-escape-newlines-and-send): New function. - (sql-db2): Set comint-input-sender to - sql-escape-newlines-and-send. + (sql-db2): Set comint-input-sender to sql-escape-newlines-and-send. 2001-04-20 Alex Schroeder diff --git a/lisp/faces.el b/lisp/faces.el index 67576035930..d27da784bf1 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -966,22 +966,34 @@ Value is a property list of attribute names and new values." result)))))) -(defun modify-face (&optional frame) +(defun modify-face (&optional face foreground background stipple + bold-p italic-p underline-p inverse-p frame) "Modify attributes of faces interactively. If optional argument FRAME is nil or omitted, modify the face used -for newly created frame, i.e. the global face." +for newly created frame, i.e. the global face. +For non-interactive use, `set-face-attribute' is preferred. +When called from elisp, if FACE is nil, all arguments but FRAME are ignored +and the face and its settings are obtained by querying the user." (interactive) - (let ((face (read-face-name "Modify face"))) + (if face + (set-face-attribute face frame + :foreground (or foreground 'unspecified) + :background (or background 'unspecified) + :stipple stipple + :bold bold-p + :italic italic-p + :underline underline-p + :inverse-video inverse-p) + (setq face (read-face-name "Modify face")) (apply #'set-face-attribute face frame (read-all-face-attributes face frame)))) - (defun read-face-and-attribute (attribute &optional frame) "Read face name and face attribute value. ATTRIBUTE is the attribute whose new value is read. FRAME nil or unspecified means read attribute value of global face. Value is a list (FACE NEW-VALUE) where FACE is the face read -(a symbol), and NEW-VALUE is value read." +\(a symbol), and NEW-VALUE is value read." (cond ((eq attribute :font) (let* ((prompt "Set font-related attributes of face") (face (read-face-name prompt)) @@ -1273,7 +1285,7 @@ If there is no default for FACE, return nil." (defsubst face-user-default-spec (face) "Return the user's customized face-spec for FACE, or the default if none. -If there is neither a user setting or a default for FACE, return nil." +If there is neither a user setting nor a default for FACE, return nil." (or (get face 'saved-face) (face-default-spec face)))