From 89228b6326a9b75e844ec44dc55faa0790a519c2 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Thu, 3 Apr 2003 15:57:45 +0000 Subject: [PATCH] Require button.el. (etags-tags-apropos): Use make-text-button instead of add-text-properties. Use snarf-tag-function and etags-goto-tag-location instead of find-tag-other-window (it's too simple). --- lisp/ChangeLog | 10 +++++++++- lisp/progmodes/etags.el | 52 +++++++++++++++++++++++++++++++++++++------------ 2 files changed, 49 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d11f0377e0b..bdd5a6d951b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,4 +1,12 @@ -2003-04-03 Kenichi Handa +2003-04-03 Masatake YAMATO + + * progmodes/etags.el: Require button.el. + (etags-tags-apropos): Use `make-text-button' instead of + `add-text-properties'. Use `snarf-tag-function' and + `etags-goto-tag-location' instead of `find-tag-other-window' (it's + too simple). + +2003-04-03 Kenichi Handa * subr.el (number-sequence): New function. diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index c91d18418d8..471be32401a 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -29,6 +29,7 @@ ;;; Code: (require 'ring) +(require 'button) ;;;###autoload (defvar tags-file-name nil @@ -1413,16 +1414,41 @@ where they were found." (goto-char (point-min)) (while (re-search-forward string nil t) (beginning-of-line) - (let ((tag (buffer-substring (point) - (progn (skip-chars-forward "^\177") - (point)))) - (props `(action find-tag-other-window mouse-face highlight - face ,tags-tag-face)) - (pt (with-current-buffer standard-output (point)))) - (princ tag) - (when (= (aref tag 0) ?\() (princ " ...)")) - (add-text-properties pt (with-current-buffer standard-output (point)) - `(item ,tag ,@props) standard-output)) + (let* ((tag-info (save-excursion (funcall snarf-tag-function))) + (tag (if (eq t (car tag-info)) nil (car tag-info))) + (file (if tag (file-of-tag) + (save-excursion (next-line 1) + (file-of-tag)))) + (pt (with-current-buffer standard-output (point)))) + (if tag + (progn + (princ (format "[%s]: " file)) + (princ tag) + (when (= (aref tag 0) ?\() (princ " ...)")) + (with-current-buffer standard-output + (make-text-button pt (point) + 'tag-info tag-info + 'file file + 'action (lambda (button) + ;; TODO: just `find-file is too simple. + ;; Use code `find-tag-in-order'. + (let ((tag-info (button-get button 'tag-info))) + (find-file (button-get button 'file)) + (etags-goto-tag-location tag-info))) + 'face 'tags-tag-face + 'type 'button))) + (princ (format "- %s" file)) + (with-current-buffer standard-output + (make-text-button pt (point) + 'file file + 'action (lambda (button) + ;; TODO: just `find-file is too simple. + ;; Use code `find-tag-in-order'. + (find-file (button-get button 'file)) + (goto-char (point-min))) + 'face 'tags-tag-face + 'type 'button)) + )) (terpri) (forward-line 1)) (when tags-apropos-verbose (princ "\n"))) @@ -1814,8 +1840,10 @@ directory specification." (funcall tags-apropos-function regexp)))) (etags-tags-apropos-additional regexp)) (with-current-buffer "*Tags List*" - (setq buffer-read-only t) - (apropos-mode))) + (apropos-mode) + ;; apropos-mode is derived from fundamental-mode and it kills + ;; all local variables. + (setq buffer-read-only t))) ;; XXX Kludge interface. -- 2.11.4.GIT