emacs-elpa-diffs
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]