From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phs Newsgroups: gmane.emacs.bugs Subject: bug#21175: 24.5; progmodes/etags.el: next-file does (find-file next novisit) Date: Sat, 01 Aug 2015 11:53:04 +0200 Message-ID: <55BC9700.1030806@lsv.ens-cachan.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1438422867 22413 80.91.229.3 (1 Aug 2015 09:54:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Aug 2015 09:54:27 +0000 (UTC) To: 21175@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 01 11:54:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZLTUY-00088x-0y for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Aug 2015 11:54:10 +0200 Original-Received: from localhost ([::1]:53146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLTUX-0005nT-FE for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Aug 2015 05:54:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51669) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLTUU-0005nA-Cu for bug-gnu-emacs@gnu.org; Sat, 01 Aug 2015 05:54:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZLTUQ-0006pG-D9 for bug-gnu-emacs@gnu.org; Sat, 01 Aug 2015 05:54:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLTUQ-0006pC-9P for bug-gnu-emacs@gnu.org; Sat, 01 Aug 2015 05:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZLTUP-0002zE-SJ for bug-gnu-emacs@gnu.org; Sat, 01 Aug 2015 05:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: phs Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Aug 2015 09:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21175 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.143842279711425 (code B ref -1); Sat, 01 Aug 2015 09:54:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Aug 2015 09:53:17 +0000 Original-Received: from localhost ([127.0.0.1]:36261 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLTTg-0002yD-GF for submit@debbugs.gnu.org; Sat, 01 Aug 2015 05:53:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38029) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLTTe-0002y4-Ax for submit@debbugs.gnu.org; Sat, 01 Aug 2015 05:53:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZLTTc-0006N9-MZ for submit@debbugs.gnu.org; Sat, 01 Aug 2015 05:53:13 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51555) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLTTc-0006N5-K2 for submit@debbugs.gnu.org; Sat, 01 Aug 2015 05:53:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLTTb-0005MB-JI for bug-gnu-emacs@gnu.org; Sat, 01 Aug 2015 05:53:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZLTTX-0006MM-IM for bug-gnu-emacs@gnu.org; Sat, 01 Aug 2015 05:53:11 -0400 Original-Received: from olive.lsv.fr ([138.231.81.248]:34153 helo=olive.lsv.ens-cachan.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLTTX-0006MH-Ck for bug-gnu-emacs@gnu.org; Sat, 01 Aug 2015 05:53:07 -0400 Original-Received: from phs-air-2.local (cas75-2-78-192-18-219.fbxo.proxad.net [78.192.18.219]) by olive.lsv.ens-cachan.fr (Postfix) with ESMTP id C8AD84C018C for ; Sat, 1 Aug 2015 11:53:05 +0200 (CEST) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:105262 Archived-At: when submitting bug #21167 I looked at the source code in progmodes/etags.el and wondered why next-file passes the novisit flag when calling find-file. novisit asks tags to use a temp buffer " *next-file*" rather than visiting the file unless it is already visited (in which case we want tags to search the version that we are currently editing and modifying). It is t by default. What is actually done is (line 1765 in v24.5): (if (not (and new novisit)) (find-file next novisit) ;; Like find-file, but avoids random warning messages. So when the file is already visited, new is nil in the above code and we just use find-file. Passing novisit is dangerous since find-file takes this as the wildcards flag, nothing to do with the meaning of novisit. Actually, if the filename contains * or ? (and is currently visited, or "not new") tags may create many buffers visiting many files that match the filename interpreted as a pattern, not an actual file name. What buffer will be searched next is maybe not the one associated with filename. The comment too is incorrect. To trip the bug in an empty directory: % touch foo1.c foo2.c foo3.c "*.c" ; etags "*.c"; emacs -q "*.c" Now modify the *.c buffer, just type foo in it Now M-x etags-search foo I get the message "Symbolic link that points to nonexistent file" and emacs has buffers visiting foo{1,2,3}.c that are not listed in the TAGS file. --- All this seems to be inherited from older versions. I just checked 21.4 from 10+ years ago and it had (if (not (and new novisit)) (set-buffer (find-file-noselect next novisit)) ;; Like find-file, but avoids random warning messages. Here too the novisit flag was already misinterpreted but the comment made sense.