[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs etc/NEWS lisp/ChangeLog lisp/bookmark.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] emacs etc/NEWS lisp/ChangeLog lisp/bookmark.el |
Date: |
Fri, 20 Nov 2009 15:47:32 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Stefan Monnier <monnier> 09/11/20 15:47:31
Modified files:
etc : NEWS
lisp : ChangeLog bookmark.el
Log message:
* 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.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/etc/NEWS?cvsroot=emacs&r1=1.2119&r2=1.2120
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16688&r2=1.16689
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/bookmark.el?cvsroot=emacs&r1=1.141&r2=1.142
Patches:
Index: etc/NEWS
===================================================================
RCS file: /sources/emacs/emacs/etc/NEWS,v
retrieving revision 1.2119
retrieving revision 1.2120
diff -u -b -r1.2119 -r1.2120
--- etc/NEWS 20 Nov 2009 06:56:16 -0000 1.2119
+++ etc/NEWS 20 Nov 2009 15:47:26 -0000 1.2120
@@ -153,6 +153,11 @@
* Changes in Specialized Modes and Packages in Emacs 23.2
+** The bookmark menu has a narrowing search via bookmark-bmenu-search.
+
+** LaTeX mode now provides completion via latex-complete and
+latex-indent-or-complete.
+
** lucid.el and levents.el are now declared obsolete.
** pcomplete provides a new command `pcomplete-std-completion' which
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16688
retrieving revision 1.16689
diff -u -b -r1.16688 -r1.16689
--- lisp/ChangeLog 20 Nov 2009 15:11:16 -0000 1.16688
+++ lisp/ChangeLog 20 Nov 2009 15:47:28 -0000 1.16689
@@ -1,7 +1,18 @@
+2009-11-20 Thierry Volpiatto <address@hidden>
+
+ * 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.
+
2009-11-20 Chong Yidong <address@hidden>
- * cedet/semantic/complete.el (semantic-complete-inline-map): Doc
- fix.
+ * cedet/semantic/complete.el (semantic-complete-inline-map): Doc fix.
* cedet/semantic/idle.el (define-semantic-idle-service)
(semantic-idle-summary-mode, semantic-idle-completions): Doc fix.
@@ -16,29 +27,27 @@
* Makefile.in: Don't refer cc-subword.elc but subword.elc.
* progmodes/cc-cmds.el (c-update-modeline)
- (c-forward-into-nomenclature, c-backward-into-nomenclature): Refer
- to subword.el functions instead of cc-subword.el.
+ (c-forward-into-nomenclature, c-backward-into-nomenclature):
+ Refer to subword.el functions instead of cc-subword.el.
* progmodes/cc-mode.el (subword-mode, c-mode-base-map): Refer to
subword.el functions instead of cc-subword.el.
- * progmodes/cc-subword.el: Renamed to subword.el.
- * subword.el: Renamed from progmodes/cc-subword.el.
- (subword-mode-map): Renamed from c-subword-mode-map.
- (subword-mode): Renamed from c-subword-mode.
+ * progmodes/cc-subword.el: Rename to subword.el.
+ * subword.el: Rename from progmodes/cc-subword.el.
+ (subword-mode-map): Rename from c-subword-mode-map.
+ (subword-mode): Rename from c-subword-mode.
(global-subword-mode): New global minor mode.
- (forward-subword): Renamed from c-forward-subword.
- (backward-subword): Renamed from c-backward-subword.
- (mark-subword): Renamed from c-mark-subword.
- (kill-subword): Renamed from c-kill-subword.
- (backward-kill-subword): Renamed from c-backward-kill-subword.
- (transpose-subwords): Renamed from c-tranpose-subword.
- (downcase-subword): Renamed from c-downcase-subword.
- (capitalize-subword): Renamed from c-capitalize-subword.
- (forward-subword-internal): Renamed from
- c-forward-subword-internal.
- (backward-subword-internal): Renamed from
- c-backward-subword-internal.
+ (forward-subword): Rename from c-forward-subword.
+ (backward-subword): Rename from c-backward-subword.
+ (mark-subword): Rename from c-mark-subword.
+ (kill-subword): Rename from c-kill-subword.
+ (backward-kill-subword): Rename from c-backward-kill-subword.
+ (transpose-subwords): Rename from c-tranpose-subword.
+ (downcase-subword): Rename from c-downcase-subword.
+ (capitalize-subword): Rename from c-capitalize-subword.
+ (forward-subword-internal): Rename from c-forward-subword-internal.
+ (backward-subword-internal): Rename from c-backward-subword-internal.
2009-11-20 Dan Nicolaescu <address@hidden>
Index: lisp/bookmark.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/bookmark.el,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -b -r1.141 -r1.142
--- lisp/bookmark.el 8 Nov 2009 23:01:49 -0000 1.141
+++ lisp/bookmark.el 20 Nov 2009 15:47:31 -0000 1.142
@@ -197,6 +197,18 @@
:group 'bookmark)
+(defcustom bookmark-search-delay 0.2
+ "*Display when searching bookmarks is updated all `bookmark-search-delay'
seconds."
+ :group 'bookmark
+ :type 'integer)
+
+
+(defcustom bookmark-search-prompt "Pattern: "
+ "*Prompt used for `bookmark-bmenu-search'."
+ :group 'bookmark
+ :type 'string)
+
+
(defface bookmark-menu-heading
'((t (:inherit font-lock-type-face)))
"Face used to highlight the heading in bookmark menu buffers."
@@ -320,6 +332,18 @@
This point is in `bookmark-curent-buffer'.")
+(defvar bookmark-search-pattern ""
+ "Store keyboard input for incremental search.")
+
+
+(defvar bookmark-search-timer nil
+ "Timer used for searching")
+
+
+(defvar bookmark-quit-flag nil
+ "Non nil make `bookmark-bmenu-search' quit immediately.")
+
+
;; Helper functions.
@@ -1525,6 +1549,7 @@
(define-key map "a" 'bookmark-bmenu-show-annotation)
(define-key map "A" 'bookmark-bmenu-show-all-annotations)
(define-key map "e" 'bookmark-bmenu-edit-annotation)
+ (define-key map "\M-g" 'bookmark-bmenu-search)
(define-key map [mouse-2] 'bookmark-bmenu-other-window-with-mouse)
map))
@@ -2072,6 +2097,79 @@
(bookmark-relocate bmrk)
(goto-char thispoint))))
+;;; Bookmark-bmenu search
+
+(defun bookmark-read-search-input ()
+ "Read each keyboard input and add it to `bookmark-search-pattern'."
+ (setq bookmark-search-pattern "") ; Always reset pattern to empty string
+ (let ((prompt (propertize bookmark-search-prompt 'face '((:foreground
"cyan"))))
+ (inhibit-quit t)
+ (tmp-list ())
+ char)
+ (catch 'break
+ (while 1
+ (catch 'continue
+ (condition-case nil
+ (setq char (read-char (concat prompt bookmark-search-pattern)))
+ (error (throw 'break nil)))
+ (case char
+ ((or ?\e ?\r) (throw 'break nil)) ; RET or ESC break search
loop and lead to [1].
+ (?\d (pop tmp-list) ; Delete last char of
`bookmark-search-pattern' with DEL
+ (setq bookmark-search-pattern (mapconcat 'identity (reverse
tmp-list) ""))
+ (throw 'continue nil))
+ (?\C-g (setq bookmark-quit-flag t) (throw 'break nil))
+ (t
+ (push (text-char-description char) tmp-list)
+ (setq bookmark-search-pattern (mapconcat 'identity (reverse
tmp-list) ""))
+ (throw 'continue nil))))))))
+
+
+(defun bookmark-filtered-alist-by-regexp-only (regexp)
+ "Return a filtered `bookmark-alist' with bookmarks matching REGEXP."
+ (loop for i in bookmark-alist
+ when (string-match regexp (car i)) collect i into new
+ finally return new))
+
+
+(defun bookmark-bmenu-filter-alist-by-regexp (regexp)
+ "Filter `bookmark-alist' with bookmarks matching REGEXP and rebuild list."
+ (let ((bookmark-alist (bookmark-filtered-alist-by-regexp-only regexp)))
+ (bookmark-bmenu-list)))
+
+;;;###autoload
+(defun bookmark-bmenu-search ()
+ "Incremental search of bookmarks matching `bookmark-search-pattern'.
+`bookmark-search-pattern' is build incrementally with
`bookmark-read-search-input'"
+ (interactive)
+ (when (string= (buffer-name (current-buffer)) "*Bookmark List*")
+ (let ((bmk (bookmark-bmenu-bookmark)))
+ (unwind-protect
+ (progn
+ (setq bookmark-search-timer
+ (run-with-idle-timer bookmark-search-delay 'repeat
+ #'(lambda ()
+
(bookmark-bmenu-filter-alist-by-regexp bookmark-search-pattern))))
+ (bookmark-read-search-input))
+ (progn ; [1] Stop timer.
+ (bookmark-bmenu-cancel-search)
+ (when bookmark-quit-flag ; C-g hit restore menu list.
+ (bookmark-bmenu-list) (bookmark-bmenu-goto-bookmark bmk))
+ (setq bookmark-quit-flag nil))))))
+
+(defun bookmark-bmenu-goto-bookmark (name)
+ "Move point to bookmark with name NAME."
+ (goto-char (point-min))
+ (bookmark-bmenu-check-position)
+ (while (not (equal name (bookmark-bmenu-bookmark)))
+ (forward-line 1))
+ (forward-line 0))
+
+
+(defun bookmark-bmenu-cancel-search ()
+ "Cancel timer used for searching in bookmarks."
+ (cancel-timer bookmark-search-timer)
+ (setq bookmark-search-timer nil))
+
;;; Menu bar stuff. Prefix is "bookmark-menu".
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs etc/NEWS lisp/ChangeLog lisp/bookmark.el,
Stefan Monnier <=