[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gtags.el : find tag in other window
From: |
klchxbec |
Subject: |
gtags.el : find tag in other window |
Date: |
Thu, 21 Aug 2008 12:47:40 +0200 |
User-agent: |
freenetMail |
Hello,
People like me who use split windows often in emacs will find this patch
useful. This patch introduces
gtags-find-tag-other-window (bound to C-x-4-.) which is like
find-tag-other-window for etags.
It also creates a keybinding of C-o in GTAGS SELECT buffer which can be used to
split
windows, analogous to list-buffers window in emacs. Please include this patch
in the next
release of global.
-K. Chowksey
--- gtags.el.bak 2008-08-21 16:08:38.000000000 +0530
+++ gtags.el 2008-08-21 16:16:59.000000000 +0530
@@ -71,6 +71,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.
;
@@ -119,6 +120,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)
;;
@@ -243,7 +245,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)
@@ -256,7 +258,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."
@@ -375,11 +382,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."
@@ -427,7 +439,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 save prefix buffer lines)
(setq save (current-buffer))
; Use always ctags-x format.
@@ -478,13 +490,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)
@@ -502,7 +514,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)
@@ -538,6 +554,8 @@
\[gtags-display-browser]
Get the expression as a tagname around here and move there.
\[gtags-find-tag-by-event]
+Input tag name and move to the definition in other window.
+ \[gtags-find-tag-other-window]
Move to previous point on the stack.
\[gtags-pop-stack]
Unbegrenzter Speicher, Top-Spamschutz, 120 SMS und eigene E-MailDomain inkl.
http://office.freenet.de/dienste/emailoffice/produktuebersicht/power/mail/index.html
- gtags.el : find tag in other window,
klchxbec <=