[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10998: Allow movements in bookmark-bmenu-search
From: |
Stefan Monnier |
Subject: |
bug#10998: Allow movements in bookmark-bmenu-search |
Date: |
Mon, 01 Oct 2012 10:53:47 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) |
>> I agree with Stefan that this is not an ideal solution, by the way, and
>> have left a comment in the patch below to that effect.
> Keep in mind that this is not a real minibuffer.
AFAICT the fact that it's not a minibuffer is an implementation detail.
IOW it currently isn't a minibuffer, but it could/should be changed to
be one.
See example below.
Stefan
(defun bookmark-bmenu-search ()
"Incremental search of bookmarks, hiding the non-matches as we go."
(interactive)
(let ((bmk (bookmark-bmenu-bookmark))
(timer nil))
(unwind-protect
(minibuffer-with-setup-hook
(lambda ()
(setq timer (run-with-idle-timer
bookmark-search-delay 'repeat
#'(lambda (buf)
(with-current-buffer buf
(bookmark-bmenu-filter-alist-by-regexp
(minibuffer-contents))))
(current-buffer))))
(read-string "Pattern: ")
(when timer (cancel-timer timer) (setq timer nil)))
(when timer ;; Signalled an error or a `quit'.
(cancel-timer timer)
(bookmark-bmenu-list)
(bookmark-bmenu-goto-bookmark bmk)))))