X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fetags.el;h=0c368cb9329f1c0d34fb5006f1f372644324d198;hb=79e5742714df117d8eb914604aa6947fccba38fa;hp=5edc1d46483e63cec3652b3bc2a4ca404f998e55;hpb=b267e52aa03bee2c488c8a78824d96cf2d9a6ccc;p=chise%2Fxemacs-chise.git.1 diff --git a/lisp/etags.el b/lisp/etags.el index 5edc1d4..0c368cb 100644 --- a/lisp/etags.el +++ b/lisp/etags.el @@ -52,7 +52,7 @@ ;; Kyle Jones ;; added "Exact match, then inexact" code ;; added support for include directive. -;; Hrvoje Niksic +;; Hrvoje Niksic ;; various changes. @@ -190,9 +190,12 @@ the current buffer." (when (file-readable-p parent-tag-file) (push parent-tag-file result))) ;; tag-table-alist - (let ((key (or buffer-file-name - (concat default-directory (buffer-name)))) - expression) + (let* ((key (or buffer-file-name + (concat default-directory (buffer-name)))) + (key (if (eq system-type 'windows-nt) + (replace-in-string key "\\\\" "/") + key)) + expression) (dolist (item tag-table-alist) (setq expression (car item)) ;; If the car of the alist item is a string, apply it as a regexp @@ -405,7 +408,7 @@ File name returned is relative to tag table file's directory." (defun buffer-tag-table-files () "Returns a list of all files referenced by all TAGS tables that this buffer uses." - (apply #'nconc + (apply #'append (mapcar #'tag-table-files (buffer-tag-table-list)))) @@ -502,6 +505,7 @@ this buffer uses." ((string-match "\\.scm\\'" filename) 'scheme-mode) (t nil))) + (defvar c-mode-syntax-table) (set-syntax-table (cond ((and (eq file-type 'c-mode) c-mode-syntax-table) c-mode-syntax-table) @@ -554,7 +558,7 @@ Make it buffer-local in a mode hook. The function is called with no arguments.") (defvar find-tag-hook nil - "Function to call after a tag is found. + "*Function to call after a tag is found. Make it buffer-local in a mode hook. The function is called with no arguments.") @@ -598,11 +602,8 @@ Make it buffer-local in a mode hook. The function is called with no (format "%s(default %s) " prompt default) prompt) tag-completion-table 'tag-completion-predicate nil nil - 'find-tag-history)) - (if (string-equal tag-name "") - ;; #### - This is a really LAME way of doing it! --Stig - default ;indicate exact symbol match - tag-name))) + 'find-tag-history default)) + tag-name)) (defvar last-tag-data nil "Information for continuing a tag search. @@ -641,7 +642,7 @@ If it returns non-nil, this file needs processing by evalling (t (setq tag-table-currently-matching-exact t))) ;; \_ in the tagname is used to indicate a symbol boundary. - (setq exact-tagname (concat "\\_" tagname "\\_")) + (setq exact-tagname (format "\C-?\\_%s\\_\C-a\\|\\_%s\\_" tagname tagname)) (while (string-match "\\\\_" exact-tagname) (aset exact-tagname (1- (match-end 0)) ?b)) (save-excursion @@ -674,7 +675,9 @@ If it returns non-nil, this file needs processing by evalling ;; tag searches? (while (re-search-forward tag-target nil t) (and (save-match-data - (looking-at "[^\n\C-?]*\C-?")) + (save-excursion + (goto-char (match-beginning 0)) + (looking-at "[^\n\C-?]*\C-?"))) ;; If we're looking for inexact matches, skip ;; exact matches since we've visited them ;; already. @@ -693,6 +696,7 @@ If it returns non-nil, this file needs processing by evalling (if next "more " "") (if exact "matching" "containing") tagname)) + (beginning-of-line) (search-forward "\C-?") (setq file (expand-file-name (file-of-tag) ;; In XEmacs, this needs to be @@ -735,6 +739,16 @@ If it returns non-nil, this file needs processing by evalling (cons buf startpos)))) ;;;###autoload +(defun find-tag-at-point (tagname &optional other-window) + "*Find tag whose name contains TAGNAME. +Identical to `find-tag' but does not prompt for tag when called interactively; +instead, uses tag around or before point." + (interactive (if current-prefix-arg + '(nil nil) + (list (find-tag-default) nil))) + (find-tag tagname other-window)) + +;;;###autoload (defun find-tag (tagname &optional other-window) "*Find tag whose name contains TAGNAME. Selects the buffer that the tag is contained in @@ -747,7 +761,8 @@ in the tag table that matches the tagname used in the previous find-tag. the tag. This version of this function supports multiple active tags tables, -and completion. +and completion. See also the commands `\\[push-tag-mark]' and +`\\[pop-tag-mark]'. Variables of note: @@ -771,23 +786,23 @@ Variables of note: '(find-tag find-tag-other-window tags-loop-continue)))) (push-tag-mark)) (if other-window - (pop-to-buffer tag-buf) + (pop-to-buffer tag-buf t) (switch-to-buffer tag-buf)) (widen) (push-mark) (goto-char tag-point) (if find-tag-hook - (funcall find-tag-hook) + (run-hooks 'find-tag-hook) (if local-find-tag-hook - (funcall local-find-tag-hook)))) + (run-hooks 'local-find-tag-hook)))) (setq tags-loop-scan (list 'find-tag nil nil) - tags-loop-operate nil) + tags-loop-operate nil) ;; Return t in case used as the tags-loop-scan. t) ;;;###autoload (defun find-tag-other-window (tagname &optional next) - "*Find tag whose name contains TAGNAME. + "*Find tag whose name contains TAGNAME, in another window. Selects the buffer that the tag is contained in in another window and puts point at its definition. If TAGNAME is a null string, the expression in the buffer @@ -1064,7 +1079,7 @@ See documentation of variable `tag-table-alist'." ;; Sample uses of find-tag-hook and find-tag-default-hook -;; This is wrong. We should either make this behaviour default and +;; This is wrong. We should either make this behavior default and ;; back it up, or not use it at all. For now, I've commented it out. ;; --hniksic @@ -1156,7 +1171,7 @@ If this is a C-defined elisp function, it does something more clever." (defcustom tag-mark-stack-max 16 "*The maximum number of elements kept on the mark-stack used by tags-search. See also the commands `\\[push-tag-mark]' and -and `\\[pop-tag-mark]'." +`\\[pop-tag-mark]'." :type 'integer :group 'etags) @@ -1189,6 +1204,7 @@ and `\\[pop-tag-mark]'." ;;;###autoload (define-key esc-map "*" 'pop-tag-mark) +;;;###autoload (defun pop-tag-mark (arg) "Go to last tag position. `find-tag' maintains a mark-stack seperate from the \\[set-mark-command] mark-stack. @@ -1203,3 +1219,5 @@ This function pops (and moves to) the tag at the top of this stack." (provide 'etags) (provide 'tags) + +;;; etags.el ends here