summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/outline.el21
-rw-r--r--lisp/textmodes/emacs-news-mode.el6
2 files changed, 15 insertions, 12 deletions
diff --git a/lisp/outline.el b/lisp/outline.el
index 3250b62f1e7..857ac9562fd 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -427,15 +427,14 @@ outline font-lock faces to those of major mode."
(goto-char (point-min))
(let ((regexp (concat "^\\(?:" outline-regexp "\\).*$")))
(while (re-search-forward regexp nil t)
- (let ((overlay (make-overlay (match-beginning 0)
- (match-end 0))))
+ (let ((overlay (make-overlay (match-beginning 0) (match-end 0))))
(overlay-put overlay 'outline-overlay t)
- (when (or (eq outline-minor-mode-highlight 'override)
+ ;; FIXME: Is it possible to override all underlying face attributes?
+ (when (or (memq outline-minor-mode-highlight '(append override))
(and (eq outline-minor-mode-highlight t)
- (goto-char (match-beginning 0))
- (not (get-text-property (point) 'face))))
+ (not (get-text-property (match-beginning 0) 'face))))
(overlay-put overlay 'face (outline-font-lock-face)))
- (when (and (outline--use-buttons-p) (outline-on-heading-p))
+ (when (outline--use-buttons-p)
(outline--insert-open-button)))
(goto-char (match-end 0))))))
@@ -452,10 +451,12 @@ See the command `outline-mode' for more information on this mode."
(if outline-minor-mode
(progn
(when outline-minor-mode-highlight
- (when (and global-font-lock-mode (font-lock-specified-p major-mode))
- (font-lock-add-keywords nil outline-font-lock-keywords t)
- (font-lock-flush))
- (outline-minor-mode-highlight-buffer))
+ (if (and global-font-lock-mode (font-lock-specified-p major-mode))
+ (progn
+ (font-lock-add-keywords nil outline-font-lock-keywords t)
+ (font-lock-flush)
+ (outline--fix-up-all-buttons))
+ (outline-minor-mode-highlight-buffer)))
;; Turn off this mode if we change major modes.
(add-hook 'change-major-mode-hook
(lambda () (outline-minor-mode -1))
diff --git a/lisp/textmodes/emacs-news-mode.el b/lisp/textmodes/emacs-news-mode.el
index 022e17c9343..6bf96deaccb 100644
--- a/lisp/textmodes/emacs-news-mode.el
+++ b/lisp/textmodes/emacs-news-mode.el
@@ -73,9 +73,11 @@
(defun emacs-news--mode-common ()
(setq-local font-lock-defaults '(emacs-news-mode-font-lock-keywords t))
- (setq-local outline-regexp "\\(:? +\\)?\\(\\*+\\) "
+ ;; This `outline-regexp' matches leading spaces inserted
+ ;; by the current implementation of `outline-minor-mode-use-buttons'.
+ (setq-local outline-regexp "\\(?: +\\)?\\(\\*+\\) "
+ outline-level (lambda () (length (match-string 1)))
outline-minor-mode-cycle t
- outline-level (lambda () (length (match-string 2)))
outline-minor-mode-highlight 'append)
(outline-minor-mode)
(emacs-etc--hide-local-variables))