From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: [shouman@comcast.net: Etags completion problem for local tags table] Date: Wed, 20 Feb 2008 11:44:25 -0500 Message-ID: Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: ger.gmane.org 1203525928 25531 80.91.229.12 (20 Feb 2008 16:45:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Feb 2008 16:45:28 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 20 17:45:53 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JRs4q-0002f0-FV for ged-emacs-devel@m.gmane.org; Wed, 20 Feb 2008 17:45:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JRs4L-0004PK-F3 for ged-emacs-devel@m.gmane.org; Wed, 20 Feb 2008 11:45:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JRs3Y-0003kz-9e for emacs-devel@gnu.org; Wed, 20 Feb 2008 11:44:28 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JRs3W-0003kA-Pu for emacs-devel@gnu.org; Wed, 20 Feb 2008 11:44:27 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JRs3W-0003k7-HH for emacs-devel@gnu.org; Wed, 20 Feb 2008 11:44:26 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JRs3W-0002Hz-78 for emacs-devel@gnu.org; Wed, 20 Feb 2008 11:44:26 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1JRs3V-0005uF-JD; Wed, 20 Feb 2008 11:44:25 -0500 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:89703 Archived-At: Would someone please DTRT and ack? This qualifies as a tiny change. ------- Start of forwarded message ------- To: gnu-emacs-bug@moderators.individual.net From: Radey Shouman Newsgroups: gnu.emacs.bug Date: 19 Feb 2008 18:27:29 -0500 Organization: None of the above Message-ID: <87r6f87cim.fsf@comcast.net> Cc: Subject: Etags completion problem for local tags table 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.") ;; 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 **** ;; 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 ---- ;; 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 ---- (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)) ------- End of forwarded message -------