Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hchbaw/315939 to your computer and use it in GitHub Desktop.
Save hchbaw/315939 to your computer and use it in GitHub Desktop.
From a382a04a3a9515bf34b56f58107920670908bd27 Mon Sep 17 00:00:00 2001
From: Takeshi Banse <[email protected]>
Date: Sat, 27 Feb 2010 02:27:40 +0900
Subject: If the source does not match, try next
and if overlay has been there already, try next, too.
---
/anything.el | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/anything.el b/anything.el
index 302757a..867ad1f 100644
--- a/anything.el
+++ b/anything.el
@@ -3642,13 +3642,20 @@ (defun anything-revive-visible-mark ()
(with-current-buffer anything-buffer
(loop for o in anything-visible-mark-overlays do
(goto-char (point-min))
- (when (search-forward (overlay-get o 'string) nil t)
- (forward-line -1)
- (when (save-excursion
- (goto-char (anything-get-previous-header-pos))
- (equal (overlay-get o 'source)
- (buffer-substring (line-beginning-position) (line-end-position))))
- (move-overlay o (line-beginning-position) (1+ (line-end-position))))))))
+ (let (moved)
+ (while (and (not moved)
+ (search-forward (overlay-get o 'string) nil t))
+ (forward-line -1)
+ (when (and (save-excursion
+ (goto-char (anything-get-previous-header-pos))
+ (equal (overlay-get o 'source)
+ (buffer-substring (line-beginning-position) (line-end-position))))
+ (not (find-if (lambda (x)
+ (memq x anything-visible-mark-overlays))
+ (overlays-at (point)))))
+ (move-overlay o (line-beginning-position) (1+ (line-end-position)))
+ (setq moved t))
+ (forward-line 1))))))
(add-hook 'anything-update-hook 'anything-revive-visible-mark)
(defun anything-next-visible-mark (&optional prev)
--
1.7.0.87.g0901d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment