X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/84eb0351d8be4811897c8cf62a69757ff5d14001..51751aa26f9935609630f04e781a954b54ecc82e:/lisp/progmodes/etags.el diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index d22d03fbe9..a330007790 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -263,7 +263,7 @@ One argument, the tag info returned by `snarf-tag-function'.") (defun initialize-new-tags-table () "Initialize the tags table in the current buffer. Return non-nil if it is a valid tags table, and -in that case, also make the tags table state variables +in that case, also make the tags table state variables buffer-local and set them to nil." (set (make-local-variable 'tags-table-files) nil) (set (make-local-variable 'tags-completion-table) nil) @@ -812,7 +812,7 @@ If no tags table is loaded, do nothing and return nil." (search-backward pattern) ;FIXME: will fail if we're inside pattern. (setq beg (point)) (forward-char (length pattern)) - (list beg (point) (tags-lazy-completion-table))))))) + (list beg (point) (tags-lazy-completion-table) :exclusive 'no)))))) (defun find-tag-tag (string) "Read a tag name, with defaulting and completion." @@ -853,6 +853,7 @@ The functions using this are `find-tag-noselect', ;; Dynamic bondage: (defvar etags-case-fold-search) (defvar etags-syntax-table) +(defvar local-find-tag-hook) ;;;###autoload (defun find-tag-noselect (tagname &optional next-p regexp-p) @@ -1259,11 +1260,11 @@ buffer-local values of tags table format variables." (defun etags-file-of-tag (&optional relative) ; Doc string? (save-excursion (re-search-backward "\f\n\\([^\n]+\\),[0-9]*\n") - (let ((str (buffer-substring (match-beginning 1) (match-end 1)))) + (let ((str (convert-standard-filename + (buffer-substring (match-beginning 1) (match-end 1))))) (if relative str - (expand-file-name str - (file-truename default-directory)))))) + (expand-file-name str (file-truename default-directory)))))) (defun etags-tags-completion-table () ; Doc string? @@ -1544,7 +1545,9 @@ hits the start of file." (end-of-line) (skip-chars-backward "^," beg) (or (looking-at "include$") - (setq files (cons (buffer-substring beg (1- (point))) files)))) + (push (convert-standard-filename + (buffer-substring beg (1- (point)))) + files))) (nreverse files))) (defun etags-tags-included-tables () ; Doc string? @@ -1555,10 +1558,11 @@ hits the start of file." (setq beg (point)) (end-of-line) (skip-chars-backward "^," beg) - (if (looking-at "include$") - ;; Expand in the default-directory of the tags table buffer. - (setq files (cons (expand-file-name (buffer-substring beg (1- (point)))) - files)))) + (when (looking-at "include$") + ;; Expand in the default-directory of the tags table buffer. + (push (expand-file-name (convert-standard-filename + (buffer-substring beg (1- (point))))) + files))) (nreverse files))) ;; Empty tags file support. @@ -1656,7 +1660,7 @@ Point should be just after a string that matches TAG." ;; partial file name match, i.e. searched tag must match a substring ;; of the file name (potentially including a directory separator). -(defun tag-partial-file-name-match-p (tag) +(defun tag-partial-file-name-match-p (_tag) "Return non-nil if current tag matches file name. This is a substring match, and it can include directory separators. Point should be just after a string that matches TAG." @@ -1666,7 +1670,7 @@ Point should be just after a string that matches TAG." (looking-at "\f\n")))) ;; t if point is in a tag line with a tag containing TAG as a substring. -(defun tag-any-match-p (tag) +(defun tag-any-match-p (_tag) "Return non-nil if current tag line contains TAG as a substring." (looking-at ".*\177")) @@ -1755,9 +1759,9 @@ if the file was newly read in, the value is the filename." (with-current-buffer buffer (revert-buffer t t))) (if (not (and new novisit)) - (set-buffer (find-file-noselect next novisit)) + (find-file next novisit) ;; Like find-file, but avoids random warning messages. - (set-buffer (get-buffer-create " *next-file*")) + (switch-to-buffer (get-buffer-create " *next-file*")) (kill-all-local-variables) (erase-buffer) (setq new next) @@ -1859,7 +1863,11 @@ nil, we exit; otherwise we scan the next file." Stops when a match is found. To continue searching for next match, use command \\[tags-loop-continue]. -See documentation of variable `tags-file-name'." +If FILE-LIST-FORM is non-nil, it should be a form that, when +evaluated, will return a list of file names. The search will be +restricted to these files. + +Aleso see the documentation of the `tags-file-name' variable." (interactive "sTags search (regexp): ") (if (and (equal regexp "") (eq (car tags-loop-scan) 're-search-forward) @@ -1906,7 +1914,7 @@ See also the documentation of the variable `tags-file-name'." (try-completion string (tags-table-files) predicate)))) ;;;###autoload -(defun list-tags (file &optional next-match) +(defun list-tags (file &optional _next-match) "Display list of tags in file FILE. This searches only the first table in the list, and no included tables. FILE should be as it appeared in the `etags' command, usually without a