[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/relint 159a210 13/15: Simplify line/column computation
From: |
Mattias Engdegård |
Subject: |
[elpa] externals/relint 159a210 13/15: Simplify line/column computation and reindent |
Date: |
Sat, 29 Feb 2020 17:22:30 -0500 (EST) |
branch: externals/relint
commit 159a210c0b4ba5923dde6dcd0545ac8fd5fa35f7
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
Simplify line/column computation and reindent
---
relint.el | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/relint.el b/relint.el
index bbda180..2171a75 100644
--- a/relint.el
+++ b/relint.el
@@ -151,13 +151,6 @@ list indices to follow to target)."
(relint--follow-path path)
(point)))
-(defun relint--line-col-from-pos (pos)
- "(LINE . COLUMN), both 1-based, from POS."
- (save-excursion
- (goto-char pos)
- (cons (line-number-at-pos pos t)
- (1+ (current-column)))))
-
(defun relint--literal-string-pos (string-pos n)
"Position of character N in a literal string at STRING-POS."
(save-excursion
@@ -233,17 +226,18 @@ or nil if no position could be determined."
(relint--add-to-error-buffer (concat string "\n"))))
(defun relint--output-report (file pos message str str-pos)
- (let* ((line-col (relint--line-col-from-pos pos))
- (line (car line-col))
- (col (cdr line-col)))
- (relint--output-message
- (concat
- (format "%s:%d:%d: %s" file line col message)
- (and str-pos (format " (pos %d)" str-pos))
- (and str
- (format "\n %s\n %s"
- (relint--quote-string str)
- (relint--caret-string str str-pos)))))))
+ (let ((line (line-number-at-pos pos t))
+ (col (save-excursion
+ (goto-char pos)
+ (1+ (current-column)))))
+ (relint--output-message
+ (concat
+ (format "%s:%d:%d: %s" file line col message)
+ (and str-pos (format " (pos %d)" str-pos))
+ (and str
+ (format "\n %s\n %s"
+ (relint--quote-string str)
+ (relint--caret-string str str-pos)))))))
(defvar relint--report-function #'relint--output-report
"Function accepting a found complaint, taking the arguments
- [elpa] externals/relint a2a29d6 03/15: Scan arguments to search-{forward, backward}-regexp, (continued)
- [elpa] externals/relint a2a29d6 03/15: Scan arguments to search-{forward, backward}-regexp, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint c733b47 05/15: Use text quoting for all messages, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint b46ee8b 04/15: Update copyright year to 2020, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint bb7d8a1 10/15: Fix mistake in previous commit, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint 1741e2c 09/15: Locate error position in 'concat' forms, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint 8cc1017 12/15: Rename relint--pos-from-toplevel-pos-path, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint 9de65a6 11/15: Remove package description in relint.el, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint c33b893 06/15: Refactor error reporting, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint 803579c 01/15: More font-lock-keywords detection, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint 47490f3 08/15: Add relint-buffer for easier use of relint as a library, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint 159a210 13/15: Simplify line/column computation and reindent,
Mattias Engdegård <=
- [elpa] externals/relint c2d3f3b 15/15: Increment version to 1.14, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint 4a8b0ef 14/15: Return position of both expression and error from relint-buffer, Mattias Engdegård, 2020/02/29
- [elpa] externals/relint 7b93662 07/15: Report error position inside string literals, Mattias Engdegård, 2020/02/29