[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 23/38: Simplify ggtags-save-to-register by always re-do the searc
From: |
Leo Liu |
Subject: |
[elpa] 23/38: Simplify ggtags-save-to-register by always re-do the search |
Date: |
Mon, 24 Mar 2014 09:31:36 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 927bc05e970d844f577576f49e8b2bc5ce2d544a
Author: Leo Liu <address@hidden>
Date: Tue Mar 18 15:21:31 2014 +0800
Simplify ggtags-save-to-register by always re-do the search
Fix error in ggtags-global--display-buffer.
---
ggtags.el | 66 ++++++++++++++++++++++++++----------------------------------
1 files changed, 29 insertions(+), 37 deletions(-)
diff --git a/ggtags.el b/ggtags.el
index f588331..789982a 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -673,8 +673,8 @@ non-nil."
(ring-insert find-tag-marker-ring ggtags-global-start-marker)
(setq ggtags-global-start-marker t)))
-(defun ggtags-global-start (command &optional root)
- (let* ((default-directory (or root (ggtags-current-project-root)))
+(defun ggtags-global-start (command &optional directory)
+ (let* ((default-directory (or directory (ggtags-current-project-root)))
(split-window-preferred-function ggtags-split-window-function)
;; See http://debbugs.gnu.org/13594
(display-buffer-overriding-action
@@ -831,41 +831,33 @@ Global and Emacs."
"Save current search session to register R.
Use \\[jump-to-register] to restore the search session."
(interactive (list (ggtags-ensure-global-buffer
- (register-read-with-preview
- (format "Save search in `%s' to register: "
(buffer-name))))))
+ (register-read-with-preview "Save search to register:
"))))
(ggtags-ensure-global-buffer
- (rename-buffer (format "*ggtags %s*" ggtags-current-tag-name) t)
- (cl-labels ((move-to-error (buf line)
- (with-current-buffer buf
- (goto-char (point-min))
- (forward-line (1- line))
- (setq ggtags-global-last-buffer
(current-buffer))
- (ggtags-navigation-mode 1)
- (setq compilation-current-error (point))
- (compile-goto-error)))
- (jump (data)
+ (cl-labels ((jump (data)
+ (pcase data
+ (`(,command ,root ,line)
+ (with-current-buffer
+ (let ((ggtags-auto-jump-to-first-match nil)
+ ;; Switch current project to ROOT.
+ (default-directory root)
+ (ggtags-project-root root))
+ (ggtags-global-start command root))
+ (add-hook 'compilation-finish-functions
+ (lambda (buf _msg)
+ (with-current-buffer buf
+ (goto-char (point-min))
+ (forward-line (1- line))
+ (compile-goto-error)))
+ nil t)))))
+ (prn (data)
(pcase data
- (`(,buf ,line ,command ,root)
- (if (get-buffer buf)
- (progn
- (ggtags-global--display-buffer buf)
- (move-to-error buf line))
- (with-current-buffer
- (let ((ggtags-auto-jump-to-first-match nil))
- (ggtags-global-start command root))
- (add-hook 'compilation-finish-functions
- (lambda (buf _msg) (move-to-error buf
line))
- nil t)
- (rename-buffer buf))))))
- (prn (data)
- (pcase data
- (`(,_buf ,line ,command ,root)
- (princ (format "a ggtags search session `%s' in
directory `%s' at line %d."
- command root line))))))
- (set-register r (registerv-make
- (list (buffer-name) (line-number-at-pos)
- (car compilation-arguments) default-directory)
- :jump-func #'jump :print-func #'prn)))))
+ (`(,command ,root ,line)
+ (princ (format "a ggtags search session `%s' in
directory `%s' at line %d."
+ command root line))))))
+ (set-register r (registerv-make
+ (list (car compilation-arguments) default-directory
+ (line-number-at-pos))
+ :jump-func #'jump :print-func #'prn)))))
(defun ggtags-delete-tag-files ()
"Delete the tag files generated by gtags."
@@ -1120,7 +1112,7 @@ Use \\[jump-to-register] to restore the search session."
(let ((buffer (or buffer (current-buffer))))
(unless (get-buffer-window buffer)
(let* ((split-window-preferred-function ggtags-split-window-function)
- (w (display-buffer (current-buffer) '(nil (allow-no-window .
t)))))
+ (w (display-buffer buffer '(nil (allow-no-window . t)))))
(and w (compilation-set-window-height w))))))
(defvar ggtags-navigation-mode)
@@ -1185,7 +1177,7 @@ Use \\[jump-to-register] to restore the search session."
(list ggtags-global-output-format))
(setq-local compilation-auto-jump-to-first-error
ggtags-auto-jump-to-first-match)
- (setq-local compilation-scroll-output 'first-error)
+ (setq-local compilation-scroll-output nil)
;; See `compilation-move-to-column' for details.
(setq-local compilation-first-column 0)
(setq-local compilation-error-screen-columns nil)
- [elpa] 05/38: Improve completion support for all tag types, (continued)
- [elpa] 05/38: Improve completion support for all tag types, Leo Liu, 2014/03/24
- [elpa] 11/38: Make last change acutally work, Leo Liu, 2014/03/24
- [elpa] 12/38: Fix compatibility for locate-dominating-file, Leo Liu, 2014/03/24
- [elpa] 14/38: Display project root directory name on mode-line, Leo Liu, 2014/03/24
- [elpa] 22/38: New command ggtags-navigation-isearch-forward, Leo Liu, 2014/03/24
- [elpa] 17/38: Fix ggtags-with-current-project to include GTAGSCONF, Leo Liu, 2014/03/24
- [elpa] 19/38: Use read-only-mode in ggtags-toggle-project-read-only, Leo Liu, 2014/03/24
- [elpa] 18/38: Fix #36: Allow customising path to global's exectuables, Leo Liu, 2014/03/24
- [elpa] 20/38: Teach ggtags-find-tag-dwim to detect #include files, Leo Liu, 2014/03/24
- [elpa] 25/38: Fix ggtags-find-project to check on the GTAGS file, Leo Liu, 2014/03/24
- [elpa] 23/38: Simplify ggtags-save-to-register by always re-do the search,
Leo Liu <=
- [elpa] 21/38: Add new command ggtags-save-to-register for #37, Leo Liu, 2014/03/24
- [elpa] 16/38: Fix ggtags-show-definition to run in current project, Leo Liu, 2014/03/24
- [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