Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion hideshowvis.el
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ this value (in bytes). The minor mode can still be forced to be enabled using
:type '(choice (natnum :tag "Size in bytes")
(const :tag "No limit" nil)))

(defun hideshowvis--find-next-block (regexp bound comments)
"Compatibility function to reposition point at next block-start.
Skip comments if COMMENTS is nil, and search for REGEXP in region (point
BOUND)."
(cond
;; added in Emacs 31.1.
((and (boundp 'hs-find-next-block-function)
(functionp hs-find-next-block-function))
(funcall hs-find-next-block-function regexp bound comments))
;; added in Emacs 29.1.
((and (boundp 'hs-find-next-block-func)
(functionp hs-find-next-block-func))
(funcall hs-find-next-block-func regexp bound comments))
(t
(search-forward-regexp hs-block-start-regexp nil t))))

(defun hideshowvis-highlight-hs-regions-in-fringe (&optional start end _old-text-length)
"Will update the fringe indicators for all foldable regions in the buffer.
This can be slow for large buffers. Adjust `hideshowvis-max-file-size' when
Expand All @@ -146,7 +162,7 @@ functions used with `after-change-functions'."
(narrow-to-region start end))
(goto-char (point-min))
(remove-overlays (point-min) (point-max) 'hideshowvis-hs t)
(while (search-forward-regexp hs-block-start-regexp nil t)
(while (hideshowvis--find-next-block hs-block-start-regexp (point-max) t)
(when (if hideshowvis-ignore-same-line
(let ((begin-line (save-excursion
(goto-char (match-beginning 0))
Expand Down