diff options
| author | Stefan Monnier | 2009-11-20 15:47:26 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-11-20 15:47:26 +0000 |
| commit | 1e7d4475115b5090a01f8aca09ec613ce039b2eb (patch) | |
| tree | 14698baeddf87b3b3f145cb189d6e520d04dc236 | |
| parent | acfad775d23e1ad2e2f762da2d6f4118af1efb66 (diff) | |
| download | emacs-1e7d4475115b5090a01f8aca09ec613ce039b2eb.tar.gz emacs-1e7d4475115b5090a01f8aca09ec613ce039b2eb.zip | |
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
(bookmark-search-pattern, bookmark-search-timer, bookmark-quit-flag): New vars.
(bookmark-read-search-input, bookmark-filtered-alist-by-regexp-only)
(bookmark-bmenu-filter-alist-by-regexp)
(bookmark-bmenu-goto-bookmark, bookmark-bmenu-cancel-search): New funs.
(bookmark-bmenu-search): New command.
(bookmark-bmenu-mode-map): Bind it.
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 51 | ||||
| -rw-r--r-- | lisp/bookmark.el | 98 |
3 files changed, 133 insertions, 21 deletions
| @@ -153,6 +153,11 @@ when the value of the new variable `completions-format' is `vertical'. | |||
| 153 | 153 | ||
| 154 | * Changes in Specialized Modes and Packages in Emacs 23.2 | 154 | * Changes in Specialized Modes and Packages in Emacs 23.2 |
| 155 | 155 | ||
| 156 | ** The bookmark menu has a narrowing search via bookmark-bmenu-search. | ||
| 157 | |||
| 158 | ** LaTeX mode now provides completion via latex-complete and | ||
| 159 | latex-indent-or-complete. | ||
| 160 | |||
| 156 | ** lucid.el and levents.el are now declared obsolete. | 161 | ** lucid.el and levents.el are now declared obsolete. |
| 157 | 162 | ||
| 158 | ** pcomplete provides a new command `pcomplete-std-completion' which | 163 | ** pcomplete provides a new command `pcomplete-std-completion' which |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 914a4e8e950..575f121852e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,7 +1,18 @@ | |||
| 1 | 2009-11-20 Thierry Volpiatto <thierry.volpiatto@gmail.com> | ||
| 2 | |||
| 3 | * bookmark.el (bookmark-search-delay, bookmark-search-prompt): | ||
| 4 | New options. | ||
| 5 | (bookmark-search-pattern, bookmark-search-timer, bookmark-quit-flag): | ||
| 6 | New vars. | ||
| 7 | (bookmark-read-search-input, bookmark-filtered-alist-by-regexp-only) | ||
| 8 | (bookmark-bmenu-filter-alist-by-regexp) | ||
| 9 | (bookmark-bmenu-goto-bookmark, bookmark-bmenu-cancel-search): New funs. | ||
| 10 | (bookmark-bmenu-search): New command. | ||
| 11 | (bookmark-bmenu-mode-map): Bind it. | ||
| 12 | |||
| 1 | 2009-11-20 Chong Yidong <cyd@stupidchicken.com> | 13 | 2009-11-20 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 14 | ||
| 3 | * cedet/semantic/complete.el (semantic-complete-inline-map): Doc | 15 | * cedet/semantic/complete.el (semantic-complete-inline-map): Doc fix. |
| 4 | fix. | ||
| 5 | 16 | ||
| 6 | * cedet/semantic/idle.el (define-semantic-idle-service) | 17 | * cedet/semantic/idle.el (define-semantic-idle-service) |
| 7 | (semantic-idle-summary-mode, semantic-idle-completions): Doc fix. | 18 | (semantic-idle-summary-mode, semantic-idle-completions): Doc fix. |
| @@ -16,29 +27,27 @@ | |||
| 16 | * Makefile.in: Don't refer cc-subword.elc but subword.elc. | 27 | * Makefile.in: Don't refer cc-subword.elc but subword.elc. |
| 17 | 28 | ||
| 18 | * progmodes/cc-cmds.el (c-update-modeline) | 29 | * progmodes/cc-cmds.el (c-update-modeline) |
| 19 | (c-forward-into-nomenclature, c-backward-into-nomenclature): Refer | 30 | (c-forward-into-nomenclature, c-backward-into-nomenclature): |
| 20 | to subword.el functions instead of cc-subword.el. | 31 | Refer to subword.el functions instead of cc-subword.el. |
| 21 | 32 | ||
| 22 | * progmodes/cc-mode.el (subword-mode, c-mode-base-map): Refer to | 33 | * progmodes/cc-mode.el (subword-mode, c-mode-base-map): Refer to |
| 23 | subword.el functions instead of cc-subword.el. | 34 | subword.el functions instead of cc-subword.el. |
| 24 | 35 | ||
| 25 | * progmodes/cc-subword.el: Renamed to subword.el. | 36 | * progmodes/cc-subword.el: Rename to subword.el. |
| 26 | * subword.el: Renamed from progmodes/cc-subword.el. | 37 | * subword.el: Rename from progmodes/cc-subword.el. |
| 27 | (subword-mode-map): Renamed from c-subword-mode-map. | 38 | (subword-mode-map): Rename from c-subword-mode-map. |
| 28 | (subword-mode): Renamed from c-subword-mode. | 39 | (subword-mode): Rename from c-subword-mode. |
| 29 | (global-subword-mode): New global minor mode. | 40 | (global-subword-mode): New global minor mode. |
| 30 | (forward-subword): Renamed from c-forward-subword. | 41 | (forward-subword): Rename from c-forward-subword. |
| 31 | (backward-subword): Renamed from c-backward-subword. | 42 | (backward-subword): Rename from c-backward-subword. |
| 32 | (mark-subword): Renamed from c-mark-subword. | 43 | (mark-subword): Rename from c-mark-subword. |
| 33 | (kill-subword): Renamed from c-kill-subword. | 44 | (kill-subword): Rename from c-kill-subword. |
| 34 | (backward-kill-subword): Renamed from c-backward-kill-subword. | 45 | (backward-kill-subword): Rename from c-backward-kill-subword. |
| 35 | (transpose-subwords): Renamed from c-tranpose-subword. | 46 | (transpose-subwords): Rename from c-tranpose-subword. |
| 36 | (downcase-subword): Renamed from c-downcase-subword. | 47 | (downcase-subword): Rename from c-downcase-subword. |
| 37 | (capitalize-subword): Renamed from c-capitalize-subword. | 48 | (capitalize-subword): Rename from c-capitalize-subword. |
| 38 | (forward-subword-internal): Renamed from | 49 | (forward-subword-internal): Rename from c-forward-subword-internal. |
| 39 | c-forward-subword-internal. | 50 | (backward-subword-internal): Rename from c-backward-subword-internal. |
| 40 | (backward-subword-internal): Renamed from | ||
| 41 | c-backward-subword-internal. | ||
| 42 | 51 | ||
| 43 | 2009-11-20 Dan Nicolaescu <dann@ics.uci.edu> | 52 | 2009-11-20 Dan Nicolaescu <dann@ics.uci.edu> |
| 44 | 53 | ||
| @@ -352,7 +361,7 @@ | |||
| 352 | * vc-mtn.el (vc-mtn-print-log): | 361 | * vc-mtn.el (vc-mtn-print-log): |
| 353 | * vc-hg.el (vc-hg-print-log): | 362 | * vc-hg.el (vc-hg-print-log): |
| 354 | * vc-bzr.el (vc-bzr-print-log): Add new optional argument LIMIT, | 363 | * vc-bzr.el (vc-bzr-print-log): Add new optional argument LIMIT, |
| 355 | pass it to the log command when set. Make the BUFFER argument | 364 | pass it to the log command when set. Make the BUFFER argument |
| 356 | non-optional. | 365 | non-optional. |
| 357 | 366 | ||
| 358 | * vc-sccs.el (vc-sccs-print-log): | 367 | * vc-sccs.el (vc-sccs-print-log): |
diff --git a/lisp/bookmark.el b/lisp/bookmark.el index a3c315acbc2..a68f83a29b7 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el | |||
| @@ -197,6 +197,18 @@ following in your `.emacs' file: | |||
| 197 | :group 'bookmark) | 197 | :group 'bookmark) |
| 198 | 198 | ||
| 199 | 199 | ||
| 200 | (defcustom bookmark-search-delay 0.2 | ||
| 201 | "*Display when searching bookmarks is updated all `bookmark-search-delay' seconds." | ||
| 202 | :group 'bookmark | ||
| 203 | :type 'integer) | ||
| 204 | |||
| 205 | |||
| 206 | (defcustom bookmark-search-prompt "Pattern: " | ||
| 207 | "*Prompt used for `bookmark-bmenu-search'." | ||
| 208 | :group 'bookmark | ||
| 209 | :type 'string) | ||
| 210 | |||
| 211 | |||
| 200 | (defface bookmark-menu-heading | 212 | (defface bookmark-menu-heading |
| 201 | '((t (:inherit font-lock-type-face))) | 213 | '((t (:inherit font-lock-type-face))) |
| 202 | "Face used to highlight the heading in bookmark menu buffers." | 214 | "Face used to highlight the heading in bookmark menu buffers." |
| @@ -320,6 +332,18 @@ the source buffer for that information; see `bookmark-yank-word' and | |||
| 320 | This point is in `bookmark-curent-buffer'.") | 332 | This point is in `bookmark-curent-buffer'.") |
| 321 | 333 | ||
| 322 | 334 | ||
| 335 | (defvar bookmark-search-pattern "" | ||
| 336 | "Store keyboard input for incremental search.") | ||
| 337 | |||
| 338 | |||
| 339 | (defvar bookmark-search-timer nil | ||
| 340 | "Timer used for searching") | ||
| 341 | |||
| 342 | |||
| 343 | (defvar bookmark-quit-flag nil | ||
| 344 | "Non nil make `bookmark-bmenu-search' quit immediately.") | ||
| 345 | |||
| 346 | |||
| 323 | 347 | ||
| 324 | ;; Helper functions. | 348 | ;; Helper functions. |
| 325 | 349 | ||
| @@ -1525,6 +1549,7 @@ method buffers use to resolve name collisions." | |||
| 1525 | (define-key map "a" 'bookmark-bmenu-show-annotation) | 1549 | (define-key map "a" 'bookmark-bmenu-show-annotation) |
| 1526 | (define-key map "A" 'bookmark-bmenu-show-all-annotations) | 1550 | (define-key map "A" 'bookmark-bmenu-show-all-annotations) |
| 1527 | (define-key map "e" 'bookmark-bmenu-edit-annotation) | 1551 | (define-key map "e" 'bookmark-bmenu-edit-annotation) |
| 1552 | (define-key map "\M-g" 'bookmark-bmenu-search) | ||
| 1528 | (define-key map [mouse-2] 'bookmark-bmenu-other-window-with-mouse) | 1553 | (define-key map [mouse-2] 'bookmark-bmenu-other-window-with-mouse) |
| 1529 | map)) | 1554 | map)) |
| 1530 | 1555 | ||
| @@ -2072,6 +2097,79 @@ To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\ | |||
| 2072 | (bookmark-relocate bmrk) | 2097 | (bookmark-relocate bmrk) |
| 2073 | (goto-char thispoint)))) | 2098 | (goto-char thispoint)))) |
| 2074 | 2099 | ||
| 2100 | ;;; Bookmark-bmenu search | ||
| 2101 | |||
| 2102 | (defun bookmark-read-search-input () | ||
| 2103 | "Read each keyboard input and add it to `bookmark-search-pattern'." | ||
| 2104 | (setq bookmark-search-pattern "") ; Always reset pattern to empty string | ||
| 2105 | (let ((prompt (propertize bookmark-search-prompt 'face '((:foreground "cyan")))) | ||
| 2106 | (inhibit-quit t) | ||
| 2107 | (tmp-list ()) | ||
| 2108 | char) | ||
| 2109 | (catch 'break | ||
| 2110 | (while 1 | ||
| 2111 | (catch 'continue | ||
| 2112 | (condition-case nil | ||
| 2113 | (setq char (read-char (concat prompt bookmark-search-pattern))) | ||
| 2114 | (error (throw 'break nil))) | ||
| 2115 | (case char | ||
| 2116 | ((or ?\e ?\r) (throw 'break nil)) ; RET or ESC break search loop and lead to [1]. | ||
| 2117 | (?\d (pop tmp-list) ; Delete last char of `bookmark-search-pattern' with DEL | ||
| 2118 | (setq bookmark-search-pattern (mapconcat 'identity (reverse tmp-list) "")) | ||
| 2119 | (throw 'continue nil)) | ||
| 2120 | (?\C-g (setq bookmark-quit-flag t) (throw 'break nil)) | ||
| 2121 | (t | ||
| 2122 | (push (text-char-description char) tmp-list) | ||
| 2123 | (setq bookmark-search-pattern (mapconcat 'identity (reverse tmp-list) "")) | ||
| 2124 | (throw 'continue nil)))))))) | ||
| 2125 | |||
| 2126 | |||
| 2127 | (defun bookmark-filtered-alist-by-regexp-only (regexp) | ||
| 2128 | "Return a filtered `bookmark-alist' with bookmarks matching REGEXP." | ||
| 2129 | (loop for i in bookmark-alist | ||
| 2130 | when (string-match regexp (car i)) collect i into new | ||
| 2131 | finally return new)) | ||
| 2132 | |||
| 2133 | |||
| 2134 | (defun bookmark-bmenu-filter-alist-by-regexp (regexp) | ||
| 2135 | "Filter `bookmark-alist' with bookmarks matching REGEXP and rebuild list." | ||
| 2136 | (let ((bookmark-alist (bookmark-filtered-alist-by-regexp-only regexp))) | ||
| 2137 | (bookmark-bmenu-list))) | ||
| 2138 | |||
| 2139 | ;;;###autoload | ||
| 2140 | (defun bookmark-bmenu-search () | ||
| 2141 | "Incremental search of bookmarks matching `bookmark-search-pattern'. | ||
| 2142 | `bookmark-search-pattern' is build incrementally with `bookmark-read-search-input'" | ||
| 2143 | (interactive) | ||
| 2144 | (when (string= (buffer-name (current-buffer)) "*Bookmark List*") | ||
| 2145 | (let ((bmk (bookmark-bmenu-bookmark))) | ||
| 2146 | (unwind-protect | ||
| 2147 | (progn | ||
| 2148 | (setq bookmark-search-timer | ||
| 2149 | (run-with-idle-timer bookmark-search-delay 'repeat | ||
| 2150 | #'(lambda () | ||
| 2151 | (bookmark-bmenu-filter-alist-by-regexp bookmark-search-pattern)))) | ||
| 2152 | (bookmark-read-search-input)) | ||
| 2153 | (progn ; [1] Stop timer. | ||
| 2154 | (bookmark-bmenu-cancel-search) | ||
| 2155 | (when bookmark-quit-flag ; C-g hit restore menu list. | ||
| 2156 | (bookmark-bmenu-list) (bookmark-bmenu-goto-bookmark bmk)) | ||
| 2157 | (setq bookmark-quit-flag nil)))))) | ||
| 2158 | |||
| 2159 | (defun bookmark-bmenu-goto-bookmark (name) | ||
| 2160 | "Move point to bookmark with name NAME." | ||
| 2161 | (goto-char (point-min)) | ||
| 2162 | (bookmark-bmenu-check-position) | ||
| 2163 | (while (not (equal name (bookmark-bmenu-bookmark))) | ||
| 2164 | (forward-line 1)) | ||
| 2165 | (forward-line 0)) | ||
| 2166 | |||
| 2167 | |||
| 2168 | (defun bookmark-bmenu-cancel-search () | ||
| 2169 | "Cancel timer used for searching in bookmarks." | ||
| 2170 | (cancel-timer bookmark-search-timer) | ||
| 2171 | (setq bookmark-search-timer nil)) | ||
| 2172 | |||
| 2075 | 2173 | ||
| 2076 | ;;; Menu bar stuff. Prefix is "bookmark-menu". | 2174 | ;;; Menu bar stuff. Prefix is "bookmark-menu". |
| 2077 | 2175 | ||