• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/progmodes/

Lines Matching +defs:other +defs:file

11 ;; This file is part of GNU Emacs.
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
36 (defvar tags-file-name nil
40 Use the `etags' program to make a tags table file.")
41 ;; Make M-x set-variable tags-file-name like M-x visit-tags-table.
42 ;;;###autoload (put 'tags-file-name 'variable-interactive "fVisit tags table: ")
51 Any other value means use the setting of `case-fold-search'."
55 (other :tag "Use default" default))
61 "*List of file names of tags tables to search.
62 An element that is a directory means the file \"TAGS\" in that directory.
64 If you set this variable, do not also set `tags-file-name'.
65 Use the `etags' program to make a tags table file."
67 :type '(repeat file))
72 An empty string means search the non-compressed file.
93 Any other value means ask the user whether to add a new tags table
98 (other :tag "Ask" ask-user)))
107 This includes tables implicitly included by other tables. The list is not
128 Each element is a list of strings which are file names.")
160 "If non-nil, print the name of the tags file in the *Tags List* buffer."
192 "If non-nil, a function to choose a default tags file for a buffer.
194 tags table file to use for the current buffer.")
205 "List of file names covered by current tags table.
214 (defvar next-file-list nil
215 "List of files for \\[next-file] to process.")
218 ;; Hooks for file formats.
227 (defvar file-of-tag-function nil
228 "Function to do the work of `file-of-tag' (which see).
261 "Function to return t iff current buffer contains valid tags file.")
281 "Major mode for tags table file buffers."
288 (defun visit-tags-table (file &optional local)
289 "Tell tags commands to use tags table file FILE.
290 FILE should be the name of a file created with the `etags' program.
291 A directory name is ok too; it means file TAGS in that directory.
293 Normally \\[visit-tags-table] sets the global value of `tags-file-name'.
297 file the tag was in."
298 (interactive (list (read-file-name "Visit tags table (default TAGS): "
300 (expand-file-name "TAGS"
304 (or (stringp file) (signal 'wrong-type-argument (list 'stringp file)))
305 ;; Bind tags-file-name so we can control below whether the local or
307 ;; initialize a buffer for the file and set tags-file-name to the
308 ;; Calling visit-tags-table-buffer with tags-file-name set to FILE will
309 ;; initialize a buffer for FILE and set tags-file-name to the
311 (let ((tags-file-name file))
313 (or (visit-tags-table-buffer file)
314 (signal 'file-error (list "Visiting tags table"
315 "file does not exist"
316 file)))
318 (setq file tags-file-name)))
320 ;; Set the local value of tags-file-name.
321 (set (make-local-variable 'tags-file-name) file)
322 ;; Set the global value of tags-file-name.
323 (setq-default tags-file-name file)))
337 table-buffer (get-file-buffer (car tables)))
339 ;; There is a buffer visiting the file. Now make sure
342 (tags-verify-table (buffer-file-name table-buffer))))
381 table-buffer (get-file-buffer (car tables)))
403 ;; Expand tags table name FILE into a complete file name.
404 (defun tags-expand-table-name (file)
405 (setq file (expand-file-name file))
406 (if (file-directory-p file)
407 (expand-file-name "TAGS" file)
408 file))
412 (defun tags-table-list-member (file list)
413 (setq file (tags-expand-table-name file))
416 (not (string= file (tags-expand-table-name (car list))))))
420 (defun tags-verify-table (file)
424 (if (get-file-buffer file)
425 ;; The file is already in a buffer. Check for the visited file
428 (set-buffer (get-file-buffer file))
430 (if (or (verify-visited-file-modtime (current-buffer))
431 ;; Decide whether to revert the file.
437 (if (string-match (car tail) buffer-file-name)
443 (format "Tags file %s has changed, read new contents? "
444 file)))))
449 (and (file-exists-p file)
451 (set-buffer (find-file-noselect file))
452 (or (string= file buffer-file-name)
453 ;; find-file-noselect has changed the file name.
454 ;; Propagate the change to tags-file-name and tags-table-list.
455 (let ((tail (member file tags-table-list)))
457 (setcar tail buffer-file-name))
458 (if (eq file tags-file-name)
459 (setq tags-file-name buffer-file-name))))
468 (defun tags-table-including (this-file core-only)
484 ;; Select the tags table buffer and get the file list up to date.
485 (let ((tags-file-name (car tables)))
487 (if (member this-file (mapcar 'expand-file-name
515 ;; along and set tags-file-name. Returns nil when out of tables.
530 ;; Set tags-file-name to the name from the list. It is already expanded.
531 (setq tags-file-name (car tags-table-list-pointer))))
536 If optional arg is a string, visit that file as a tags table.
539 just select the buffer visiting `tags-file-name'.
541 `tags-file-name', `tags-table-list', `tags-table-list-pointer'.
544 ;; Set tags-file-name to the tags table file we want to visit.
546 ;; Use the ambient value of tags-file-name.
547 (or tags-file-name
557 (while (and (not (or (get-file-buffer tags-file-name)
558 (file-exists-p tags-file-name)))
564 (setq tags-file-name
571 (cdr (assq 'tags-file-name (buffer-local-variables)))
576 ;; current buffer's file. If one is found, the lists will
579 (and buffer-file-name
582 (tags-table-including buffer-file-name t)
585 (tags-table-including buffer-file-name nil)))
586 ;; Fourth, use the user variable tags-file-name, if it is
588 (and tags-file-name
589 (not (tags-table-list-member tags-file-name
591 tags-file-name)
595 file)
597 (setq file (tags-expand-table-name (car list)))
598 (not (get-file-buffer file))
599 (not (file-exists-p file)))
602 ;; Finally, prompt the user for a file name.
603 (expand-file-name
604 (read-file-name "Visit tags table (default TAGS): "
609 ;; Expand the table name into a full file name.
610 (setq tags-file-name (tags-expand-table-name tags-file-name))
613 ;; Verify that tags-file-name names a valid tags table.
614 ;; Bind another variable with the value of tags-file-name
615 ;; before we switch buffers, in case tags-file-name is buffer-local.
617 (local-tags-file-name tags-file-name))
618 (if (tags-verify-table local-tags-file-name)
632 local-tags-file-name
644 local-tags-file-name
648 ;; Found in some other set. Switch to that set.
665 (setq tags-table-list (cons local-tags-file-name
682 (setq tags-table-list (list local-tags-file-name))))
697 (kill-local-variable 'tags-file-name)
698 (if (eq local-tags-file-name tags-file-name)
699 (setq tags-file-name nil))
700 (error "File %s is not a valid tags table" local-tags-file-name)))))
713 (setq tags-file-name nil
724 (defun file-of-tag (&optional relative)
725 "Return the file name of the file whose tags point is within.
727 If RELATIVE is non-nil, file name returned is relative to tags
728 table file's directory. If RELATIVE is nil, file name returned
730 (funcall file-of-tag-function relative))
735 Assumes the tags table is the current buffer. The file names are returned
757 (message "Making tags completion table for %s..." buffer-file-name)
770 buffer-file-name)
810 ;; Get interactive args for find-tag{-noselect,-other-window,-regexp}.
846 See documentation of variable `tags-file-name'."
852 ;; of `tags-file-name' in case it has a buffer-local value.
918 See documentation of variable `tags-file-name'."
929 (defun find-tag-other-window (tagname &optional next-p regexp-p)
947 See documentation of variable `tags-file-name'."
948 (interactive (find-tag-interactive "Find tag other window: "))
959 (switch-to-buffer-other-window tagbuf)
963 ;; switch-to-buffer-other-window doesn't set
967 ;;;###autoload (define-key ctl-x-4-map "." 'find-tag-other-window)
970 (defun find-tag-other-frame (tagname &optional next-p)
988 See documentation of variable `tags-file-name'."
989 (interactive (find-tag-interactive "Find tag other frame: "))
991 (find-tag-other-window tagname next-p)))
992 ;;;###autoload (define-key ctl-x-5-map "." 'find-tag-other-frame)
995 (defun find-tag-regexp (regexp &optional next-p other-window)
1011 See documentation of variable `tags-file-name'."
1013 ;; We go through find-tag-other-window to do all the display hair there.
1014 (funcall (if other-window 'find-tag-other-window 'find-tag)
1050 ;; beginning of tags file, and perform inner loop: for each naive match for
1053 ;; specified source file and return. Qualified matches are remembered to
1064 (let (file ;name of file containing tag
1097 ;; Start at beginning of tags file.
1134 ;; We should be able to search for file-name backwards in file-of-tag:
1135 ;; the beginning-of-line is ok except when positioned on a "file-name" tag.
1136 (setq file (expand-file-name
1137 (if (memq (car order) '(tag-exact-file-name-match-p
1138 tag-file-name-match-p
1139 tag-partial-file-name-match-p))
1141 (file-of-tag))
1142 (file-of-tag)))
1147 (tag-find-file-of-tag-noselect file)
1155 (defun tag-find-file-of-tag-noselect (file)
1156 ;; Find the right line in the specified file.
1159 ;; otherwise only the real file.
1164 (file-search-extensions buffer-search-extensions))
1165 ;; search a buffer visiting the file with each possible extension
1170 ;; An alternative would be to use only get-file-buffer
1171 ;; but this looks less "sure" to find the buffer for the file.
1173 (setq the-buffer (find-buffer-visiting (concat file (car buffer-search-extensions))))
1175 ;; if found a buffer but file modified, ensure we re-read !
1176 (if (and the-buffer (not (verify-visited-file-modtime the-buffer)))
1177 (find-file-noselect (buffer-file-name the-buffer)))
1179 (while (and (not the-buffer) file-search-extensions)
1180 (if (not (file-exists-p (concat file (car file-search-extensions))))
1181 (setq file-search-extensions (cdr file-search-extensions))
1182 (setq the-buffer (find-file-noselect (concat file (car file-search-extensions))))))
1185 (error "File %s (with or without extensions %s) not found" file tags-compression-info-list)
1186 (error "File %s not found" file))
1189 (defun tag-find-file-of-tag (file)
1190 (let ((buf (tag-find-file-of-tag-noselect file)))
1196 ;; `etags' TAGS file format support.
1198 ;; If the current buffer is a valid etags TAGS file, give it local values of
1204 ;; (message "%s is an `etags' TAGS file" buffer-file-name)
1206 '((file-of-tag-function . etags-file-of-tag)
1215 (find-tag-tag-order . (tag-exact-file-name-match-p
1216 tag-file-name-match-p
1221 tag-partial-file-name-match-p
1230 ;; Return non-nil iff the current buffer is a valid etags TAGS file.
1235 (defun etags-file-of-tag (&optional relative)
1241 (expand-file-name str
1242 (file-truename default-directory))))))
1249 (format "Making tags completion table for %s..." buffer-file-name)
1280 ;; The match was for a source file name, not any tag within a file.
1282 ;; the beginning of the file.
1311 ;; Leave point on the next line of the tags file.
1317 ;; TEXT within the file (starting from 1); LINE is the line number. If
1322 ;; a search window which expands until it hits the start of file.
1328 ;; Direct file tag.
1331 (t (error "etags.el BUG: bogus direct file tag")))
1364 pat buffer-file-name)))
1372 (defun etags-list-tags (file)
1374 (when (re-search-forward (concat "\f\n" "\\(" file "\\)" ",") nil t)
1375 (let ((path (save-excursion (forward-line 1) (file-of-tag)))
1390 'file-path path
1395 (tag-find-file-of-tag (button-get button 'file-path))
1447 (princ "Tags in file `")
1448 (tags-with-face 'highlight (princ buffer-file-name))
1464 (file-path (save-excursion (if tag (file-of-tag)
1466 (file-of-tag)))))
1467 (file-label (if tag (file-of-tag t)
1469 (file-of-tag t))))
1473 (princ (format "[%s]: " file-label))
1479 'file-path file-path
1484 (tag-find-file-of-tag (button-get button 'file-path))
1489 (princ (format "- %s" file-label))
1492 'file-path file-path
1494 (tag-find-file-of-tag (button-get button 'file-path))
1528 (setq files (cons (expand-file-name (buffer-substring beg (1- (point))))
1533 ;; Empty tags file support.
1535 ;; Recognize an empty file and give it local values of the tags table format
1551 ;; These functions assume the etags file format defined in etc/ETAGS.EBNF.
1557 ;; (buffer (find-file-noselect (file-of-tag)))
1569 ;; exact file name match, i.e. searched tag must match complete file
1571 (defun tag-exact-file-name-match-p (tag)
1575 ;; file name match as above, but searched tag must match the file
1577 (defun tag-file-name-match-p (tag)
1621 ;; partial file name match, i.e. searched tag must match a substring
1622 ;; of the file name (potentially including a directory separator).
1623 (defun tag-partial-file-name-match-p (tag)
1644 These loops normally read each file into Emacs, but when a file
1647 in the case where the file has changed since you visited it."
1652 (defun next-file (&optional initialize novisit)
1653 "Select next file among files in current tags table.
1662 Value is nil if the file was already visited;
1663 if the file was newly read in, the value is the filename."
1674 ;; Copy the list so we can setcdr below, and expand the file
1676 (setq next-file-list (mapcar 'expand-file-name (tags-table-files)))
1678 ;; a complete list of referenced file names.
1682 (let ((tail next-file-list))
1688 (setcdr tail (mapcar 'expand-file-name (tags-table-files)))
1689 (setq next-file-list (mapcar 'expand-file-name
1693 (setq next-file-list (eval initialize))))
1694 (unless next-file-list
1696 (get-buffer " *next-file*")
1697 (kill-buffer " *next-file*"))
1699 (let* ((next (car next-file-list))
1700 (buffer (get-file-buffer next))
1702 ;; Advance the list before trying to find the file.
1703 ;; If we get an error finding the file, don't get stuck on it.
1704 (setq next-file-list (cdr next-file-list))
1708 (not (verify-visited-file-modtime buffer))
1712 (set-buffer (find-file-noselect next novisit))
1713 ;; Like find-file, but avoids random warning messages.
1714 (set-buffer (get-buffer-create " *next-file*"))
1718 (insert-file-contents new nil))
1722 "Form for `tags-loop-continue' to eval to change one file.")
1728 "Form for `tags-loop-continue' to eval to scan one file.
1729 If it returns non-nil, this file needs processing by evalling
1730 \`tags-loop-operate'. Otherwise, move on to the next file.")
1746 argument is passed to `next-file', which see).
1748 Two variables control the processing we do on each file: the value of
1749 `tags-loop-scan' is a form to be executed on each file to see if it is
1751 evaluate to operate on an interesting file. If the latter evaluates to
1752 nil, we exit; otherwise we scan the next file."
1755 ;; Non-nil means we have finished one file
1757 file-finished
1764 (while (or first-time file-finished
1768 ;; If nothing was found in the previous file, and
1769 ;; that file isn't in a temp buffer, restore point to
1774 (setq file-finished nil)
1775 (setq new (next-file first-time t))
1778 ;; and NEW is the file name.
1783 (message "Scanning file %s..." (or new buffer-file-name)))
1793 (set-buffer (find-file-noselect new))
1801 ;; Now operate on the file.
1802 ;; If value is non-nil, continue to scan the next file.
1804 (setq file-finished t))
1807 (message "Scanning file %s...found" buffer-file-name))))
1811 (defun tags-search (regexp &optional file-list-form)
1816 See documentation of variable `tags-file-name'."
1825 (tags-loop-continue (or file-list-form t))))
1828 (defun tags-query-replace (from to &optional delimited file-list-form start end)
1834 See documentation of variable `tags-file-name'."
1844 (tags-loop-continue (or file-list-form t)))
1847 (defun tags-complete-tags-table-file (string predicate what)
1857 (defun list-tags (file &optional next-match)
1858 "Display list of tags in file FILE.
1862 (interactive (list (completing-read "List tags in file: "
1863 'tags-complete-tags-table-file
1866 (princ "Tags in file `")
1867 (tags-with-face 'highlight (princ file))
1874 (if (funcall list-tags-function file)
1877 (error "File %s not in current tags tables" file)))))
1912 ;; XXX If a file is in multiple tables, selection may get the wrong one.
1915 "Select a tags table file from a menu of those you have already used.
1928 (princ (mapcar 'abbreviate-file-name tags-table-list) (current-buffer))
1935 (princ (mapcar 'abbreviate-file-name (car set-list)) (current-buffer))
1940 (when tags-file-name
1944 (insert (abbreviate-file-name tags-file-name))
1946 'etags-table tags-file-name)
1948 (setq set-list (delete tags-file-name
1954 (insert (abbreviate-file-name (car set-list)))
2009 tags-file-name