Article View: gnu.epoch.misc
Article #1261Re: bring up tags in another screen
From: Edward S. Hirgelt
Date: Wed, 24 Jun 1992 22:08
Date: Wed, 24 Jun 1992 22:08
106 lines
4318 bytes
4318 bytes
On 24 Jun 92 11:22:01,
joey@berkeley.edu (Joe Hellerstein) said:
Joe> Anybody have a quick hack to make tags references open in another
Joe> epoch screen?
Here's what I have that seems to work pretty well. It doesn't allow you
to change font sizes or anything, it just uses find-file-other-screen. I
took the source to find-tag and improved it a bit. There is lots you can
do to make it slicker, but for now this works.
Enjoy...
Ed
;;; Let tags go to a separate screen. We redefine find-tag to take
;;; 'screen as an optional third argument as well as t for other-window.
(require 'tags)
(defun find-tag (tagname &optional next other-window)
"Find tag (in current tag table) whose name contains TAGNAME.
Selects the buffer that the tag is contained in
and puts point at its definition.
If TAGNAME is a null string, the expression in the buffer
around or before point is used as the tag name.
If second arg NEXT is non-nil (interactively, with prefix arg),
searches for the next tag in the tag table
that matches the tagname used in the previous find-tag.
If OTHER-WINDOW is nil, the tag will be displayed in the current
window, if t, in another window, and if 'screen, in a separate epoch
screen.
See documentation of variable tags-file-name."
(interactive (if current-prefix-arg
'(nil t)
(find-tag-tag "Find tag: ")))
(let (buffer file linebeg startpos)
(save-excursion
(visit-tags-table-buffer)
(if (not next)
(goto-char (point-min))
(setq tagname last-tag))
(setq last-tag tagname)
(while (progn
(if (not (search-forward tagname nil t))
(error "No %sentries containing %s"
(if next "more " "") tagname))
(not (looking-at "[^\n\177]*\177"))))
(search-forward "\177")
(setq file (expand-file-name (file-of-tag)
(file-name-directory tags-file-name)))
(setq linebeg
(buffer-substring (1- (point))
(save-excursion (beginning-of-line) (point))))
(search-forward ",")
(setq startpos (read (current-buffer))))
(if other-window
(if (eq other-window 'screen)
(find-file-other-screen file)
(find-file-other-window file))
(find-file file))
(widen)
(push-mark)
(let ((offset 1000)
found
(pat (concat "^" (regexp-quote linebeg))))
(or startpos (setq startpos (point-min)))
(while (and (not found)
(progn
(goto-char (- startpos offset))
(not (bobp))))
(setq found
(re-search-forward pat (+ startpos offset) t))
(setq offset (* 3 offset)))
(or found
(re-search-forward pat nil t)
(error "%s not found in %s" pat file)))
(beginning-of-line))
(setq tags-loop-form '(find-tag nil t))
;; Return t in case used as the tags-loop-form.
t)
(defun find-tag-other-screen (tagname &optional next)
"Find tag (in current tag table) whose name contains TAGNAME.
Selects the buffer that the tag is contained in in another window
and puts point at its definition.
If TAGNAME is a null string, the expression in the buffer
around or before point is used as the tag name.
If second arg NEXT is non-nil (interactively, with prefix arg),
searches for the next tag in the tag table
that matches the tagname used in the previous find-tag.
See documentation of variable tags-file-name."
(interactive (if current-prefix-arg
'(nil t)
(find-tag-tag "Find tag other screen ")))
(find-tag tagname next 'screen))
(define-key global-map "\M-." 'find-tag-other-screen)
--
Ed Hirgelt esh@tss.com
Direct Interfaces Corporation
San Jose, Ca.
Technical Details
Message-ID:
<ESH.92Jun24140839@lithium.tekbspa.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!tekbspa!tekbspa!eshReferences:
<JOEY.92Jun24112201@elysium.berkeley.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc7ee,1ef74bc3ec993741 X-Google-Attributes: gidfc7ee,public X-Google-ArrivalTime: 1992-06-24 09:42:18 PST Newsgroups: gnu.epoch.misc Path: arc1-ca.pugleaf.net!sparky!uunet!tekbspa!tekbspa!esh From: esh@lithium.tekbspa.com (Edward S. Hirgelt) Subject: Re: bring up tags in another screen In-Reply-To: joey@berkeley.edu's message of 24 Jun 92 11:22:01 Message-ID: <ESH.92Jun24140839@lithium.tekbspa.com> Sender: news@tss.com (USENET Network News) Organization: Direct Interfaces Corporation @ Teknekron References: <JOEY.92Jun24112201@elysium.berkeley.edu> Distribution: gnu Date: Wed, 24 Jun 1992 22:08:39 GMT Lines: 106