Subject: Re: bug#10181: 24.0.92; [wishlist] split `diff-refine-change' in several faces

From: Stefan Monnier <[email-masked]>
Date: Fri, 25 May 2012 09:21:02 -0400

> During testing I noticed that `C-M-x' doesn't work anymore on `defface'.
> It doesn't re-evaluate the face definition because `eval-sexp-add-defvars'
> in `eval-defun-2' produces an expression that can't be macroexpanded.
> For instance:

> (setq form (eval-sexp-add-defvars (read (current-buffer))))
> =>
> (progn (defvar add-log-buffer-file-name-function)
>        (defface diff-removed (quote ((((class color)) :background "red"))) "..."))

> (macroexpand form)
> =>
> (progn (defvar add-log-buffer-file-name-function)
>        (defface diff-removed (quote ((((class color)) :background "red"))) "..."))

> The problem is that `eval-sexp-add-defvars' adds `progn' that prevents
> defface macro expansion.  `macroexpand' can't expand `defface' to
> `custom-declare-face' (this is expected in `eval-defun-1').

> Without `progn', `macroexpand' works correctly, e.g.:

> (macroexpand '(defface diff-removed (quote ((((class color)) :background "red"))) "..."))
> =>
> (custom-declare-face (quote diff-removed) (quote ((((class color)) :background "red"))) "...")

Good point.  We should change eval-defun-1 to look inside `progn'.
Or alternatively, we should use eval-sexp-add-defvars after the
macroexpand+specialcaseing.

        Stefan