-2003-04-03 Kenichi Handa <handa@etlken2>
+2003-04-03 Masatake YAMATO <jet@gyve.org>
+
+ * 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 <handa@m17n.org>
* subr.el (number-sequence): New function.
;;; Code:
(require 'ring)
+(require 'button)
;;;###autoload
(defvar tags-file-name nil
(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")))
(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)))
\f
;; XXX Kludge interface.