branch: externals/relint commit fe1c11d73317500296adb52247363f007225fbe4 Author: Mattias Engdegård <matti...@acm.org> Commit: Mattias Engdegård <matti...@acm.org>
Fix source position computation in certain dotted lists Trace the position correctly for sources having the form (a . ((b c))). --- relint.el | 7 +++++++ test/10.elisp | 3 ++- test/10.expected | 7 +++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/relint.el b/relint.el index 1883159b6d..48bce061ca 100644 --- a/relint.el +++ b/relint.el @@ -145,6 +145,13 @@ and PATH is (3 0 1 2), then the returned position is right before G." (relint--skip-whitespace) (let ((skip (car p))) ;; Enter next sexp and skip past the `skip' first sexps inside. + (when (looking-at (rx ".")) + ;; Skip `. (' since it represents zero sexps. + (forward-char) + (relint--skip-whitespace) + (when (looking-at (rx "(")) + (forward-char) + (relint--skip-whitespace))) (cond ((looking-at (rx (or "'" "#'" "`" ",@" ","))) (goto-char (match-end 0)) diff --git a/test/10.elisp b/test/10.elisp index fe3f396363..3a6dbc646a 100644 --- a/test/10.elisp +++ b/test/10.elisp @@ -12,7 +12,8 @@ ,(cons 'd "[dd]") (e . ,(concat "[e" "e]")) ,@(list '(f . "[ff]") '(g . "[gg]")) - (i . "[hh]"))) + (i . "[hh]") + (j . ((rx bol (in "z-z")))))) (defconst test-3-regexp-alist (list diff --git a/test/10.expected b/test/10.expected index 4f08705cb5..c4af0ed618 100644 --- a/test/10.expected +++ b/test/10.expected @@ -22,9 +22,12 @@ 10.elisp:15:13: In test-2-regexp-alist: Duplicated `h' inside character alternative (pos 2) "[hh]" ..^ -10.elisp:19:9: In test-3-regexp-alist: Duplicated `i' inside character alternative (pos 2) +10.elisp:16:24: Single-character range `z-z' (pos 0) + "z-z" + ^ +10.elisp:20:9: In test-3-regexp-alist: Duplicated `i' inside character alternative (pos 2) "[ii]" ..^ -10.elisp:19:18: In test-3-regexp-alist: Duplicated `j' inside character alternative (pos 2) +10.elisp:20:18: In test-3-regexp-alist: Duplicated `j' inside character alternative (pos 2) "[jj]" ..^