all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 22692@debbugs.gnu.org, m.kupfer@acm.org, Juri Linkov <juri@linkov.net>
Subject: bug#22692: docstring for xref-find-definitions
Date: Sat, 20 Feb 2016 03:24:18 +0200	[thread overview]
Message-ID: <56C7C042.2010907@yandex.ru> (raw)
In-Reply-To: <83vb5kr9xt.fsf@gnu.org>

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.






  reply	other threads:[~2016-02-20  1:24 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16  1:02 bug#22692: 25.0.91; xref-find-definitions fails to prompt Mike Kupfer
2016-02-16  3:44 ` Eli Zaretskii
2016-02-16 10:10   ` Dmitry Gutov
2016-02-16 16:01     ` Eli Zaretskii
2016-02-16 10:12 ` Dmitry Gutov
2016-02-17  1:55   ` Mike Kupfer
2016-02-19 13:43     ` Dmitry Gutov
2016-02-19 15:10       ` Mike Kupfer
2016-02-19 15:59       ` Eli Zaretskii
2016-02-19 18:08         ` Dmitry Gutov
2016-02-19 18:37           ` Eli Zaretskii
2016-02-19 18:52             ` Dmitry Gutov
2016-02-19 20:24               ` Eli Zaretskii
2016-02-20  1:28                 ` Dmitry Gutov
2016-02-20  8:45                   ` Eli Zaretskii
2016-02-21  3:36                     ` Mike Kupfer
2016-02-21 22:56                       ` Dmitry Gutov
2016-02-23  0:43         ` Dmitry Gutov
2016-02-23  2:19           ` Mike Kupfer
2016-02-18  3:45 ` bug#22692: docstring for xref-find-definitions Mike Kupfer
2016-02-18 16:50   ` Eli Zaretskii
2016-02-18 18:48     ` Mike Kupfer
2016-02-19 13:04       ` Dmitry Gutov
2016-02-19 13:01     ` Dmitry Gutov
2016-02-19 15:34       ` Eli Zaretskii
2016-02-20  1:24         ` Dmitry Gutov [this message]
2016-02-20  8:33           ` Eli Zaretskii
2016-02-23  0:04             ` Juri Linkov
2016-02-23  0:35               ` Dmitry Gutov
2016-02-27 10:32                 ` Eli Zaretskii
2016-02-27 12:35                   ` Dmitry Gutov
2016-02-27 12:43                     ` Eli Zaretskii
2016-02-29  2:48                       ` Dmitry Gutov
2016-02-23  0:41               ` Drew Adams
2016-02-21  3:42           ` Mike Kupfer

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=56C7C042.2010907@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=22692@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=m.kupfer@acm.org \
    /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.