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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/vlf f1ade81 069/310: Add go to line command.


From: Stefan Monnier
Subject: [elpa] externals/vlf f1ade81 069/310: Add go to line command.
Date: Sat, 28 Nov 2020 00:32:49 -0500 (EST)

branch: externals/vlf
commit f1ade8106c3d6b05a650743598c1830560b09f20
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>

    Add go to line command.
---
 vlfi.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/vlfi.el b/vlfi.el
index 347788f..6bf37ca 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -66,6 +66,7 @@
     (define-key map "]" 'vlfi-end-of-file)
     (define-key map "e" 'vlfi-edit-mode)
     (define-key map "j" 'vlfi-jump-to-chunk)
+    (define-key map "l" 'vlfi-goto-line)
     map)
   "Keymap for `vlfi-mode'.")
 
@@ -425,6 +426,22 @@ Search is performed chunk by chunk in `vlfi-batch-size' 
memory."
                      (or current-prefix-arg 1)))
   (vlfi-re-search regexp count t))
 
+(defun vlfi-goto-line (n)
+  "Go to line N."
+  (interactive "nGo to line: ")
+  (let ((start-pos vlfi-start-pos)
+        (end-pos vlfi-end-pos)
+        (pos (point))
+        (success nil))
+    (unwind-protect
+        (progn (vlfi-beginning-of-file)
+               (goto-char (point-min))
+               (setq success (vlfi-re-search-forward "[\n\C-m]"
+                                                     (1- n))))
+      (unless success
+        (vlfi-move-to-chunk start-pos end-pos)
+        (goto-char pos)))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; editing
 



reply via email to

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