[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/relint cb1fdc5 06/44: Add caret pointing out the error
From: |
Mattias Engdegård |
Subject: |
[elpa] externals/relint cb1fdc5 06/44: Add caret pointing out the error in the quoted regexp |
Date: |
Tue, 26 Mar 2019 12:57:25 -0400 (EDT) |
branch: externals/relint
commit cb1fdc5d10df9907df19afbe56e08165657684e9
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Add caret pointing out the error in the quoted regexp
This helps when regexp strings are long and contain many backslashes,
which is frequently the case.
---
trawl.el | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/trawl.el b/trawl.el
index 48ef364..0f97633 100644
--- a/trawl.el
+++ b/trawl.el
@@ -118,13 +118,21 @@
str t t)
"\""))
+(defun trawl--caret-string (string pos)
+ (let ((quoted-pos
+ (- (length (trawl--quote-string (substring string 0 pos)))
+ 2))) ; Lop off quotes
+ (concat (make-string quoted-pos ?.) "^")))
+
(defun trawl--check-re-string (re name file pos path)
(let ((complaints
(condition-case err
(mapcar (lambda (warning)
- (format "In %s: %s (pos %d): %s"
- name (cdr warning) (car warning)
- (trawl--quote-string re)))
+ (let ((pos (car warning)))
+ (format "In %s: %s (pos %d)\n %s\n %s"
+ name (cdr warning) pos
+ (trawl--quote-string re)
+ (trawl--caret-string re pos))))
(xr-lint re))
(error (list (format "In %s: Error: %s: %s"
name (cadr err)
@@ -246,17 +254,6 @@
(defun trawl--check-form-recursively (form file pos path)
(pcase form
-;;; (`(defun ,name ,_ . ,body)
-;;; (let ((f body))
-;;; (while (and f (consp (car f)) (eq (caar f) 'declare))
-;;; (setq f (cdr f)))
-;;; (when (and f (consp (car f)))
-;;; (setq f (cdr f))
-;;; (while (cdr f)
-;;; (when (stringp (car f))
-;;; (trawl--report file pos path
-;;; (format "defun %s: misplaced doc string" name)))
-;;; (setq f (cdr f))))))
(`(,(or `looking-at `re-search-forward `re-search-backward
`string-match `string-match-p `looking-back `looking-at-p
`replace-regexp-in-string `replace-regexp
- [elpa] externals/relint 02bf0ba 21/44: Use explicit list of pure functions, (continued)
- [elpa] externals/relint 02bf0ba 21/44: Use explicit list of pure functions, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint 7d0e177 20/44: Rewrite the higher-order function handling, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint be3979a 19/44: Check TRIM argument of `split-string' as well, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint 5143edf 17/44: Fix indentation accidents, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint d6320f9 14/44: Detect functions with regexp arguments, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint d19133e 09/44: Better variable name patterns, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint d4d8f97 11/44: Eval mapcar and mapcan with partial-evaluated lists, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint 34304b4 08/44: Add (provides) line to make file importable, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint 62ca3d4 05/44: Slight performance improvement, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint 6ab713e 07/44: Reinstate erroneously removed line, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint cb1fdc5 06/44: Add caret pointing out the error in the quoted regexp,
Mattias Engdegård <=
- [elpa] externals/relint b4fc385 04/44: Rename trawl--batch to trawl-batch, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint 0214845 01/44: Move to github, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint 830f4bf 03/44: Allow use from batch mode, Mattias Engdegård, 2019/03/26
- [elpa] externals/relint 125b869 02/44: Try harder recovering from read errors, Mattias Engdegård, 2019/03/26