all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Radey Shouman <shouman@comcast.net>
To: gnu-emacs-bug@moderators.individual.net
Subject: Etags completion problem for local tags table
Date: 19 Feb 2008 18:27:29 -0500	[thread overview]
Message-ID: <87r6f87cim.fsf@comcast.net> (raw)

In (at least) emacs 22.1, completing reads for find-tag and list-tags
will use the global tags table list even if a local tags file has
been specified using a prefix argument for visit-tags-table.

To reproduce, visit two files, in the first buffer visit a tags file
globally, in the second a different tags file locally.  From the
second buffer, try M.[TAB] .  The tag list displayed will correspond
to the first, globally visited, tags file.

A patch that works for me is appended.

*** etags.el.dist	2007-01-21 03:20:46.000000000 -0500
--- etags.el	2008-02-19 17:46:44.592353300 -0500
***************
*** 257,262 ****
--- 257,264 ----
    "Function to do the work of `tags-included-tables' (which see).")
  (defvar verify-tags-table-function nil
    "Function to return t iff current buffer contains valid tags file.")
+ (defvar etags-calling-buffer nil
+   "Buffer from which a completing read was made, so we can determine the appropriate tags file to visit.")
  \f
  ;; Initialize the tags table in the current buffer.
  ;; Returns non-nil iff it is a valid tags table.  On
***************
*** 315,321 ****
        (setq file tags-file-name)))
    (if local
        ;; Set the local value of tags-file-name.
!       (set (make-local-variable 'tags-file-name) file)
      ;; Set the global value of tags-file-name.
      (setq-default tags-file-name file)))
  
--- 317,325 ----
        (setq file tags-file-name)))
    (if local
        ;; Set the local value of tags-file-name.
!       (progn
!         (set (make-local-variable 'tags-file-name) file)
!         (set (make-local-variable 'tags-table-list) nil))
      ;; Set the global value of tags-file-name.
      (setq-default tags-file-name file)))
  
***************
*** 751,756 ****
--- 755,762 ----
  	  (let (current-table combined-table)
  	    (message "Making tags completion table for %s..." buffer-file-name)
  	    (save-excursion
+               (if etags-calling-buffer
+                   (set-buffer etags-calling-buffer))
  	      ;; Iterate over the current list of tags tables.
  	      (while (visit-tags-table-buffer (and combined-table t))
  		;; Find possible completions in this table.
***************
*** 772,777 ****
--- 778,785 ----
  ;; but builds tags-completion-table on demand.
  (defun tags-complete-tag (string predicate what)
    (save-excursion
+     (if etags-calling-buffer
+         (set-buffer etags-calling-buffer))
      ;; If we need to ask for the tag table, allow that.
      (let ((enable-recursive-minibuffers t))
        (visit-tags-table-buffer))
***************
*** 781,787 ****
  \f
  ;; Read a tag name from the minibuffer with defaulting and completion.
  (defun find-tag-tag (string)
!   (let* ((completion-ignore-case (if (memq tags-case-fold-search '(t nil))
  				     tags-case-fold-search
  				   case-fold-search))
  	 (default (funcall (or find-tag-default-function
--- 789,796 ----
  \f
  ;; Read a tag name from the minibuffer with defaulting and completion.
  (defun find-tag-tag (string)
!   (let* ((etags-calling-buffer (current-buffer))
!          (completion-ignore-case (if (memq tags-case-fold-search '(t nil))
  				     tags-case-fold-search
  				   case-fold-search))
  	 (default (funcall (or find-tag-default-function
***************
*** 1834,1839 ****
--- 1843,1850 ----
  \f
  (defun tags-complete-tags-table-file (string predicate what)
    (save-excursion
+     (if etags-calling-buffer
+         (set-buffer etags-calling-buffer))
      ;; If we need to ask for the tag table, allow that.
      (let ((enable-recursive-minibuffers t))
        (visit-tags-table-buffer))




             reply	other threads:[~2008-02-19 23:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 23:27 Radey Shouman [this message]
     [not found] <mailman.7663.1203474863.18990.bug-gnu-emacs@gnu.org>
2008-04-04  0:55 ` Etags completion problem for local tags table Stefan Monnier
2008-04-24 19:03 ` Radey Shouman
     [not found] ` <mailman.10789.1209074215.18990.bug-gnu-emacs@gnu.org>
2008-04-29 20:08   ` Radey Shouman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r6f87cim.fsf@comcast.net \
    --to=shouman@comcast.net \
    --cc=gnu-emacs-bug@moderators.individual.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.