bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode


From: Eli Zaretskii
Subject: bug#53981: 28.0.91; shortdoc: Add support for outline-minor-mode
Date: Tue, 08 Nov 2022 21:32:03 +0200

> Cc: 53981@debbugs.gnu.org
> From: Juri Linkov <juri@linkov.net>
> Date: Tue, 08 Nov 2022 21:12:45 +0200
> 
> @@ -474,16 +485,17 @@ outline-minor-mode-highlight-buffer
>    ;; Fallback to overlays when font-lock is unsupported.
>    (save-excursion
>      (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))))
> -          (overlay-put overlay 'outline-highlight t)
> -          ;; 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)
> -                         (not (get-text-property (match-beginning 0) 
> 'face))))
> -            (overlay-put overlay 'face (outline-font-lock-face))))
> -        (goto-char (match-end 0))))))
> +    (while (if outline-search-function
> +               (funcall outline-search-function)
> +             (re-search-forward outline-regexp nil t))

This changes the effect of the code because the new code searches for
a different regexp.

> @@ -877,17 +903,21 @@ outline-next-visible-heading
>      (while (and (not (bobp)) (< arg 0))
>        (while (and (not (bobp))
>                 (setq found-heading-p
> -                     (re-search-backward
> -                      (concat "^\\(?:" outline-regexp "\\)")
> -                      nil 'move))
> +                     (if outline-search-function
> +                            (funcall outline-search-function nil 'backward)
> +                          (re-search-backward
> +                        (concat "^\\(?:" outline-regexp "\\)")
> +                        nil 'move)))
>                 (outline-invisible-p)))
>        (setq arg (1+ arg)))
>      (while (and (not (eobp)) (> arg 0))
>        (while (and (not (eobp))
>                 (setq found-heading-p
> -                     (re-search-forward
> -                      (concat "^\\(?:" outline-regexp "\\)")
> -                      nil 'move))
> +                     (if outline-search-function
> +                            (funcall outline-search-function)
> +                          (re-search-forward
> +                        (concat "^\\(?:" outline-regexp "\\)")
> +                        nil 'move)))
>                 (outline-invisible-p (match-beginning 0))))

These two loops cons a new string each iteration.  (So did the
original code, but if we are touching this, might as well fix that.)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]