Function: tags--get-current-buffer-name-in-tags-file

tags--get-current-buffer-name-in-tags-file is a byte-compiled function defined in etags.el.gz.

Signature

(tags--get-current-buffer-name-in-tags-file)

Documentation

Return file name that corresponds to the current buffer in the tags table.

This returns the file name which corresponds to the current buffer relative to the directory of the current tags table (see visit-tags-table-buffer). If no file is associated with the current buffer, this function returns nil.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/etags.el.gz
(defun tags--get-current-buffer-name-in-tags-file ()
  "Return file name that corresponds to the current buffer in the tags table.
This returns the file name which corresponds to the current buffer relative
to the directory of the current tags table (see `visit-tags-table-buffer').
If no file is associated with the current buffer, this function returns nil."
  (let ((buf-fname (buffer-file-name)))
    ;; FIXME: Are there interesting cases where 'buffer-file-name'
    ;; returns nil, but there's some file we expect to find in TAGS that
    ;; is associated with the buffer?  The obvious cases of Dired and
    ;; Info buffers are not interesting for TAGS, but are there any
    ;; others?
    (if buf-fname
        (let ((tag-dir
               (save-excursion
                 (visit-tags-table-buffer)
                 (file-name-directory buf-fname))))
          (file-relative-name buf-fname tag-dir)))))