aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2025-05-29 19:52:20 +0300
committerJuri Linkov2025-05-29 19:52:20 +0300
commitc9cb89edd500e8a142a7e7cc44a4f8335795d038 (patch)
tree1734869e22ec1ffc8a54259699a088afaa9edc0a
parentf9b311464db2e1cc34faaf2c86a9c46216337013 (diff)
downloademacs-c9cb89edd500e8a142a7e7cc44a4f8335795d038.tar.gz
emacs-c9cb89edd500e8a142a7e7cc44a4f8335795d038.zip
Use 'outline-heading-end-regexp' consistently.
* lisp/outline.el (outline-font-lock-keywords): For non-nil 'outline-search-function' also search for 'outline-heading-end-regexp' afterwards like there is 'outline-heading-end-regexp' at the end of the regexp counterpart. (outline-minor-mode-highlight-buffer): Use 'outline-heading-end-regexp' like in 'outline-font-lock-keywords' instead of "$". For non-nil 'outline-search-function' also use 'outline-heading-end-regexp' the same way. * lisp/help.el (describe-bindings): Remove unnecessary buffer-local 'outline-heading-end-regexp'.
-rw-r--r--lisp/help.el1
-rw-r--r--lisp/outline.el26
2 files changed, 18 insertions, 9 deletions
diff --git a/lisp/help.el b/lisp/help.el
index 49394fea2cd..8b29a10e0cf 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -793,7 +793,6 @@ or a buffer name."
793 793
794 (when describe-bindings-outline 794 (when describe-bindings-outline
795 (setq-local outline-regexp ".*:$") 795 (setq-local outline-regexp ".*:$")
796 (setq-local outline-heading-end-regexp ":\n")
797 (setq-local outline-level (lambda () 1)) 796 (setq-local outline-level (lambda () 1))
798 (setq-local outline-minor-mode-cycle t 797 (setq-local outline-minor-mode-cycle t
799 outline-minor-mode-highlight t 798 outline-minor-mode-highlight t
diff --git a/lisp/outline.el b/lisp/outline.el
index 61e9b0f3289..9d453881b7e 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -259,14 +259,19 @@ non-nil and point is located on the heading line.")
259 map)) 259 map))
260 260
261(defvar outline-font-lock-keywords 261(defvar outline-font-lock-keywords
262 '( 262 `(
263 ;; Highlight headings according to the level. 263 ;; Highlight headings according to the level.
264 (eval . (list (or (when outline-search-function 264 (eval . (list (or (when outline-search-function
265 (lambda (limit) 265 ,(lambda (limit)
266 (when-let* ((ret (funcall outline-search-function limit))) 266 (when-let* ((ret (funcall outline-search-function limit)))
267 ;; This is equivalent to adding ".*" in the regexp below. 267 ;; This is equivalent to adding ".*" in the regexp below.
268 (set-match-data (list (match-beginning 0) (pos-eol))) 268 (set-match-data
269 ret))) 269 (list (match-beginning 0)
270 (save-excursion
271 (save-match-data
272 (re-search-forward
273 (concat ".*" outline-heading-end-regexp) nil t)))))
274 ret)))
270 (concat "^\\(?:" outline-regexp "\\).*" outline-heading-end-regexp)) 275 (concat "^\\(?:" outline-regexp "\\).*" outline-heading-end-regexp))
271 0 '(if outline-minor-mode 276 0 '(if outline-minor-mode
272 (if outline-minor-mode-highlight 277 (if outline-minor-mode-highlight
@@ -520,11 +525,16 @@ outline font-lock faces to those of major mode."
520 (save-excursion 525 (save-excursion
521 (goto-char (point-min)) 526 (goto-char (point-min))
522 (let ((regexp (unless outline-search-function 527 (let ((regexp (unless outline-search-function
523 (concat "^\\(?:" outline-regexp "\\).*$")))) 528 (concat "^\\(?:" outline-regexp "\\).*" outline-heading-end-regexp))))
524 (while (if outline-search-function 529 (while (if outline-search-function
525 (when-let* ((ret (funcall outline-search-function))) 530 (when-let* ((ret (funcall outline-search-function)))
526 ;; This is equivalent to adding ".*" in the regexp above. 531 ;; This is equivalent to adding ".*" in the regexp above.
527 (set-match-data (list (match-beginning 0) (pos-eol))) 532 (set-match-data
533 (list (match-beginning 0)
534 (save-excursion
535 (save-match-data
536 (re-search-forward
537 (concat ".*" outline-heading-end-regexp) nil t)))))
528 ret) 538 ret)
529 (re-search-forward regexp nil t)) 539 (re-search-forward regexp nil t))
530 (let ((overlay (make-overlay (match-beginning 0) (match-end 0)))) 540 (let ((overlay (make-overlay (match-beginning 0) (match-end 0))))