diff options
| author | Lars Ingebrigtsen | 2022-07-29 13:20:06 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-07-29 13:20:15 +0200 |
| commit | 0728764faeb30c7d03106f4e075a839905f2662e (patch) | |
| tree | f3bca7a654a737dcee48e8b4e7515e16803364d8 | |
| parent | 501eb685be94f36e41e57bf48f3dcbb3bcd8a028 (diff) | |
| download | emacs-0728764faeb30c7d03106f4e075a839905f2662e.tar.gz emacs-0728764faeb30c7d03106f4e075a839905f2662e.zip | |
Fix up the outline minor mode button logic
* lisp/outline.el (outline-minor-mode-highlight-buffer): Factor
out... (bug#56820).
(outline--use-buttons-p): ... to here.
(outline-hide-subtree, outline--fix-up-all-buttons)
(outline-show-subtree): Use it.
| -rw-r--r-- | lisp/outline.el | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/outline.el b/lisp/outline.el index dd5df4c8966..b7935551dbb 100644 --- a/lisp/outline.el +++ b/lisp/outline.el | |||
| @@ -434,13 +434,17 @@ outline font-lock faces to those of major mode." | |||
| 434 | (goto-char (match-beginning 0)) | 434 | (goto-char (match-beginning 0)) |
| 435 | (not (get-text-property (point) 'face)))) | 435 | (not (get-text-property (point) 'face)))) |
| 436 | (overlay-put overlay 'face (outline-font-lock-face))) | 436 | (overlay-put overlay 'face (outline-font-lock-face))) |
| 437 | (when (and outline-minor-mode-use-buttons | 437 | (when (outline--use-buttons-p) |
| 438 | (or (eq outline-minor-mode-use-buttons t) | ||
| 439 | (buffer-match-p outline-minor-mode-use-buttons | ||
| 440 | (current-buffer)))) | ||
| 441 | (outline--insert-open-button))) | 438 | (outline--insert-open-button))) |
| 442 | (goto-char (match-end 0)))))) | 439 | (goto-char (match-end 0)))))) |
| 443 | 440 | ||
| 441 | (defun outline--use-buttons-p () | ||
| 442 | (and outline-minor-mode | ||
| 443 | outline-minor-mode-use-buttons | ||
| 444 | (or (eq outline-minor-mode-use-buttons t) | ||
| 445 | (buffer-match-p outline-minor-mode-use-buttons | ||
| 446 | (current-buffer))))) | ||
| 447 | |||
| 444 | ;;;###autoload | 448 | ;;;###autoload |
| 445 | (define-minor-mode outline-minor-mode | 449 | (define-minor-mode outline-minor-mode |
| 446 | "Toggle Outline minor mode. | 450 | "Toggle Outline minor mode. |
| @@ -982,7 +986,7 @@ If non-nil, EVENT should be a mouse event." | |||
| 982 | (interactive (list last-nonmenu-event)) | 986 | (interactive (list last-nonmenu-event)) |
| 983 | (when (mouse-event-p event) | 987 | (when (mouse-event-p event) |
| 984 | (mouse-set-point event)) | 988 | (mouse-set-point event)) |
| 985 | (when (and outline-minor-mode-use-buttons outline-minor-mode) | 989 | (when (outline--use-buttons-p) |
| 986 | (outline--insert-close-button)) | 990 | (outline--insert-close-button)) |
| 987 | (outline-flag-subtree t)) | 991 | (outline-flag-subtree t)) |
| 988 | 992 | ||
| @@ -1042,7 +1046,7 @@ If non-nil, EVENT should be a mouse event." | |||
| 1042 | (save-excursion | 1046 | (save-excursion |
| 1043 | (goto-char from) | 1047 | (goto-char from) |
| 1044 | (setq from (line-beginning-position)))) | 1048 | (setq from (line-beginning-position)))) |
| 1045 | (when outline-minor-mode-use-buttons | 1049 | (when (outline--use-buttons-p) |
| 1046 | (outline-map-region | 1050 | (outline-map-region |
| 1047 | (lambda () | 1051 | (lambda () |
| 1048 | ;; `outline--cycle-state' will fail if we're in a totally | 1052 | ;; `outline--cycle-state' will fail if we're in a totally |
| @@ -1073,7 +1077,7 @@ If non-nil, EVENT should be a mouse event." | |||
| 1073 | (interactive (list last-nonmenu-event)) | 1077 | (interactive (list last-nonmenu-event)) |
| 1074 | (when (mouse-event-p event) | 1078 | (when (mouse-event-p event) |
| 1075 | (mouse-set-point event)) | 1079 | (mouse-set-point event)) |
| 1076 | (when (and outline-minor-mode-use-buttons outline-minor-mode) | 1080 | (when (outline--use-buttons-p) |
| 1077 | (outline--insert-open-button)) | 1081 | (outline--insert-open-button)) |
| 1078 | (outline-flag-subtree nil)) | 1082 | (outline-flag-subtree nil)) |
| 1079 | 1083 | ||