bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gtags.el : find tag in other window


From: klchxbec
Subject: Re: gtags.el : find tag in other window
Date: Thu, 28 Aug 2008 17:15:01 +0200
User-agent: freenetMail

> (2) When the target is two or more. 
> 
> (Invoke gtags-find-tag-other-window)
> 
> Find tag: main                  <- GLOBAL has 8 main.
> 
>         => display [GTAGS SELECT MODE] in CURRENT window
> 
> (Select a tag)

You should press C-o to show the result in other window, not just the C-m 
(enter) key. This is very
similar to emacs's list-buffers command where C-m is the some window and C-o is 
the other window.

>         => display the result in CURRENT window
>            (???)
> If possible, would you please use the cvs version of gtags.el?

Sorry about that. I made the cvs patch :

===================================================================
RCS file: /sources/global/global/gtags.el,v
retrieving revision 1.19
diff -u -r1.19 gtags.el
--- gtags.el    8 Jul 2008 07:01:41 -0000       1.19
+++ gtags.el    28 Aug 2008 15:10:01 -0000
@@ -116,6 +116,7 @@
 ;
 (define-key gtags-mode-map "e*" 'gtags-pop-stack)
 (define-key gtags-mode-map "e." 'gtags-find-tag)
+(define-key gtags-mode-map "C-x4." 'gtags-find-tag-other-window)
 ;
 ; Old key assignment.
 ;
@@ -164,6 +165,7 @@
 (define-key gtags-select-mode-map "u" 'gtags-pop-stack)
 (define-key gtags-select-mode-map "C-t" 'gtags-pop-stack)
 (define-key gtags-select-mode-map "C-m" 'gtags-select-tag)
+(define-key gtags-select-mode-map "C-o" 'gtags-select-tag-other-window)
 (define-key gtags-select-mode-map "e." 'gtags-select-tag)
 
 ;;
@@ -278,7 +280,7 @@
        (setq gtags-rootdir (expand-file-name input))
        (setenv "GTAGSROOT" gtags-rootdir)))))
 
-(defun gtags-find-tag ()
+(defun gtags-find-tag (&optional other-win)
   "Input tag name and move to the definition."
   (interactive)
   (let (tagname prompt input)
@@ -291,7 +293,12 @@
     (if (not (equal "" input))
       (setq tagname input))
     (gtags-push-context)
-    (gtags-goto-tag tagname "")))
+    (gtags-goto-tag tagname "" other-win)))
+
+(defun gtags-find-tag-other-window ()
+  "Input tag name and move to the definition in other window."
+  (interactive)
+  (gtags-find-tag t))
 
 (defun gtags-find-rtag ()
   "Input tag name and move to the referenced point."
@@ -400,11 +407,16 @@
       (gtags-push-context)
       (gtags-goto-tag tagname flag))))
 
-(defun gtags-select-tag ()
+(defun gtags-select-tag (&optional other-win)
   "Select a tag in [GTAGS SELECT MODE] and move there."
   (interactive)
   (gtags-push-context)
-  (gtags-select-it nil))
+  (gtags-select-it nil other-win))
+
+(defun gtags-select-tag-other-window ()
+  "Select a tag in [GTAGS SELECT MODE] and move there in other window."
+  (interactive)
+  (gtags-select-tag t))
 
 (defun gtags-select-tag-by-event (event)
   "Select a tag in [GTAGS SELECT MODE] and move there."
@@ -456,7 +468,7 @@
     (gtags-goto-tag tagname flag)))
 
 ;; goto tag's point
-(defun gtags-goto-tag (tagname flag)
+(defun gtags-goto-tag (tagname flag &optional other-win)
   (let (option context save prefix buffer lines)
     (setq save (current-buffer))
     ; Use always ctags-x format.
@@ -522,13 +534,13 @@
        (set-buffer save))
        ((= 1 lines)
        (message "Searching %s ... Done" tagname)
-       (gtags-select-it t))
+       (gtags-select-it t other-win))
        (t
        (switch-to-buffer buffer)
        (gtags-select-mode))))))
 
 ;;  lines
-(defun gtags-select-it (delete)
+(defun gtags-select-it (delete &optional other-win)
   (let (line file)
     ;; get context from current tag line
     (beginning-of-line)
@@ -546,7 +558,11 @@
       ;; 
       (let ((prev-buffer (current-buffer)))
         ;; move to the context
-        (if gtags-read-only (find-file-read-only file) (find-file file))
+        (if gtags-read-only 
+           (if (null other-win) (find-file-read-only file) 
+             (find-file-read-only-other-window file))
+         (if (null other-win) (find-file file)
+           (find-file-other-window file)))
         (if delete (kill-buffer prev-buffer)))
       (setq gtags-current-buffer (current-buffer))
       (goto-line line)
@@ -566,6 +582,8 @@
        \[gtags-visit-rootdir]
 Input tag name and move to the definition.
        \[gtags-find-tag]
+Input tag name and move to the definition in other window.
+       \[gtags-find-tag-other-window]
 Input tag name and move to the referenced point.
        \[gtags-find-rtag]
 Input symbol and move to the locations.




Gratis: Jeden Monat 3 SMS versenden-
Mit freenetMail - Ihrer kostenlose E-Mail-Adresse
http://email.freenet.de/dienste/emailoffice/produktuebersicht/basic/sms/index.html?pid=6830





reply via email to

[Prev in Thread] Current Thread [Next in Thread]