[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Juri Linkov
Subject: bug#10181: 24.0.92; [wishlist] split `diff-refine-change' in several faces
Date: Fri, 25 May 2012 03:57:49 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu)

>>> Please introduce a defvar for it, so we don't re-evaluate the face
>>> comparison for each and every line.
>> This defvar needs to be re-evaluated when the user customized faces.
> Which rarely happens after loading diff-mode.el, so I wouldn't worry
> about it.  That also lets the user set the variable explicitly if she
> wants to (after all, the faces can be different in one frame but
> equal in another, so the above test is not 100% foolproof anyway).

So I added this condition to the defvar.

> The rest of the patch looks OK,

Installed, with face adjustments in diff-mode, smerge and ediff.

I tested all face changes in different environments: high-color X11 with
light/dark background and 8-color xterm with light/dark background.

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"))) "...")

reply via email to

[Prev in Thread] Current Thread [Next in Thread]