From fbfc3bd31748015dfab9213ebedb99513a9cb2b9 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sat, 13 Mar 2021 23:33:14 +0200 Subject: [PATCH] Separate values 'override' and 'append' in 'outline-minor-mode-highlight' * lisp/outline.el (outline-font-lock-keywords): Handle 'override' and 'append' separately. (outline-minor-mode-highlight): Separate values 'override' and 'append'. (outline-minor-mode-highlight-buffer): Go to match-beginning before checking '(point)'. --- lisp/outline.el | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lisp/outline.el b/lisp/outline.el index b4d37b2207f..79029a6e5e7 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -207,9 +207,10 @@ in the file it applies to.") (list 'face nil 'keymap outline-mode-cycle-map))) (outline-font-lock-face)) - (when (and outline-minor-mode - (eq outline-minor-mode-highlight 'override)) - 'append) + (when outline-minor-mode + (pcase outline-minor-mode-highlight + ('override t) + ('append 'append))) t))) "Additional expressions to highlight in Outline mode.") @@ -340,10 +341,12 @@ Typing these keys anywhere outside heading lines uses their default bindings." Non-nil value works well only when outline font-lock keywords don't conflict with the major mode's font-lock keywords. When t, it puts outline faces only if there are no major mode's faces -on headings. When `override', it tries to append outline faces -to major mode's faces." +on headings. When `override', it completely overwrites major mode's +faces with outline faces. When `append', it tries to append outline +faces to major mode's faces." :type '(choice (const :tag "No highlighting" nil) - (const :tag "Append to major mode faces" override) + (const :tag "Overwrite major mode faces" override) + (const :tag "Append outline faces to major mode faces" append) (const :tag "Highlight separately from major mode faces" t)) :version "28.1") ;;;###autoload(put 'outline-minor-mode-highlight 'safe-local-variable 'booleanp) @@ -359,6 +362,7 @@ to major mode's faces." (overlay-put overlay 'outline-overlay t) (when (or (eq outline-minor-mode-highlight 'override) (and (eq outline-minor-mode-highlight t) + (goto-char (match-beginning 0)) (not (get-text-property (point) 'face)))) (overlay-put overlay 'face (outline-font-lock-face))) (when outline-minor-mode-cycle -- 2.39.2