From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#22692: docstring for xref-find-definitions Date: Sat, 20 Feb 2016 03:24:18 +0200 Message-ID: <56C7C042.2010907@yandex.ru> References: <20283.1455584523@allegro.localdomain> <673.1455767121@allegro.localdomain> <83ziuyt122.fsf@gnu.org> <56C7123A.6040408@yandex.ru> <83vb5kr9xt.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1455931523 10021 80.91.229.3 (20 Feb 2016 01:25:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Feb 2016 01:25:23 +0000 (UTC) Cc: 22692@debbugs.gnu.org, m.kupfer@acm.org, Juri Linkov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 20 02:25:11 2016 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 1aWwII-000832-1a for geb-bug-gnu-emacs@m.gmane.org; Sat, 20 Feb 2016 02:25:10 +0100 Original-Received: from localhost ([::1]:56938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWwIH-0004Um-8F for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Feb 2016 20:25:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWwID-0004TI-Fl for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2016 20:25:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWwIA-0007qu-88 for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2016 20:25:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWwIA-0007qq-3t for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2016 20:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aWwI9-0000AW-VU for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2016 20:25:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Feb 2016 01:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22692 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22692-submit@debbugs.gnu.org id=B22692.1455931468606 (code B ref 22692); Sat, 20 Feb 2016 01:25:01 +0000 Original-Received: (at 22692) by debbugs.gnu.org; 20 Feb 2016 01:24:28 +0000 Original-Received: from localhost ([127.0.0.1]:34387 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aWwHb-00009i-VV for submit@debbugs.gnu.org; Fri, 19 Feb 2016 20:24:28 -0500 Original-Received: from mail-wm0-f43.google.com ([74.125.82.43]:33680) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aWwHa-00009V-LX for 22692@debbugs.gnu.org; Fri, 19 Feb 2016 20:24:27 -0500 Original-Received: by mail-wm0-f43.google.com with SMTP id g62so90137653wme.0 for <22692@debbugs.gnu.org>; Fri, 19 Feb 2016 17:24:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=5v8dnUSvpbbYnmAFnXi6v5gJmWqt+LPIOb7d7yHYEOk=; b=qM2D+9l6EmlkZ3NDqHp1T3ipUukVLsvYWXXRN0o8/8+D5M4yo+/8irNMrGnIwTm70Z sk4KAaSsZPDkbh3qsctGALmFDVb8W3x7BhJ8UvhGikwVCcbRhI8mFFj+RQFYuuFmXnuz WIWVrqYJTlrhIfuNuSPsP9VBbdE1R3RvqOOjp3WwjcexNJGV/GadfirABWRGcWu8PVSf hXbBU+SnXbsQ2dAuyRDln4irL55VSsCL42aPUzPms+YgTHM+maf2Y2SqKiPP2XXWgwEn 9nRt+4EVv38eUWT5dM4sNuf2pjS6wYZmCGFgTT8UmTuonTPl04I0M17oDk3cCXg60e5S IxFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=5v8dnUSvpbbYnmAFnXi6v5gJmWqt+LPIOb7d7yHYEOk=; b=HgscRHAu5XWqFyCBE+1zzufKr1Bro34jWxbbhy/SwS65MbCSbu3s3sHU4S/7aOVcrY OAmeF9xxxrz8jY5rN91Fy/kFlCXZogKJwdaUC23Djri/GlfLzQSpKGtc9jUbsYkYhYqc IbGzM8VNmtKchRnqzJGGy+SYrOWaBnsIOAw1DBdYGl3H1AVVgiwwE+L4ztS5p07zwqDr QRFruQOCjcNNf/YGfqV0EvNoL6VP9g2jrz77XxloMLLgtRGOZPFHnix4o+j+fghJUqht L9UWAR3HlW/bzWmRiRp38QFgt2Uao4E/IbTV5LTtoDiK3fRULg69WIPYMZR8I4eMGIgR 0Uxw== X-Gm-Message-State: AG10YOTPczKL8kborsHYi0S9vBwylQ+wPz3NuDyooiiG5JAXw4kMi6NMsLOQ1qEN2Bh11Q== X-Received: by 10.194.142.135 with SMTP id rw7mr6156934wjb.84.1455931460914; Fri, 19 Feb 2016 17:24:20 -0800 (PST) Original-Received: from [192.168.1.2] ([185.105.175.24]) by smtp.googlemail.com with ESMTPSA id x65sm9943350wmg.4.2016.02.19.17.24.19 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Feb 2016 17:24:19 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:44.0) Gecko/20100101 Thunderbird/44.0 In-Reply-To: <83vb5kr9xt.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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:113321 Archived-At: On 02/19/2016 05:34 PM, Eli Zaretskii wrote: >> I'd prefer to use the more precise behavior in find-tag-default-bounds >> as well. And if there's general agreement here, I wouldn't mind taking >> care of that patch. > > Making such a change is fine with me, thanks. The patch is trivial (*). But can we really make this change? And can we do it in emacs-25? It's a breaking one, but it primarily affects xref (aside from the "obsolete" etags commands). And by doing it now, we can avoid similar breakage in the next Emacs release. The only other place find-tag-default-bounds is used, is in isearch-forward-symbol-at-point. Yuri, was there a reason you chose to use it instead of `bounds-of-thing-at-point'? > If find-tag-default-function is also used by xref-find-references, > then it won't be TRT to reject constants up front. A request to find > all the places where a certain constant is used is a valid use case. > It is indeed unlikely to have such a request for the constant 1, but > think about constants like 3.14159 or 3.0e+8. That's a valid argument. I also don't think numeric literals will create too many false positives, even for xref-find-definitions. (*) diff --git a/lisp/subr.el b/lisp/subr.el index c685f95..5f88d99 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2626,29 +2626,8 @@ find-tag-default-bounds "Determine the boundaries of the default tag, based on text at point. Return a cons cell with the beginning and end of the found tag. If there is no plausible default, return nil." - (let (from to bound) - (when (or (progn - ;; Look at text around `point'. - (save-excursion - (skip-syntax-backward "w_") (setq from (point))) - (save-excursion - (skip-syntax-forward "w_") (setq to (point))) - (> to from)) - ;; Look between `line-beginning-position' and `point'. - (save-excursion - (and (setq bound (line-beginning-position)) - (skip-syntax-backward "^w_" bound) - (> (setq to (point)) bound) - (skip-syntax-backward "w_") - (setq from (point)))) - ;; Look between `point' and `line-end-position'. - (save-excursion - (and (setq bound (line-end-position)) - (skip-syntax-forward "^w_" bound) - (< (setq from (point)) bound) - (skip-syntax-forward "w_") - (setq to (point))))) - (cons from to)))) + (require 'thingatpt) + (bounds-of-thing-at-point 'symbol)) (defun find-tag-default () "Determine default tag to search for, based on text at point.