瀏覽代碼

Fix regression in priority fontification

* lisp/org-agenda.el (org-agenda-fontify-priorities):
* lisp/org.el (org-font-lock-add-priority-faces): Fontify up to the
end of the closing bracket of the priority, as was the case before
v9.4.

7b1077def (Tiny enhancements to priority handling, 2020-01-30)
switched org-agenda-fontify-priorities and
org-font-lock-add-priority-faces over to using org-priority-regexp
rather than inline regexps.  For the inline regexps, the first group
ended at the closing bracket, but the first group in
org-priority-regexp includes an optional space, leading to the face
extending one character too far.

Restore the bound to the closing bracket by determining the bound
based on the second group, the priority label, instead.

Reported-by: Roman Rudakov <rrudakov@pm.me>
Helped-by: Protesilaos Stavrou <info@protesilaos.com>
Ref: https://orgmode.org/list/87r1r2kh77.fsf@pm.me
Kyle Meyer 4 年之前
父節點
當前提交
b1de0c8e4b
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      lisp/org-agenda.el
  2. 1 1
      lisp/org.el

+ 1 - 1
lisp/org-agenda.el

@@ -3987,7 +3987,7 @@ agenda display, configure `org-agenda-finalize-hook'."
 	      p (string-to-char (match-string 2))
 	      b (match-beginning 1)
 	      e (if (eq org-agenda-fontify-priorities 'cookies)
-		    (match-end 1)
+		    (1+ (match-end 2))
 		  (point-at-eol))
 	      ov (make-overlay b e))
 	(overlay-put

+ 1 - 1
lisp/org.el

@@ -5843,7 +5843,7 @@ If TAG is a number, get the corresponding match group."
   "Add the special priority faces."
   (while (re-search-forward org-priority-regexp limit t)
     (add-text-properties
-     (match-beginning 1) (match-end 1)
+     (match-beginning 1) (1+ (match-end 2))
      (list 'face (org-get-priority-face (string-to-char (match-string 2)))
 	   'font-lock-fontified t))))