(when describe-bindings-outline
(setq-local outline-regexp ".*:$")
- (setq-local outline-heading-end-regexp ":\n")
(setq-local outline-level (lambda () 1))
(setq-local outline-minor-mode-cycle t
outline-minor-mode-highlight t
map))
(defvar outline-font-lock-keywords
- '(
+ `(
;; Highlight headings according to the level.
(eval . (list (or (when outline-search-function
- (lambda (limit)
- (when-let* ((ret (funcall outline-search-function limit)))
- ;; This is equivalent to adding ".*" in the regexp below.
- (set-match-data (list (match-beginning 0) (pos-eol)))
- ret)))
+ ,(lambda (limit)
+ (when-let* ((ret (funcall outline-search-function limit)))
+ ;; This is equivalent to adding ".*" in the regexp below.
+ (set-match-data
+ (list (match-beginning 0)
+ (save-excursion
+ (save-match-data
+ (re-search-forward
+ (concat ".*" outline-heading-end-regexp) nil t)))))
+ ret)))
(concat "^\\(?:" outline-regexp "\\).*" outline-heading-end-regexp))
0 '(if outline-minor-mode
(if outline-minor-mode-highlight
(save-excursion
(goto-char (point-min))
(let ((regexp (unless outline-search-function
- (concat "^\\(?:" outline-regexp "\\).*$"))))
+ (concat "^\\(?:" outline-regexp "\\).*" outline-heading-end-regexp))))
(while (if outline-search-function
(when-let* ((ret (funcall outline-search-function)))
;; This is equivalent to adding ".*" in the regexp above.
- (set-match-data (list (match-beginning 0) (pos-eol)))
+ (set-match-data
+ (list (match-beginning 0)
+ (save-excursion
+ (save-match-data
+ (re-search-forward
+ (concat ".*" outline-heading-end-regexp) nil t)))))
ret)
(re-search-forward regexp nil t))
(let ((overlay (make-overlay (match-beginning 0) (match-end 0))))