emacs-devel
[Top][All Lists]
Advanced

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

Re: master c430f7e breaks diff-mode fontification


From: Stephen Berman
Subject: Re: master c430f7e breaks diff-mode fontification
Date: Mon, 27 Jun 2016 17:01:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

On Mon, 27 Jun 2016 11:22:50 +0200 Stephen Berman <address@hidden> wrote:

> This change breaks diff-mode fontification:
>
>> branch: master
>> commit c430f7e23fc2c22f251ace4254e37dea1452dfc3
>> Author: Mark Oteiza <address@hidden>
>> Commit: Mark Oteiza <address@hidden>
>>
>>     Remove some face aliases obsoleted in 22.1
>
> To reproduce (after git pull and make bootstrap):
>
> 0. emacs -Q
> 1. C-x v L RET <path to emacs master git root> RET
> 2. In the *vc-change-log* buffer type `d' on one of the entries.
> => The diff displayed in the *vc-diff* buffer lack the expected faces on
>    the removed and added lines, and the *Messages* buffer contains these
>    messages:
> Error during redisplay: (jit-lock-function 1) signaled (void-variable
> diff-hunk-header)
> Error during redisplay: (jit-lock-function 501) signaled (void-variable 
> diff-removed)
> Error during redisplay: (jit-lock-function 1001) signaled (void-variable
> diff-hunk-header)
> Error during redisplay: (jit-lock-function 1501) signaled (void-variable 
> diff-context)
>
> If prior to step 1 above I evaluate the file diff-mode.el from emacs-25
> (i.e. the version before the above commit), then after 2 the *vc-diff*
> buffer is fontified as expected and there no such error messages in 
> *Messages*.

The following patch fixes the breakage.  (I haven't yet gone through the
other files changed by commit c430f7e to see if there are similar
problems.)

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 43ff9e0..58498cb 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -371,22 +371,22 @@ diff-use-changed-face
 
 (defvar diff-font-lock-keywords
   `((,(concat "\\(" diff-hunk-header-re-unified "\\)\\(.*\\)$")
-     (1 diff-hunk-header) (6 diff-function))
+     (1 'diff-hunk-header) (6 'diff-function))
     ("^\\(\\*\\{15\\}\\)\\(.*\\)$"                        ;context
-     (1 diff-hunk-header) (2 diff-function))
-    ("^\\*\\*\\* .+ \\*\\*\\*\\*". diff-hunk-header) ;context
-    (,diff-context-mid-hunk-header-re . diff-hunk-header) ;context
-    ("^[0-9,]+[acd][0-9,]+$"     . diff-hunk-header) ;normal
-    ("^---$"                     . diff-hunk-header) ;normal
+     (1 'diff-hunk-header) (2 'diff-function))
+    ("^\\*\\*\\* .+ \\*\\*\\*\\*". 'diff-hunk-header) ;context
+    (,diff-context-mid-hunk-header-re . 'diff-hunk-header) ;context
+    ("^[0-9,]+[acd][0-9,]+$"     . 'diff-hunk-header) ;normal
+    ("^---$"                     . 'diff-hunk-header) ;normal
     ;; For file headers, accept files with spaces, but be careful to rule
     ;; out false-positives when matching hunk headers.
     ("^\\(---\\|\\+\\+\\+\\|\\*\\*\\*\\) \\([^\t\n]+?\\)\\(?:\t.*\\| 
\\(\\*\\*\\*\\*\\|----\\)\\)?\n"
-     (0 diff-header)
-     (2 (if (not (match-end 3)) diff-file-header) prepend))
+     (0 'diff-header)
+     (2 (if (not (match-end 3)) 'diff-file-header) prepend))
     ("^\\([-<]\\)\\(.*\n\\)"
-     (1 diff-indicator-removed-face) (2 diff-removed))
+     (1 diff-indicator-removed-face) (2 'diff-removed))
     ("^\\([+>]\\)\\(.*\n\\)"
-     (1 diff-indicator-added-face) (2 diff-added))
+     (1 diff-indicator-added-face) (2 'diff-added))
     ("^\\(!\\)\\(.*\n\\)"
      (1 (if diff-use-changed-face
            diff-indicator-changed-face
@@ -399,20 +399,20 @@ diff-font-lock-keywords
                  diff-indicator-added-face
                diff-indicator-removed-face)))))
      (2 (if diff-use-changed-face
-           diff-changed
+           'diff-changed
          ;; Otherwise, use the same method as above.
          (save-match-data
            (let ((limit (save-excursion (diff-beginning-of-hunk))))
              (if (save-excursion (re-search-backward 
diff-context-mid-hunk-header-re limit t))
-                 diff-added
-               diff-removed))))))
+                 'diff-added
+               'diff-removed))))))
     ("^\\(?:Index\\|revno\\): \\(.+\\).*\n"
-     (0 diff-header) (1 diff-index prepend))
-    ("^Only in .*\n" . diff-nonexistent)
+     (0 'diff-header) (1 'diff-index prepend))
+    ("^Only in .*\n" . 'diff-nonexistent)
     ("^\\(#\\)\\(.*\\)"
      (1 font-lock-comment-delimiter-face)
      (2 font-lock-comment-face))
-    ("^[^-=+*!<>#].*\n" (0 diff-context))))
+    ("^[^-=+*!<>#].*\n" (0 'diff-context))))
 
 (defconst diff-font-lock-defaults
   '(diff-font-lock-keywords t nil nil nil (font-lock-multiline . nil)))



reply via email to

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