branch: elpa/magit
commit ba03ed6d6b85f4a3839e55abd9f3f7c295548421
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    magit-section-highlight-range: Tweak renamed function
    
    Now that this isn't used for the selection anymore, just section
    highlighting, rename it accordingly.  Do not use "region" in the
    name to avoid confusing it with `magit-section--highlight-region'
    which highlights *the* region.
    
    Make FACE optional and default to `magit-section-highlight'.
---
 lisp/git-rebase.el    |  4 ++--
 lisp/magit-diff.el    |  6 +++---
 lisp/magit-section.el | 16 +++++++---------
 3 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/lisp/git-rebase.el b/lisp/git-rebase.el
index 8213f15faa..65441f89fc 100644
--- a/lisp/git-rebase.el
+++ b/lisp/git-rebase.el
@@ -444,8 +444,8 @@ current line."
         (bounds (git-rebase-region-bounds)))
     (mapc #'delete-overlay magit-section-highlight-overlays)
     (when bounds
-      (magit-section-make-overlay (car bounds) (cadr bounds)
-                                  'magit-section-heading-selection))
+      (magit-section-highlight-range (car bounds) (cadr bounds)
+                                     'magit-section-heading-selection))
     (if (and bounds (not magit-section-keep-region-overlay))
         (funcall (default-value 'redisplay-unhighlight-region-function) rol)
       (funcall (default-value 'redisplay-highlight-region-function)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 30502aaa92..40ecf29c02 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -3319,7 +3319,7 @@ are highlighted."
         (unless selection
           (unless (and (region-active-p)
                        (<= (region-beginning) beg))
-            (magit-section-make-overlay beg cnt 'magit-section-highlight))
+            (magit-section-highlight-range beg cnt))
           (if (oref section hidden)
               (oset section washer #'ignore)
             (dolist (child (oref section children))
@@ -3329,7 +3329,7 @@ are highlighted."
                                       (oref child start)))))
                 (magit-diff-highlight-recursive child selection)))))
         (when magit-diff-highlight-hunk-body
-          (magit-section-make-overlay (1- end) end 'magit-section-highlight)))
+          (magit-section-highlight-range (1- end) end)))
     (magit-section-highlight section nil)))
 
 (defun magit-diff-highlight-file (section &optional selection)
@@ -3340,7 +3340,7 @@ are highlighted."
       (magit-diff-highlight-recursive child selection))))
 
 (defun magit-diff-highlight-heading (section &optional selection)
-  (magit-section-make-overlay
+  (magit-section-highlight-range
    (oref section start)
    (or (oref section content)
        (oref section end))
diff --git a/lisp/magit-section.el b/lisp/magit-section.el
index 52306fcee9..bf5ad34094 100644
--- a/lisp/magit-section.el
+++ b/lisp/magit-section.el
@@ -1753,20 +1753,18 @@ effects for diff related sections, which by default are
 highlighted using `magit-diff-highlight'.  Return t."
   (when-let ((face (oref section heading-highlight-face)))
     (dolist (section (or selection (list section)))
-      (magit-section-make-overlay
+      (magit-section-highlight-range
        (oref section start)
        (or (oref section content)
            (oref section end))
        face)))
   (cond (selection
-         (magit-section-make-overlay (oref (car selection) start)
-                                     (oref (car (last selection)) end)
-                                     'magit-section-highlight)
+         (magit-section-highlight-range (oref (car selection) start)
+                                     (oref (car (last selection)) end))
          (magit-section-highlight-selection nil selection))
         (t
-         (magit-section-make-overlay (oref section start)
-                                     (oref section end)
-                                     'magit-section-highlight)))
+         (magit-section-highlight-range (oref section start)
+                                     (oref section end))))
   t)
 
 (defun magit-section-highlight-selection (_ selection)
@@ -1794,9 +1792,9 @@ invisible."
           ov)))
     t))
 
-(defun magit-section-make-overlay (start end face)
+(defun magit-section-highlight-range (start end &optional face)
   (let ((ov (make-overlay start end nil t)))
-    (overlay-put ov 'font-lock-face face)
+    (overlay-put ov 'font-lock-face (or face 'magit-section-highlight))
     (overlay-put ov 'evaporate t)
     (push ov magit-section-highlight-overlays)
     ov))

Reply via email to