* emacs-lisp/lisp-mode.el (eval-defun-1): Update the documentation

of faces when `M-C-x'-ing their definitions.  Also
clean up the code slightly.

Fixes: debbugs:8378
This commit is contained in:
Lars Magne Ingebrigtsen 2011-07-06 18:46:27 +02:00
parent aa8a705c16
commit f4f7319875
2 changed files with 23 additions and 19 deletions

View file

@ -10,6 +10,10 @@
2011-07-06 Lars Magne Ingebrigtsen <larsi@gnus.org> 2011-07-06 Lars Magne Ingebrigtsen <larsi@gnus.org>
* emacs-lisp/lisp-mode.el (eval-defun-1): Update the documentation
of faces when `M-C-x'-ing their definitions (bug#8378). Also
clean up the code slightly.
* progmodes/grep.el (rgrep): Don't bind `process-connection-type', * progmodes/grep.el (rgrep): Don't bind `process-connection-type',
because that makes the colours go away. because that makes the colours go away.

View file

@ -789,25 +789,25 @@ Reinitialize the face according to the `defface' specification."
;; `defface' is macroexpanded to `custom-declare-face'. ;; `defface' is macroexpanded to `custom-declare-face'.
((eq (car form) 'custom-declare-face) ((eq (car form) 'custom-declare-face)
;; Reset the face. ;; Reset the face.
(setq face-new-frame-defaults (let ((face-symbol (eval (nth 1 form) lexical-binding)))
(assq-delete-all (eval (nth 1 form) lexical-binding) (setq face-new-frame-defaults
face-new-frame-defaults)) (assq-delete-all face-symbol face-new-frame-defaults))
(put (eval (nth 1 form) lexical-binding) 'face-defface-spec nil) (put face-symbol 'face-defface-spec nil)
;; Setting `customized-face' to the new spec after calling (put face-symbol 'face-documentation (nth 3 form))
;; the form, but preserving the old saved spec in `saved-face', ;; Setting `customized-face' to the new spec after calling
;; imitates the situation when the new face spec is set ;; the form, but preserving the old saved spec in `saved-face',
;; temporarily for the current session in the customize ;; imitates the situation when the new face spec is set
;; buffer, thus allowing `face-user-default-spec' to use the ;; temporarily for the current session in the customize
;; new customized spec instead of the saved spec. ;; buffer, thus allowing `face-user-default-spec' to use the
;; Resetting `saved-face' temporarily to nil is needed to let ;; new customized spec instead of the saved spec.
;; `defface' change the spec, regardless of a saved spec. ;; Resetting `saved-face' temporarily to nil is needed to let
(prog1 `(prog1 ,form ;; `defface' change the spec, regardless of a saved spec.
(put ,(nth 1 form) 'saved-face (prog1 `(prog1 ,form
',(get (eval (nth 1 form) lexical-binding) (put ,(nth 1 form) 'saved-face
'saved-face)) ',(get face-symbol 'saved-face))
(put ,(nth 1 form) 'customized-face (put ,(nth 1 form) 'customized-face
,(nth 2 form))) ,(nth 2 form)))
(put (eval (nth 1 form) lexical-binding) 'saved-face nil))) (put face-symbol 'saved-face nil))))
((eq (car form) 'progn) ((eq (car form) 'progn)
(cons 'progn (mapcar 'eval-defun-1 (cdr form)))) (cons 'progn (mapcar 'eval-defun-1 (cdr form))))
(t form))) (t form)))