comparison lisp/progmodes/etags.el @ 44509:92316652b440

(etags-verify-tags-table, etags-snarf-tag, etags-list-tags) (etags-tags-apropos, select-tags-table): Don't assume point-min == 1.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 12 Apr 2002 03:03:26 +0000
parents 43143e459aae
children d207a1784c9e
comparison
equal deleted inserted replaced
44508:235f5029534d 44509:92316652b440
1208 )))) 1208 ))))
1209 1209
1210 ;; Return non-nil iff the current buffer is a valid etags TAGS file. 1210 ;; Return non-nil iff the current buffer is a valid etags TAGS file.
1211 (defun etags-verify-tags-table () 1211 (defun etags-verify-tags-table ()
1212 ;; Use eq instead of = in case char-after returns nil. 1212 ;; Use eq instead of = in case char-after returns nil.
1213 (eq (char-after 1) ?\f)) 1213 (eq (char-after (point-min)) ?\f))
1214 1214
1215 (defun etags-file-of-tag () 1215 (defun etags-file-of-tag ()
1216 (save-excursion 1216 (save-excursion
1217 (re-search-backward "\f\n\\([^\n]+\\),[0-9]*\n") 1217 (re-search-backward "\f\n\\([^\n]+\\),[0-9]*\n")
1218 (expand-file-name (buffer-substring (match-beginning 1) (match-end 1)) 1218 (expand-file-name (buffer-substring (match-beginning 1) (match-end 1))
1252 ;; The match was for a source file name, not any tag within a file. 1252 ;; The match was for a source file name, not any tag within a file.
1253 ;; Give text of t, meaning to go exactly to the location we specify, 1253 ;; Give text of t, meaning to go exactly to the location we specify,
1254 ;; the beginning of the file. 1254 ;; the beginning of the file.
1255 (setq tag-text t 1255 (setq tag-text t
1256 line nil 1256 line nil
1257 startpos 1) 1257 startpos (point-min))
1258 1258
1259 ;; Find the end of the tag and record the whole tag text. 1259 ;; Find the end of the tag and record the whole tag text.
1260 (search-forward "\177") 1260 (search-forward "\177")
1261 (setq tag-text (buffer-substring (1- (point)) 1261 (setq tag-text (buffer-substring (1- (point))
1262 (save-excursion (beginning-of-line) 1262 (save-excursion (beginning-of-line)
1334 (looking-at "\^m") 1334 (looking-at "\^m")
1335 (forward-char 1)) 1335 (forward-char 1))
1336 (beginning-of-line))) 1336 (beginning-of-line)))
1337 1337
1338 (defun etags-list-tags (file) 1338 (defun etags-list-tags (file)
1339 (goto-char 1) 1339 (goto-char (point-min))
1340 (when (search-forward (concat "\f\n" file ",") nil t) 1340 (when (search-forward (concat "\f\n" file ",") nil t)
1341 (forward-line 1) 1341 (forward-line 1)
1342 (while (not (or (eobp) (looking-at "\f"))) 1342 (while (not (or (eobp) (looking-at "\f")))
1343 (let ((tag (buffer-substring (point) 1343 (let ((tag (buffer-substring (point)
1344 (progn (skip-chars-forward "^\177") 1344 (progn (skip-chars-forward "^\177")
1399 (defun etags-tags-apropos (string) 1399 (defun etags-tags-apropos (string)
1400 (when tags-apropos-verbose 1400 (when tags-apropos-verbose
1401 (princ "Tags in file `") 1401 (princ "Tags in file `")
1402 (tags-with-face 'highlight (princ buffer-file-name)) 1402 (tags-with-face 'highlight (princ buffer-file-name))
1403 (princ "':\n\n")) 1403 (princ "':\n\n"))
1404 (goto-char 1) 1404 (goto-char (point-min))
1405 (while (re-search-forward string nil t) 1405 (while (re-search-forward string nil t)
1406 (beginning-of-line) 1406 (beginning-of-line)
1407 (let ((tag (buffer-substring (point) 1407 (let ((tag (buffer-substring (point)
1408 (progn (skip-chars-forward "^\177") 1408 (progn (skip-chars-forward "^\177")
1409 (point)))) 1409 (point))))
1839 (while set-list 1839 (while set-list
1840 (insert (car set-list) "\C-m") 1840 (insert (car set-list) "\C-m")
1841 (prin1 (car set-list) (current-buffer)) ;invisible 1841 (prin1 (car set-list) (current-buffer)) ;invisible
1842 (insert "\n") 1842 (insert "\n")
1843 (setq set-list (delete (car set-list) set-list))) 1843 (setq set-list (delete (car set-list) set-list)))
1844 (goto-char 1) 1844 (goto-char (point-min))
1845 (insert-before-markers 1845 (insert-before-markers
1846 "Type `t' to select a tags table or set of tags tables:\n\n") 1846 "Type `t' to select a tags table or set of tags tables:\n\n")
1847 (if desired-point 1847 (if desired-point
1848 (goto-char desired-point)) 1848 (goto-char desired-point))
1849 (set-window-start (selected-window) 1 t)) 1849 (set-window-start (selected-window) 1 t))