diff options
| author | Juanma Barranquero | 2003-04-03 15:57:45 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2003-04-03 15:57:45 +0000 |
| commit | 89228b6326a9b75e844ec44dc55faa0790a519c2 (patch) | |
| tree | 620a5b74bc25656e6758593050f7bb658e3704fa | |
| parent | 500e05aa159e139cca31800e796452a0c58f8861 (diff) | |
| download | emacs-89228b6326a9b75e844ec44dc55faa0790a519c2.tar.gz emacs-89228b6326a9b75e844ec44dc55faa0790a519c2.zip | |
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).
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2003-04-03 Kenichi Handa <handa@etlken2> | 1 | 2003-04-03 Masatake YAMATO <jet@gyve.org> |
| 2 | |||
| 3 | * progmodes/etags.el: Require button.el. | ||
| 4 | (etags-tags-apropos): Use `make-text-button' instead of | ||
| 5 | `add-text-properties'. Use `snarf-tag-function' and | ||
| 6 | `etags-goto-tag-location' instead of `find-tag-other-window' (it's | ||
| 7 | too simple). | ||
| 8 | |||
| 9 | 2003-04-03 Kenichi Handa <handa@m17n.org> | ||
| 2 | 10 | ||
| 3 | * subr.el (number-sequence): New function. | 11 | * subr.el (number-sequence): New function. |
| 4 | 12 | ||
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 @@ | |||
| 29 | ;;; Code: | 29 | ;;; Code: |
| 30 | 30 | ||
| 31 | (require 'ring) | 31 | (require 'ring) |
| 32 | (require 'button) | ||
| 32 | 33 | ||
| 33 | ;;;###autoload | 34 | ;;;###autoload |
| 34 | (defvar tags-file-name nil | 35 | (defvar tags-file-name nil |
| @@ -1413,16 +1414,41 @@ where they were found." | |||
| 1413 | (goto-char (point-min)) | 1414 | (goto-char (point-min)) |
| 1414 | (while (re-search-forward string nil t) | 1415 | (while (re-search-forward string nil t) |
| 1415 | (beginning-of-line) | 1416 | (beginning-of-line) |
| 1416 | (let ((tag (buffer-substring (point) | 1417 | (let* ((tag-info (save-excursion (funcall snarf-tag-function))) |
| 1417 | (progn (skip-chars-forward "^\177") | 1418 | (tag (if (eq t (car tag-info)) nil (car tag-info))) |
| 1418 | (point)))) | 1419 | (file (if tag (file-of-tag) |
| 1419 | (props `(action find-tag-other-window mouse-face highlight | 1420 | (save-excursion (next-line 1) |
| 1420 | face ,tags-tag-face)) | 1421 | (file-of-tag)))) |
| 1421 | (pt (with-current-buffer standard-output (point)))) | 1422 | (pt (with-current-buffer standard-output (point)))) |
| 1422 | (princ tag) | 1423 | (if tag |
| 1423 | (when (= (aref tag 0) ?\() (princ " ...)")) | 1424 | (progn |
| 1424 | (add-text-properties pt (with-current-buffer standard-output (point)) | 1425 | (princ (format "[%s]: " file)) |
| 1425 | `(item ,tag ,@props) standard-output)) | 1426 | (princ tag) |
| 1427 | (when (= (aref tag 0) ?\() (princ " ...)")) | ||
| 1428 | (with-current-buffer standard-output | ||
| 1429 | (make-text-button pt (point) | ||
| 1430 | 'tag-info tag-info | ||
| 1431 | 'file file | ||
| 1432 | 'action (lambda (button) | ||
| 1433 | ;; TODO: just `find-file is too simple. | ||
| 1434 | ;; Use code `find-tag-in-order'. | ||
| 1435 | (let ((tag-info (button-get button 'tag-info))) | ||
| 1436 | (find-file (button-get button 'file)) | ||
| 1437 | (etags-goto-tag-location tag-info))) | ||
| 1438 | 'face 'tags-tag-face | ||
| 1439 | 'type 'button))) | ||
| 1440 | (princ (format "- %s" file)) | ||
| 1441 | (with-current-buffer standard-output | ||
| 1442 | (make-text-button pt (point) | ||
| 1443 | 'file file | ||
| 1444 | 'action (lambda (button) | ||
| 1445 | ;; TODO: just `find-file is too simple. | ||
| 1446 | ;; Use code `find-tag-in-order'. | ||
| 1447 | (find-file (button-get button 'file)) | ||
| 1448 | (goto-char (point-min))) | ||
| 1449 | 'face 'tags-tag-face | ||
| 1450 | 'type 'button)) | ||
| 1451 | )) | ||
| 1426 | (terpri) | 1452 | (terpri) |
| 1427 | (forward-line 1)) | 1453 | (forward-line 1)) |
| 1428 | (when tags-apropos-verbose (princ "\n"))) | 1454 | (when tags-apropos-verbose (princ "\n"))) |
| @@ -1814,8 +1840,10 @@ directory specification." | |||
| 1814 | (funcall tags-apropos-function regexp)))) | 1840 | (funcall tags-apropos-function regexp)))) |
| 1815 | (etags-tags-apropos-additional regexp)) | 1841 | (etags-tags-apropos-additional regexp)) |
| 1816 | (with-current-buffer "*Tags List*" | 1842 | (with-current-buffer "*Tags List*" |
| 1817 | (setq buffer-read-only t) | 1843 | (apropos-mode) |
| 1818 | (apropos-mode))) | 1844 | ;; apropos-mode is derived from fundamental-mode and it kills |
| 1845 | ;; all local variables. | ||
| 1846 | (setq buffer-read-only t))) | ||
| 1819 | 1847 | ||
| 1820 | ;; XXX Kludge interface. | 1848 | ;; XXX Kludge interface. |
| 1821 | 1849 | ||