🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Joe Hellerstein Wed, 24 Jun 1992 11:22
bring up tags in another screen
#1258
Author: Joe Hellerstein
Date: Wed, 24 Jun 1992 11:22
7 lines
824 bytes
Anybody have a quick hack to make tags references open in another
epoch screen?  How about making that epoch screen use a different font
(in order to keep it size down)?  I saw something similar recently for
help files, but promptly deleted it.

Thanks in advance,
Joe
Re: bring up tags in another screen
#1261
Author: Edward S. Hirgelt
Date: Wed, 24 Jun 1992 22:08
106 lines
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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads