jcgs@harlqn.UUCP (John Sturdy) (09/28/88)
Here is a program I find useful, particularly when working on programs
which have long names in them. It reads your current TAGS table to make
completion lists for typing tag names. (I've set up a control-x-3 keymap
for non-standard bindings - does this conflict with any ancient conventions?)
--- cut here for tags-helper.el ---
;;; Last edited: Wed Jun 1 12:17:33 1988 by jcgs (John Sturdy) on harlqn
(provide 'tags-helper)
(defvar tags-name-list nil
"alist of names defined in the TAGS file.")
(defun make-tags-name-list ()
"Make the tags name list from the current tags file."
(interactive)
(if (null tags-file-name)
(call-interactively (symbol-function 'visit-tags-table)))
(message "Making tag list...")
(save-window-excursion
(find-file tags-file-name)
(setq tags-name-list nil)
(save-excursion
(goto-char (point-min))
(while (search-forward "" (point-max) t)
(progn
(re-search-backward "[-A-Za-z0-9_]")
(let ((end-of-name (1+ (point))))
(re-search-backward "[\C-i( ]") ; should be any non-symbol-char
(setq tags-name-list (cons
(cons
(buffer-substring end-of-name (1+ (point)))
nil)
tags-name-list)))
(end-of-line 1)))
(message "Making tag list... done"))))
(defun insert-tag-name (remake)
"Insert a name from the current tags name list. With prefix arg, remake
the tags name list first."
(interactive "P")
(if (or remake (null tags-name-list))
(make-tags-name-list))
(insert (completing-read "Tag name: " tags-name-list)))
(defvar show-tag-time 15
"*How long to display a tag definition for.")
(defun lookup-tag (use-rec-edit)
"Show a tag from the current tags name list in the other window for
reference, then restore the window layout after a pause. With prefix
arg, go into a recursive edit instead of pausing."
(interactive "P")
(save-window-excursion
(save-excursion
(find-tag-other-window (completing-read "Tag name: " tags-name-list))
(if use-rec-edit
(recursive-edit)
(sit-for show-tag-time)))))
;;; end of tags-helper.el
--- cut here for end of tags-helper.el ---
| The Lord bless you and watch over you,
__ John ----+---- The Lord make his face shine upon you
| and be gracious to you,
jcgs@uk.co.harlqn | The Lord look kindly on you
Harlequin Ltd, | and give you peace;
Barrington Hall, | My brothers, my sisters, God bless you.
Barrington, Cambridge, England | Amen (St. Francis, after Numbers 6:24)
Tel: +44-223-872522