From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-25 f8208b6: Document the user-level features of the Xref package Date: Thu, 21 Jan 2016 21:00:19 +0200 Message-ID: <83a8ny92rg.fsf@gnu.org> References: <20160109191428.26341.44105@vcs.savannah.gnu.org> <5691C9D2.7080905@yandex.ru> <83egdpmo1j.fsf@gnu.org> <56929D6F.2050508@yandex.ru> <834melmfa4.fsf@gnu.org> <5692B1E0.8010100@yandex.ru> <831t9pma4e.fsf@gnu.org> <5693FDFA.2070607@yandex.ru> <83ziwbkj5l.fsf@gnu.org> <5694055E.6050201@yandex.ru> <83si1udcaz.fsf@gnu.org> <569D64AC.1060606@yandex.ru> <83powxbh6c.fsf@gnu.org> <569EB04F.800@yandex.ru> <8337tsc133.fsf@gnu.org> <56A05073.5090100@yandex.ru> <83powu96yo.fsf@gnu.org> <56A1277B.9080001@yandex.ru> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1453402856 15178 80.91.229.3 (21 Jan 2016 19:00:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Jan 2016 19:00:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 21 20:00:54 2016 Return-path: Envelope-to: ged-emacs-devel@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 1aMKTW-0005R0-4E for ged-emacs-devel@m.gmane.org; Thu, 21 Jan 2016 20:00:54 +0100 Original-Received: from localhost ([::1]:49328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMKTV-0004wL-Jd for ged-emacs-devel@m.gmane.org; Thu, 21 Jan 2016 14:00:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMKSo-0004GH-Fp for emacs-devel@gnu.org; Thu, 21 Jan 2016 14:00:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMKSl-0008Lo-5R for emacs-devel@gnu.org; Thu, 21 Jan 2016 14:00:10 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMKSl-0008Lk-2J; Thu, 21 Jan 2016 14:00:07 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4497 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aMKSi-00079l-R2; Thu, 21 Jan 2016 14:00:05 -0500 In-reply-to: <56A1277B.9080001@yandex.ru> (message from Dmitry Gutov on Thu, 21 Jan 2016 21:46:19 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198518 Archived-At: > Cc: emacs-devel@gnu.org > From: Dmitry Gutov > Date: Thu, 21 Jan 2016 21:46:19 +0300 > > On 01/21/2016 08:29 PM, Eli Zaretskii wrote: > > > Cross-Referencing doesn't fit, IMO, not if you consider the user-level > > functionality. I've tried to find a name that somehow expressed the > > functionality, but came up empty-handed. "Xref" is a compromise: it's > > not a word that means something, it's just the name of the package > > (but then so was "Tags"). > > I don't know if that's true. "Tags" is a more meaningful word. You even > define it in the manual. That's just history: someone invented a definition that would make sense. > We don't define the word "xref". We could, if we wanted to. I think for now just pretending the name has no semantic meaning is good enough. > > What I had in mind was just what tags-search > > does, but with the xref-style UI, i.e. via the *xref* buffer showing > > the matches. Same as you did in Dired, but looking in files returned > > by the backend -- etags will return the files in TAGS, elisp will > > return the files in load-path (or wherever else it gets the files), > > etc. > > Backends don't return files. They return lists of references. Which > could be "definitions", "references", "apropos matches"... and, I > suppose, "regexp matches", if we really want to. But a reference includes a file name, doesn't it? If so, why not search through those files? > Initially, I created the xref-find-regexp command, but then moved it to > the project package, because always including the current project root > turned out to be more useful, to me. It probably is for some use cases. But in others, users might want the other kind. > As a practical example, xref-find-regexp, with etags backend, in the > Emacs project, would only search the files inside src, lisp and lwlib, > whereas project-find-regexp searches inside the whole emacs/ directory. > > And project-or-external-find-regexp would search outside of it as well, > if any of the currently used TAGS files resided outside of emacs/. Each > such TAGS file would create an "external root" to be searched. That's what I thought. So a command that would only search what's in TAGS does have a place, IMO. It would also be a good replacement for tags-search. > And if you were to use xref-find-regexp to search for occurrences of > `tags-loop-continue', it would only find them in the sources. Whereas > both project- commands would also find its occurrences inside > doc/**/*.texi, etc/NEWS*, top-level ChangeLog files and inside test/. > > That looks distinctly more useful to me. Especially note how tags-search > skips the test/ directory. I think both use cases are legitimate. > How about xref-query-replace-in-matches? Fine with me. > >> Suppose we're in emacs-lisp-mode. What will xref-find-regexp do? Will it > >> search the load-path elements, but skip the current project, however > >> it's defined, if it's not in load-path? Will it only search *.el files > >> inside load-path directories, and ignore files with all other extensions? > > > > Why don't those questions arise when we invoke xref-find-references? > > How do you know in what files to search then? I think the same answer > > will do for the replacements of tags-search and tags-query-replace. > > For xref-find-references, we generally leave it up to the backend. But > that query is easier to make sense of: we usually only look for > references in source files, so it can disregard the rest. It would be OK for xref-find-regexp to do the same. Users who want the project.el way of doing that can invoke the commands there. (They should probably be documented in the manual.)