emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

broken tags-apropos


From: Masatake YAMATO
Subject: broken tags-apropos
Date: Wed, 02 Apr 2003 03:51:45 +0900 (JST)

It seems that tags-apropos is broken.
tags-apropos doesn't work well with new apropos-mode which
is based on button.el.

I've tried to update tags-apropos to work well with new 
apropos-mode. There are still some codes in etags.el which
depends on old apropos-mode. I'll continue working on etags.el.

In addition, I put a file name for each item in *Tags List* buffer,
the result of tags-apropos. If the source code files(etags target)
contain the symbols which has the same name, you want to distinguish
them from file names. 

Masatake YAMATO

2003-04-02  Masatake YAMATO  <address@hidden>

        * 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.
        find-tag-other-window is too simple.

Index: lisp/progmodes/etags.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/etags.el,v
retrieving revision 1.171
diff -u -r1.171 etags.el
--- lisp/progmodes/etags.el     11 Feb 2003 21:40:17 -0000      1.171
+++ lisp/progmodes/etags.el     1 Apr 2003 19:09:38 -0000
@@ -29,6 +29,7 @@
 ;;; Code:
 
 (require 'ring)
+(require 'button)
 
 ;;;###autoload
 (defvar tags-file-name nil
@@ -1413,16 +1414,41 @@
   (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 @@
          (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.
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]