[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 0b28bac802 2/3: consult--goto-line-position: Si
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 0b28bac802 2/3: consult--goto-line-position: Simplify |
Date: |
Mon, 26 Jun 2023 09:57:50 -0400 (EDT) |
branch: externals/consult
commit 0b28bac80295ed12038b843a56db2f8edba7d0dc
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
consult--goto-line-position: Simplify
---
consult.el | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/consult.el b/consult.el
index 971aa07f42..99326df166 100644
--- a/consult.el
+++ b/consult.el
@@ -3638,21 +3638,17 @@ INITIAL is the initial input."
Print an error message with MSG function."
(save-match-data
(if (and str (string-match "\\`\\([[:digit:]]+\\):?\\([[:digit:]]*\\)\\'"
str))
- (let* ((line (string-to-number (match-string 1 str)))
- (col (string-to-number (match-string 2 str)))
- (pos (save-excursion
- (save-restriction
- (when consult-line-numbers-widen
- (widen))
- (goto-char (point-min))
- (forward-line (1- line))
- (when (> col 0)
- (goto-char (min (+ (point) (1- col)) (pos-eol))))
- (point)))))
- (if (consult--in-range-p pos)
- pos
- (funcall msg "Line number out of range.")
- nil))
+ (let ((line (string-to-number (match-string 1 str)))
+ (col (string-to-number (match-string 2 str))))
+ (save-excursion
+ (save-restriction
+ (when consult-line-numbers-widen
+ (widen))
+ (goto-char (point-min))
+ (forward-line (1- line))
+ (when (> col 0)
+ (goto-char (min (+ (point) (1- col)) (pos-eol))))
+ (point))))
(when (and str (not (equal str "")))
(funcall msg "Please enter a number."))
nil)))