772 |
(all-completions string (tags-completion-table) predicate) |
(all-completions string (tags-completion-table) predicate) |
773 |
(try-completion string (tags-completion-table) predicate)))) |
(try-completion string (tags-completion-table) predicate)))) |
774 |
|
|
|
;; Return a default tag to search for, based on the text at point. |
|
|
(defun find-tag-default () |
|
|
(save-excursion |
|
|
(while (looking-at "\\sw\\|\\s_") |
|
|
(forward-char 1)) |
|
|
(if (or (re-search-backward "\\sw\\|\\s_" |
|
|
(save-excursion (beginning-of-line) (point)) |
|
|
t) |
|
|
(re-search-forward "\\(\\sw\\|\\s_\\)+" |
|
|
(save-excursion (end-of-line) (point)) |
|
|
t)) |
|
|
(progn (goto-char (match-end 0)) |
|
|
(buffer-substring-no-properties |
|
|
(point) |
|
|
(progn (forward-sexp -1) |
|
|
(while (looking-at "\\s'") |
|
|
(forward-char 1)) |
|
|
(point)))) |
|
|
nil))) |
|
|
|
|
775 |
;; Read a tag name from the minibuffer with defaulting and completion. |
;; Read a tag name from the minibuffer with defaulting and completion. |
776 |
(defun find-tag-tag (string) |
(defun find-tag-tag (string) |
777 |
(let* ((completion-ignore-case (if (memq tags-case-fold-search '(t nil)) |
(let* ((completion-ignore-case (if (memq tags-case-fold-search '(t nil)) |
1433 |
(tags-with-face 'highlight (princ buffer-file-name)) |
(tags-with-face 'highlight (princ buffer-file-name)) |
1434 |
(princ "':\n\n")) |
(princ "':\n\n")) |
1435 |
(goto-char (point-min)) |
(goto-char (point-min)) |
1436 |
(while (re-search-forward string nil t) |
(let ((point-max (/ (float (point-max)) 100.0))) |
1437 |
(beginning-of-line) |
(while (re-search-forward string nil t) |
1438 |
|
(message "Making tags apropos buffer for `%s'...%d%%" |
1439 |
|
string |
1440 |
|
(/ (point) point-max)) |
1441 |
|
(beginning-of-line) |
1442 |
|
|
1443 |
(let* (;; Get the local value in the tags table |
(let* ( ;; Get the local value in the tags table |
1444 |
;; buffer before switching buffers. |
;; buffer before switching buffers. |
1445 |
(goto-func goto-tag-location-function) |
(goto-func goto-tag-location-function) |
1446 |
(tag-info (save-excursion (funcall snarf-tag-function))) |
(tag-info (save-excursion (funcall snarf-tag-function))) |
1447 |
(tag (if (eq t (car tag-info)) nil (car tag-info))) |
(tag (if (eq t (car tag-info)) nil (car tag-info))) |
1448 |
(file-path (save-excursion (if tag (file-of-tag) |
(file-path (save-excursion (if tag (file-of-tag) |
1449 |
(save-excursion (next-line 1) |
(save-excursion (next-line 1) |
1450 |
(file-of-tag))))) |
(file-of-tag))))) |
1451 |
(file-label (if tag (file-of-tag t) |
(file-label (if tag (file-of-tag t) |
1452 |
(save-excursion (next-line 1) |
(save-excursion (next-line 1) |
1453 |
(file-of-tag t)))) |
(file-of-tag t)))) |
1454 |
(pt (with-current-buffer standard-output (point)))) |
(pt (with-current-buffer standard-output (point)))) |
1455 |
(if tag |
(if tag |
1456 |
(progn |
(progn |
1457 |
(princ (format "[%s]: " file-label)) |
(princ (format "[%s]: " file-label)) |
1458 |
(princ tag) |
(princ tag) |
1459 |
(when (= (aref tag 0) ?\() (princ " ...)")) |
(when (= (aref tag 0) ?\() (princ " ...)")) |
1460 |
(with-current-buffer standard-output |
(with-current-buffer standard-output |
1461 |
(make-text-button pt (point) |
(make-text-button pt (point) |
1462 |
'tag-info tag-info |
'tag-info tag-info |
1463 |
'file-path file-path |
'file-path file-path |
1464 |
'goto-func goto-func |
'goto-func goto-func |
1465 |
'action (lambda (button) |
'action (lambda (button) |
1466 |
(let ((tag-info (button-get button 'tag-info)) |
(let ((tag-info (button-get button 'tag-info)) |
1467 |
(goto-func (button-get button 'goto-func))) |
(goto-func (button-get button 'goto-func))) |
1468 |
(tag-find-file-of-tag (button-get button 'file-path)) |
(tag-find-file-of-tag (button-get button 'file-path)) |
1469 |
(widen) |
(widen) |
1470 |
(funcall goto-func tag-info))) |
(funcall goto-func tag-info))) |
1471 |
'face 'tags-tag-face |
'face 'tags-tag-face |
1472 |
'type 'button))) |
'type 'button))) |
1473 |
(princ (format "- %s" file-label)) |
(princ (format "- %s" file-label)) |
1474 |
(with-current-buffer standard-output |
(with-current-buffer standard-output |
1475 |
(make-text-button pt (point) |
(make-text-button pt (point) |
1476 |
'file-path file-path |
'file-path file-path |
1477 |
'action (lambda (button) |
'action (lambda (button) |
1478 |
(tag-find-file-of-tag (button-get button 'file-path)) |
(tag-find-file-of-tag (button-get button 'file-path)) |
1479 |
;; Get the local value in the tags table |
;; Get the local value in the tags table |
1480 |
;; buffer before switching buffers. |
;; buffer before switching buffers. |
1481 |
(goto-char (point-min))) |
(goto-char (point-min))) |
1482 |
'face 'tags-tag-face |
'face 'tags-tag-face |
1483 |
'type 'button)) |
'type 'button)) |
1484 |
)) |
)) |
1485 |
(terpri) |
(terpri) |
1486 |
(forward-line 1)) |
(forward-line 1)) |
1487 |
|
(message nil)) |
1488 |
(when tags-apropos-verbose (princ "\n"))) |
(when tags-apropos-verbose (princ "\n"))) |
1489 |
|
|
1490 |
(defun etags-tags-table-files () |
(defun etags-tags-table-files () |