avy.el (avy--visible-p): Add to fix org-toggle-link-display

Fixes #261
This commit is contained in:
Oleh Krehel 2019-01-17 17:39:01 +01:00
parent 909483e104
commit 002b8f3451

11
avy.el
View File

@ -837,18 +837,23 @@ Use OVERLAY-FN to visualize the decision overlay."
(setq avy--overlays-back nil) (setq avy--overlays-back nil)
(avy--remove-leading-chars)) (avy--remove-leading-chars))
(defun avy--visible-p (s)
(let ((invisible (get-char-property s 'invisible)))
(or (null invisible)
(null (assoc invisible buffer-invisibility-spec)))))
(defun avy--next-visible-point () (defun avy--next-visible-point ()
"Return the next closest point without 'invisible property." "Return the next closest point without 'invisible property."
(let ((s (point))) (let ((s (point)))
(while (and (not (= (point-max) (setq s (next-char-property-change s)))) (while (and (not (= (point-max) (setq s (next-char-property-change s))))
(get-char-property s 'invisible))) (not (avy--visible-p s))))
s)) s))
(defun avy--next-invisible-point () (defun avy--next-invisible-point ()
"Return the next closest point with 'invisible property." "Return the next closest point with 'invisible property."
(let ((s (point))) (let ((s (point)))
(while (and (not (= (point-max) (setq s (next-char-property-change s)))) (while (and (not (= (point-max) (setq s (next-char-property-change s))))
(not (get-char-property s 'invisible)))) (avy--visible-p s)))
s)) s))
(defun avy--find-visible-regions (rbeg rend) (defun avy--find-visible-regions (rbeg rend)
@ -883,7 +888,7 @@ When GROUP is non-nil, (BEG . END) should delimit that regex group."
(save-excursion (save-excursion
(goto-char (car pair)) (goto-char (car pair))
(while (re-search-forward regex (cdr pair) t) (while (re-search-forward regex (cdr pair) t)
(unless (get-char-property (1- (point)) 'invisible) (when (avy--visible-p (1- (point)))
(when (or (null pred) (when (or (null pred)
(funcall pred)) (funcall pred))
(push (cons (cons (match-beginning group) (push (cons (cons (match-beginning group)