[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 34/38: Support search bookmarks as requested in #39
From: |
Leo Liu |
Subject: |
[elpa] 34/38: Support search bookmarks as requested in #39 |
Date: |
Mon, 24 Mar 2014 09:31:38 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 8b1709a8b29715a710180a70248abd983d15b97d
Author: Leo Liu <address@hidden>
Date: Sat Mar 22 16:48:21 2014 +0800
Support search bookmarks as requested in #39
New variable ggtags-global-history-length.
---
ggtags.el | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/ggtags.el b/ggtags.el
index 6c002d8..37dd826 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -211,6 +211,11 @@ If an integer abbreviate only names longer than that
number."
:type 'number
:group 'ggtags)
+(defcustom ggtags-global-history-length history-length
+ "Maximum number of items to keep in `ggtags-global-search-history'."
+ :type 'integer
+ :group 'ggtags)
+
(defcustom ggtags-find-tag-hook nil
"Hook run immediately after finding a tag."
:options '(recenter reposition-window)
@@ -870,7 +875,7 @@ Global and Emacs."
(lambda (buf _msg)
(with-current-buffer buf
(ggtags-forward-to-line line)
- (with-demoted-errors (compile-goto-error))))
+ (compile-goto-error)))
nil t)))))
(defvar-local ggtags-global-search-ewoc nil)
@@ -911,6 +916,7 @@ Global and Emacs."
m)))
(defvar ggtags-navigation-mode)
+(defvar bookmark-make-record-function)
(defun ggtags-global-rerun-search ()
"Pop up a buffer to choose a past search to re-run.
@@ -925,6 +931,7 @@ Global and Emacs."
(special-mode)
(use-local-map ggtags-global-rerun-search-map)
(setq-local ggtags-navigation-mode nil)
+ (setq-local bookmark-make-record-function #'ggtags-make-bookmark-record)
(setq truncate-lines t)
(cl-labels ((prop (s) (propertize s 'face 'minibuffer-prompt))
(pp (data)
@@ -962,6 +969,18 @@ Use \\[jump-to-register] to restore the search session."
:jump-func #'ggtags-global-rerun-search-1
:print-func #'prn))))
+(defun ggtags-make-bookmark-record ()
+ `(,(and ggtags-current-tag-name (format "*ggtags %s*"
ggtags-current-tag-name))
+ (ggtags-search . ,(if ggtags-global-search-ewoc
+ (cdr (ewoc-data (ewoc-locate
ggtags-global-search-ewoc)))
+ (ggtags-global-current-search)))
+ (handler . ggtags-bookmark-jump)))
+
+(declare-function bookmark-prop-get "bookmark")
+
+(defun ggtags-bookmark-jump (bmk)
+ (ggtags-global-rerun-search-1 (bookmark-prop-get bmk 'ggtags-search)))
+
(defun ggtags-delete-tag-files ()
"Delete the tag files generated by gtags."
(interactive (ignore (ggtags-check-project)))
@@ -1293,6 +1312,7 @@ Use \\[jump-to-register] to restore the search session."
(jit-lock-register #'ggtags-abbreviate-files)
(add-hook 'compilation-filter-hook 'ggtags-global-filter nil 'local)
(add-hook 'compilation-finish-functions 'ggtags-handle-single-match nil t)
+ (setq-local bookmark-make-record-function #'ggtags-make-bookmark-record)
(add-hook 'kill-buffer-hook (lambda () (ggtags-navigation-mode -1)) nil t))
;; NOTE: Need this to avoid putting menu items in
@@ -1465,7 +1485,8 @@ Use \\[jump-to-register] to restore the search session."
(setq ggtags-global-search-history
(cl-remove id ggtags-global-search-history :test #'equal :key
#'car))
(add-to-history 'ggtags-global-search-history
- (cons id (ggtags-global-current-search))))))
+ (cons id (ggtags-global-current-search))
+ ggtags-global-history-length))))
(run-hooks 'ggtags-find-tag-hook))
(define-minor-mode ggtags-navigation-mode nil
- [elpa] 24/38: Fix thinko in "Don't display buffer if ggtags-navigation-mode is exited", (continued)
- [elpa] 24/38: Fix thinko in "Don't display buffer if ggtags-navigation-mode is exited", Leo Liu, 2014/03/24
- [elpa] 26/38: New macro ignore-errors-unless-debug and use it, Leo Liu, 2014/03/24
- [elpa] 15/38: Small fixes to last change, Leo Liu, 2014/03/24
- [elpa] 32/38: Bind ggtags-save-to-register in ggtags-global-rerun-search-map, Leo Liu, 2014/03/24
- [elpa] 28/38: New helper ggtags-forward-to-line and use it, Leo Liu, 2014/03/24
- [elpa] 27/38: Cosmetic change: Fix indentation, Leo Liu, 2014/03/24
- [elpa] 29/38: New feature ggtags-global-restore-search for #37, Leo Liu, 2014/03/24
- [elpa] 33/38: Disable ggtags-navigation-mode in ggtags-global-rerun-search, Leo Liu, 2014/03/24
- [elpa] 31/38: Also record ggtags-process-environment in search history, Leo Liu, 2014/03/24
- [elpa] 30/38: Polish last change, Leo Liu, 2014/03/24
- [elpa] 34/38: Support search bookmarks as requested in #39,
Leo Liu <=
- [elpa] 38/38: Merge branch 'master' of github.com:leoliu/ggtags, Leo Liu, 2014/03/24
- [elpa] 37/38: Rename try-complete-ggtags-tag to ggtags-try-complete-tag, Leo Liu, 2014/03/24
- [elpa] 13/38: Require cl-lib and remove macro when-let, Leo Liu, 2014/03/24
- [elpa] 36/38: Doc fix: Update README.rst and doc-strings, Leo Liu, 2014/03/24
- [elpa] 35/38: Fix #40: New user variable ggtags-supress-navigation-keys, Leo Liu, 2014/03/24