[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r110335: * lisp/bookmark.el (bookmark
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r110335: * lisp/bookmark.el (bookmark-search-pattern): Remove var. |
Date: |
Mon, 01 Oct 2012 22:47:12 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110335
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2012-10-01 22:47:12 -0400
message:
* lisp/bookmark.el (bookmark-search-pattern): Remove var.
(bookmark-read-search-input): Remove function.
(bookmark-bmenu-search): Reimplement using a minibuffer.
modified:
lisp/ChangeLog
lisp/bookmark.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-10-02 00:40:56 +0000
+++ b/lisp/ChangeLog 2012-10-02 02:47:12 +0000
@@ -1,5 +1,9 @@
2012-10-02 Stefan Monnier <address@hidden>
+ * bookmark.el (bookmark-search-pattern): Remove var.
+ (bookmark-read-search-input): Remove function.
+ (bookmark-bmenu-search): Reimplement using a minibuffer.
+
* faces.el (modeline): Remove obsolete face name.
* vc/add-log.el (add-log-buffer-file-name-function): Demote to defvar
=== modified file 'lisp/bookmark.el'
--- a/lisp/bookmark.el 2012-10-01 04:15:48 +0000
+++ b/lisp/bookmark.el 2012-10-02 02:47:12 +0000
@@ -2010,32 +2010,6 @@
;;; Bookmark-bmenu search
-;; Store keyboard input for incremental search.
-(defvar bookmark-search-pattern)
-
-(defun bookmark-read-search-input ()
- "Read each keyboard input and add it to `bookmark-search-pattern'."
- (let ((prompt (propertize "Pattern: " 'face 'minibuffer-prompt))
- ;; (inhibit-quit t) ; inhibit-quit is evil. Use it with extreme care!
- (tmp-list ()))
- (while
- (let ((char (read-key (concat prompt bookmark-search-pattern))))
- (pcase char
- ((or ?\e ?\r) nil) ; RET or ESC break the search loop.
- (?\C-g (setq bookmark-quit-flag t) nil)
- (?\d (pop tmp-list) t) ; Delete last char of pattern with DEL
- (_
- (if (characterp char)
- (push char tmp-list)
- (setq unread-command-events
- (nconc (mapcar 'identity
- (this-single-command-raw-keys))
- unread-command-events))
- nil))))
- (setq bookmark-search-pattern
- (apply 'string (reverse tmp-list))))))
-
-
(defun bookmark-bmenu-filter-alist-by-regexp (regexp)
"Filter `bookmark-alist' with bookmarks matching REGEXP and rebuild list."
(let ((bookmark-alist
@@ -2050,19 +2024,23 @@
"Incremental search of bookmarks, hiding the non-matches as we go."
(interactive)
(let ((bmk (bookmark-bmenu-bookmark))
- (bookmark-search-pattern "")
- (timer (run-with-idle-timer
- bookmark-search-delay 'repeat
- #'(lambda ()
- (bookmark-bmenu-filter-alist-by-regexp
- bookmark-search-pattern)))))
+ (timer nil))
(unwind-protect
- (bookmark-read-search-input)
- (cancel-timer timer)
- (message nil)
- (when bookmark-quit-flag ; C-g hit restore menu list.
- (bookmark-bmenu-list) (bookmark-bmenu-goto-bookmark bmk))
- (setq bookmark-quit-flag nil))))
+ (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)))))
(defun bookmark-bmenu-goto-bookmark (name)
"Move point to bookmark with name NAME."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r110335: * lisp/bookmark.el (bookmark-search-pattern): Remove var.,
Stefan Monnier <=