comparison lisp/emacs-lisp/lisp-mode.el @ 63638:83144542b6da

(eval-defun-1): Set `saved-face' temporarily to nil before calling form. Set `customized-face' to the new spec after that.
author Juri Linkov <juri@jurta.org>
date Tue, 21 Jun 2005 15:59:33 +0000
parents a19780959d63
children 9c5c3700b037 b7da78284d4c
comparison
equal deleted inserted replaced
63637:de897c139738 63638:83144542b6da
615 (set-default (eval (nth 1 form)) (eval (nth 1 (nth 2 form)))) 615 (set-default (eval (nth 1 form)) (eval (nth 1 (nth 2 form))))
616 form) 616 form)
617 ;; `defface' is macroexpanded to `custom-declare-face'. 617 ;; `defface' is macroexpanded to `custom-declare-face'.
618 ((eq (car form) 'custom-declare-face) 618 ((eq (car form) 'custom-declare-face)
619 ;; Reset the face. 619 ;; Reset the face.
620 (put (eval (nth 1 form)) 'face-defface-spec nil)
621 (setq face-new-frame-defaults 620 (setq face-new-frame-defaults
622 (assq-delete-all (eval (nth 1 form)) face-new-frame-defaults)) 621 (assq-delete-all (eval (nth 1 form)) face-new-frame-defaults))
623 form) 622 (put (eval (nth 1 form)) 'face-defface-spec nil)
623 ;; Setting `customized-face' to the new spec after calling
624 ;; the form, but preserving the old saved spec in `saved-face',
625 ;; imitates the situation when the new face spec is set
626 ;; temporarily for the current session in the customize
627 ;; buffer, thus allowing `face-user-default-spec' to use the
628 ;; new customized spec instead of the saved spec.
629 ;; Resetting `saved-face' temporarily to nil is needed to let
630 ;; `defface' change the spec, regardless of a saved spec.
631 (prog1 `(prog1 ,form
632 (put ',(eval (nth 1 form)) 'saved-face
633 ',(get (eval (nth 1 form)) 'saved-face))
634 (put ',(eval (nth 1 form)) 'customized-face
635 ',(eval (nth 2 form))))
636 (put (eval (nth 1 form)) 'saved-face nil)))
624 ((eq (car form) 'progn) 637 ((eq (car form) 'progn)
625 (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) 638 (cons 'progn (mapcar 'eval-defun-1 (cdr form))))
626 (t form))) 639 (t form)))
627 640
628 (defun eval-defun-2 () 641 (defun eval-defun-2 ()