diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-01-13 10:33:01 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-01-13 10:33:01 -0500 |
commit | c055d654606334926c581fbf10829632d8f75c4b (patch) | |
tree | 62f8edf2d8ba21daa27f9c6fb5f75606ac9b870b /lisp | |
parent | 237166b329b828674a05704480c42ebe708b8be0 (diff) | |
download | emacs-c055d654606334926c581fbf10829632d8f75c4b.tar.gz |
* 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.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 11 | ||||
-rw-r--r-- | lisp/vc/log-edit.el | 19 |
2 files changed, 27 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c0b693340f5..dbba63d8d2c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2014-01-13 Stefan Monnier <monnier@iro.umontreal.ca> + + * 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 <bzg@gnu.org> * rect.el (rectangle-mark-mode): When the region is not active, @@ -19,8 +26,8 @@ 2014-01-13 Martin Rudalics <rudalics@gmx.at> 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 diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index c807cde8250..e1ce247ac41 100644 --- a/lisp/vc/log-edit.el +++ b/lisp/vc/log-edit.el @@ -355,6 +355,21 @@ The first subexpression is the actual text of the field.") (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 @@ The first subexpression is the actual text of the field.") 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 @@ commands (under C-x v for VC, for example). \\{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)) |