From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#10181: 24.0.92; [wishlist] split `diff-refine-change' in several faces Date: Fri, 25 May 2012 03:57:49 +0300 Organization: JURTA Message-ID: <87likhdqni.fsf@mail.jurta.org> References: <87txzftzn0.fsf@mail.jurta.org> <87396yxr9u.fsf@mail.jurta.org> <87d361w2ea.fsf@mail.jurta.org> <87aa13k9o1.fsf@mail.jurta.org> <87k406uz7n.fsf@mail.jurta.org> <878vgj7k6l.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1337907736 23229 80.91.229.3 (25 May 2012 01:02:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 25 May 2012 01:02:16 +0000 (UTC) Cc: 10181@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 25 03:02:15 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SXiux-0003Hb-MY for geb-bug-gnu-emacs@m.gmane.org; Fri, 25 May 2012 03:02:11 +0200 Original-Received: from localhost ([::1]:59055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXiuw-0006ob-VF for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 May 2012 21:02:10 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXiuu-0006oT-3y for bug-gnu-emacs@gnu.org; Thu, 24 May 2012 21:02:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXiur-0004Rf-1G for bug-gnu-emacs@gnu.org; Thu, 24 May 2012 21:02:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXiuq-0004RL-Tu for bug-gnu-emacs@gnu.org; Thu, 24 May 2012 21:02:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SXivm-0005I3-3H for bug-gnu-emacs@gnu.org; Thu, 24 May 2012 21:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 25 May 2012 01:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10181 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10181-submit@debbugs.gnu.org id=B10181.133790774120286 (code B ref 10181); Fri, 25 May 2012 01:03:01 +0000 Original-Received: (at 10181) by debbugs.gnu.org; 25 May 2012 01:02:21 +0000 Original-Received: from localhost ([127.0.0.1]:42655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SXiv6-0005H9-Uy for submit@debbugs.gnu.org; Thu, 24 May 2012 21:02:21 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:33019 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SXium-0005GS-53 for 10181@debbugs.gnu.org; Thu, 24 May 2012 21:02:19 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 4D08E451CA0E; Thu, 24 May 2012 18:01:00 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Wed, 23 May 2012 09:53:09 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:60343 Archived-At: >>> 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"))) "...")