all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 29193@debbugs.gnu.org, Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#29193: 26.0.90; Using (thing-at-point 'sexp) in flymake-diag-region might be suboptimal
Date: Sun, 13 Dec 2020 13:19:08 +0000	[thread overview]
Message-ID: <87r1ntzvw3.fsf@gmail.com> (raw)
In-Reply-To: <87wnxl50nn.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 13 Dec 2020 13:51:56 +0100")

Lars Ingebrigtsen <larsi@gnus.org> writes:

> OK, adding João to the Cc's.

Not sure why 'symbol and 'sexp don't reference the same "thing", or at
least stuff consistent in terms of nesting.  In my testing
(thing-at-point 'sexp) at the "e" got me nothing, but at the "n" or "d"
got me the whole sexp.  Similar strange situation with "begin".  "b"
sees the whole sexp, any of "egin" doesn't.  This seems to resist
different indentations.

In the end flymake-diag-region tries its best to guess a region from
limited line/col stuff and asks thingatpt.el for help, which in turn
will probably ask the major-mode for syntactic navigation.

So I wouldn't say the problem is in flymake.el, but in whom is
untimately providing the (broken) goods.  Then again maybe this untested
patch would work and not break much stuff for other backends...

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index efa7b2ffbf..6c3e0a1981 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -437,7 +437,8 @@ flymake-diag-region
               (if (and col (cl-plusp col))
                   (let* ((beg (progn (forward-char (1- col))
                                      (point)))
-                         (sexp-end (ignore-errors (end-of-thing 'sexp)))
+                         (sexp-end (or (ignore-errors (end-of-thing 'sexp))
+                                       (ignore-errors (end-of-thing 'symbol))))
                          (end (or (and sexp-end
                                        (not (= sexp-end beg))
                                        sexp-end)


Other than that, I don't have much to add.  I don't have the resources
to debug ruby-mode and/or install rubocop right now.  Good luck.

João









  reply	other threads:[~2020-12-13 13:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 15:28 bug#29193: 26.0.90; Using (thing-at-point 'sexp) in flymake-diag-region might be suboptimal Dmitry Gutov
2020-12-12 11:39 ` Lars Ingebrigtsen
2020-12-12 23:56   ` Dmitry Gutov
2020-12-13 12:51     ` Lars Ingebrigtsen
2020-12-13 13:19       ` João Távora [this message]
2020-12-13 20:55         ` Dmitry Gutov
2020-12-14 11:03           ` João Távora
2020-12-16  0:55             ` Dmitry Gutov
     [not found] ` <handler.29193.D29193.160808016725606.notifdone@debbugs.gnu.org>
2020-12-17 23:25   ` Glenn Morris
2020-12-18  2:06     ` Dmitry Gutov
2020-12-18 11:42       ` João Távora
2020-12-18 15:22         ` Dmitry Gutov
2020-12-18 15:26           ` João Távora
2020-12-18 15:29             ` Dmitry Gutov
2020-12-18 15:39               ` João Távora

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=87r1ntzvw3.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=29193@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=larsi@gnus.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.