From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master d7df36e: Rewrite elisp--xref-find-definitions to handle many more cases; add tests.
Date: Wed, 12 Aug 2015 02:40:31 -0500 [thread overview]
Message-ID: <86y4hhvtsg.fsf@stephe-leake.org> (raw)
In-Reply-To: <55CA8C5B.4070409@yandex.ru> (Dmitry Gutov's message of "Wed, 12 Aug 2015 02:59:23 +0300")
Dmitry Gutov <dgutov@yandex.ru> writes:
> On 08/12/2015 02:30 AM, Stephen Leake wrote:
>
>>> How come you saw fit to undo the tweaks that I've added over time?
>>
>> Because they got in the way of some of my uses of xref-find-definitions.
>
> At least a question would've been nice.
>
>> In general, rather than using similar heuristics in the low level code,
>> we should be adding hints from the source being searched, and/or the
>> user.
>
> In general, elisp-xref doesn't open the source files. When used with
> xref-find-apropos, that was rather slow.
>
>> For example, one heuristic returned only the function when there are
>> both function and feature with the same name. But there are times when I
>> want to see both, or one or the other.
>
> If the feature and the function have the same name, idiomatically,
> they will always be in the same file.
I was going to say "not guarranteed", but that is a style we strongly
encourage, so I think it is reasonable to rely on it.
> Why wouldn't you want to jump to
> the function?
> I see you're also jumping to the (provide 'xxx) forms. What's the use
> in that?
I think that's because I was trying to find the closest equivalent to
what Ada mode does. In Ada, every file has clear syntax indicating "the
start of the file code", and M-. on "with foo;" jumps to that point in
foo.ads.
(provide 'foo) is the closest thing in elisp syntax. We could jump
to the ;;; Code: comment.
For a better reason, sometimes it does matter what happens in the file
after (provide 'foo), so that's sometimes a useful place to go.
> If it's not right, M-< is not too far away (or M->, as per below).
and M-. to jump to the function is also not too far away.
But even better is the source code info discussed below; if that works,
this point is moot.
>> So if I'm searching for the
>> identifier at point, in code like this:
>>
>> (dvc-log-edit ...) ;; point on '-l'; show defun
>> (require 'dvc-log-edit) ;; point on '-l'; show feature
>>
>> In both cases, we can easily tell from the source near point what the
>> user is searching for.
>
> Right, it's a good default behavior. But then we'll have to decide how
> the user could indicate whether elisp-xref should *not* look at the
> context. Currently, C-u only forces the prompt to appear, but the
> default value will still use the text properties from the context (if
> xref-default-identifier-at-point includes them).
C-u should strip the text properties.
>> Yes. But I thought the heuristic the previous code used was: "if there
>> is both a variable and a function by the same name, _assume_ they are
>> located in the same place, so only return the function". That assumption
>> is broken for some of my code, and I assume in many others as well.
>>
>> However, you point out later that you used (memq sym minor-mode-list) to
>> determine if this is from define-minor-mode.
>>
>> I didn't realize why that was there when reading the code.
>>
>> So I'll put that back, with a comment this time :).
>
> There was a comment: "Don't show minor modes twice". I thought it
> explained the purpose of (not (and (fboundp sym) (memq sym
> minor-mode-list))) clearly enough.
Not for me, obviously.
I will ask first about code I don't understand in the future.
Did you find my comments clear enough?
--
-- Stephe
next prev parent reply other threads:[~2015-08-12 7:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20150811025613.30799.89490@vcs.savannah.gnu.org>
[not found] ` <E1ZOzjZ-00081R-OT@vcs.savannah.gnu.org>
2015-08-11 16:13 ` [Emacs-diffs] master d7df36e: Rewrite elisp--xref-find-definitions to handle many more cases; add tests Dmitry Gutov
2015-08-11 16:25 ` Stefan Monnier
2015-08-11 16:29 ` Dmitry Gutov
2015-08-11 23:36 ` Stephen Leake
2015-08-12 8:36 ` Dmitry Gutov
2015-08-11 23:33 ` Stephen Leake
2015-08-12 14:08 ` Stefan Monnier
2015-08-12 14:24 ` Eli Zaretskii
2015-08-12 17:16 ` Stefan Monnier
2015-08-13 14:38 ` Eli Zaretskii
2015-08-13 15:59 ` Stefan Monnier
2015-08-14 10:36 ` Eli Zaretskii
2015-08-13 20:08 ` Stephen Leake
2015-08-12 19:42 ` Stephen Leake
2015-08-13 2:41 ` Eli Zaretskii
2015-08-11 23:30 ` Stephen Leake
2015-08-11 23:59 ` Dmitry Gutov
2015-08-12 7:40 ` Stephen Leake [this message]
2015-08-12 8:47 ` Dmitry Gutov
2015-08-12 14:05 ` Stefan Monnier
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=86y4hhvtsg.fsf@stephe-leake.org \
--to=stephen_leake@stephe-leake.org \
--cc=emacs-devel@gnu.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.