branch: elpa/magit
commit 46c3d8b0ad0a7e583fc382243ab84b95a1d2da52
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-insert-revision-{message,notes}: Set background for whole heading
---
lisp/magit-diff.el | 6 ++++--
lisp/magit-section.el | 17 +++++++++++++++--
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 6eabd5345a3..0ba0ce5d89a 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -2716,7 +2716,8 @@ or a ref which is not a branch, then it inserts nothing."
(save-excursion
(magit--add-face-text-property (point)
(progn (forward-line) (point))
- 'magit-diff-revision-summary)
+ 'magit-diff-revision-summary
+ t nil t)
(magit-insert-heading))
(goto-char (point-max)))
(insert "(no message)\n"))))
@@ -2745,7 +2746,8 @@ or a ref which is not a branch, then it inserts nothing."
'font-lock-face 'magit-refname))))
(magit--add-face-text-property (point)
(progn (forward-line) (point))
- 'magit-diff-revision-summary)
+ 'magit-diff-revision-summary
+ t nil t)
(magit-insert-heading)
(goto-char (point-max))
(insert ?\n))))))
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 49d4a4603b3..d1b8d2949ba 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -2257,11 +2257,24 @@ Configuration'."
(throw 'missing nil))))
(not pos))))
-(defun magit--add-face-text-property (beg end face &optional append object)
- "Like `add-face-text-property' but for `font-lock-face'."
+(defun magit--add-face-text-property ( beg end face
+ &optional append object adopt-face)
+ "Like `add-face-text-property' but for `font-lock-face'.
+If optional ADOPT-FACE, the replace `face' with `font-lock-face'
+first. This is a hack, which is likely to be remove again."
(when (stringp object)
(unless beg (setq beg 0))
(unless end (setq end (length object))))
+ (when adopt-face
+ (let ((beg beg)
+ (end end))
+ (while (< beg end)
+ (let ((pos (next-single-property-change beg 'face object end))
+ (val (get-text-property beg 'face object)))
+ ;; We simply assume font-lock-face is not also set.
+ (put-text-property beg pos 'font-lock-face val object)
+ (remove-list-of-text-properties beg pos '(face) object)
+ (setq beg pos)))))
(while (< beg end)
(let* ((pos (next-single-property-change beg 'font-lock-face object end))
(val (get-text-property beg 'font-lock-face object))