emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r116011: * lisp/vc/log-edit.el: Fix highlighting of


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r116011: * lisp/vc/log-edit.el: Fix highlighting of summary when it's the first line.
Date: Mon, 13 Jan 2014 15:33:05 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116011
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2014-01-13 10:33:01 -0500
message:
  * lisp/vc/log-edit.el: Fix highlighting of summary when it's the first line.
  (log-edit--match-first-line): New function.
  (log-edit-font-lock-keywords): Use it.
  (log-edit-mode): Make jit-lock-defer-multiline work.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/vc/log-edit.el            logedit.el-20091113204419-o5vbwnq5f7feedwu-1776
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-01-13 10:55:22 +0000
+++ b/lisp/ChangeLog    2014-01-13 15:33:01 +0000
@@ -1,3 +1,10 @@
+2014-01-13  Stefan Monnier  <address@hidden>
+
+       * vc/log-edit.el: Fix highlighting of summary when it's the first line.
+       (log-edit--match-first-line): New function.
+       (log-edit-font-lock-keywords): Use it.
+       (log-edit-mode): Make jit-lock-defer-multiline work.
+
 2014-01-13  Bastien Guerry  <address@hidden>
 
        * rect.el (rectangle-mark-mode): When the region is not active,
@@ -19,8 +26,8 @@
 2014-01-13  Martin Rudalics  <address@hidden>
 
        fit-frame/window-to-buffer code fixes including one for Bug#14096.
-       * window.el (fit-frame-to-buffer): Fix doc-string.  Respect
-       window-min-height/-width.  Fit pixelwise when
+       * window.el (fit-frame-to-buffer): Fix doc-string.
+       Respect window-min-height/-width.  Fit pixelwise when
        frame-resize-pixelwise is non-nil.  Adjust right/bottom edge
        when avoiding that frame goes partially off-screen.
        (fit-window-to-buffer): Respect window-min-height/-width

=== modified file 'lisp/vc/log-edit.el'
--- a/lisp/vc/log-edit.el       2014-01-01 07:43:34 +0000
+++ b/lisp/vc/log-edit.el       2014-01-13 15:33:01 +0000
@@ -355,6 +355,21 @@
       (set-match-data (list start (point)))
       (point))))
 
+(defun log-edit--match-first-line (limit)
+  (let ((start (point)))
+    (rfc822-goto-eoh)
+    (skip-chars-forward "\n")
+    (and (< start (line-end-position))
+         (< (point) limit)
+         (save-excursion
+           (not (re-search-backward "^Summary:[ \t]*[^ \t\n]" nil t)))
+         (looking-at ".+")
+         (progn
+           (goto-char (match-end 0))
+           (put-text-property (point-min) (point)
+                              'jit-lock-defer-multiline t)
+           (point)))))
+
 (defvar log-edit-font-lock-keywords
   ;; Copied/inspired by message-font-lock-keywords.
   `((log-edit-match-to-eoh
@@ -370,7 +385,8 @@
          nil lax))
      ("^\n"
       (progn (goto-char (match-end 0)) (1+ (match-end 0))) nil
-      (0 '(:height 0.1 :inverse-video t))))))
+      (0 '(:height 0.1 :inverse-video t))))
+    (log-edit--match-first-line (0 'log-edit-summary))))
 
 (defvar log-edit-font-lock-gnu-style nil
   "If non-nil, highlight common failures to follow the GNU coding standards.")
@@ -473,6 +489,7 @@
 \\{log-edit-mode-map}"
   (set (make-local-variable 'font-lock-defaults)
        '(log-edit-font-lock-keywords t))
+  (setq-local jit-lock-contextually t)  ;For the "first line is summary".
   (make-local-variable 'log-edit-comment-ring-index)
   (add-hook 'kill-buffer-hook 'log-edit-remember-comment nil t)
   (hack-dir-local-variables-non-file-buffer))


reply via email to

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