GNU bug report logs -
#29193
26.0.90; Using (thing-at-point 'sexp) in flymake-diag-region might be suboptimal
Previous Next
Reported by: Dmitry Gutov <dgutov <at> yandex.ru>
Date: Tue, 7 Nov 2017 15:29:01 UTC
Severity: minor
Found in version 26.0.90
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Lars Ingebrigtsen <larsi <at> 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
This bug report was last modified 4 years and 158 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.