unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: scratch/accurate-warning-pos: next steps.
Date: Tue, 11 Dec 2018 14:21:33 -0500	[thread overview]
Message-ID: <jwva7lbc23v.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: 83lg4w1s77.fsf@gnu.org

>> I'm not sure how this special-purpose code would work.  Say we find an
>> error or warning involving symbol foo as the car of some form, I can't
>> see any way of determining its source position that doesn't involve going
>> back to the position of the beginning of the form, and slogging through
>> the form, somehow.
> Yes, I was proposing something like that.  Why is that a problem?

IIUC what you're suggesting here is to add a heuristic which takes an
arbitrary chunk of code (can be a single symbol but not necessarily), an
approximate source location, and then tries to compute a better source
location from it.

I think making this 100% reliable (either in the sense of "return the
*right* location" or just "return a location that's sometimes/often
better and never worse") is somewhere between very hard and impossible.

But maybe a few well chosen heuristics could indeed give a significant
improvement (i.e. return a location that's sometimes/often better and
rarely worse).  To help the heuristic, we could pass it some indication
of the error (e.g. so it knows whether the symbol (or chunk of code)
we're looking for is expected to be in the position of a normal
expression, a let-binding, a var definition, a function definition,
a function call, ...).

Oh wait: I think if we return a range rather than a single position, we
could make it reliable in the sense that the actual position is within
the range (but sometimes the range will degenerate to cover a whole
top-level definition).


        Stefan




  reply	other threads:[~2018-12-11 19:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 18:00 scratch/accurate-warning-pos: next steps Alan Mackenzie
2018-12-10 18:15 ` Eli Zaretskii
2018-12-10 18:28   ` Alan Mackenzie
2018-12-10 18:39     ` Eli Zaretskii
2018-12-10 19:35       ` Alan Mackenzie
2018-12-10 20:06         ` Eli Zaretskii
2018-12-10 21:03           ` Alan Mackenzie
2018-12-11  6:41             ` Eli Zaretskii
2018-12-11 19:21               ` Stefan Monnier [this message]
2018-12-11 19:07             ` Stefan Monnier
2018-12-10 23:54 ` Paul Eggert
2018-12-11 11:34   ` Alan Mackenzie
2018-12-11 18:05     ` Paul Eggert
2018-12-11 19:20       ` Alan Mackenzie
2018-12-11 19:59         ` Paul Eggert
2018-12-11 20:51           ` Alan Mackenzie
2018-12-11 21:11             ` Stefan Monnier
2018-12-11 21:35               ` Alan Mackenzie
2018-12-11 22:58                 ` Stefan Monnier
2018-12-11 21:43             ` Paul Eggert

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwva7lbc23v.fsf-monnier+gmane.emacs.devel@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).