]> gitweb.factorcode.org Git - factor.git/commitdiff
FUEL: don't jump to USING: section after updating
authortimor <timor.dd@googlemail.com>
Mon, 6 May 2019 15:19:32 +0000 (17:19 +0200)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 10 May 2019 22:41:25 +0000 (15:41 -0700)
misc/fuel/fuel-debug.el

index 7f9dc3ea4130ee5e0fc9abbcc58b0b7ac19d779d..0ee277ede854417d1d65cbf30b6c651d97955a26 100644 (file)
@@ -308,20 +308,21 @@ the debugger."
 
 (defun fuel-debug--replace-usings (file uses)
   (pop-to-buffer (find-file-noselect file))
-  (goto-char (point-min))
-  (if (re-search-forward "^USING: " nil t)
-      (let ((begin (point))
-            (end (or (and (re-search-forward ";\\( \\|$\\)") (point))
-                     (point))))
-        (kill-region begin end))
-    (re-search-forward "^IN: " nil t)
-    (beginning-of-line)
-    (open-line 2)
-    (insert "USING: "))
-  (let ((start (point))
-        (tokens (append uses '(";"))))
-    (insert (mapconcat 'substring-no-properties tokens " "))
-    (fill-region start (point) nil)))
+  (save-excursion
+    (goto-char (point-min))
+    (if (re-search-forward "^USING: " nil t)
+        (let ((begin (point))
+              (end (or (and (re-search-forward ";\\( \\|$\\)") (point))
+                       (point))))
+          (kill-region begin end))
+      (re-search-forward "^IN: " nil t)
+      (beginning-of-line)
+      (open-line 2)
+      (insert "USING: "))
+    (let ((start (point))
+          (tokens (append uses '(";"))))
+      (insert (mapconcat 'substring-no-properties tokens " "))
+      (fill-region start (point) nil))))
 
 (defun fuel-debug-update-usings ()
   (interactive)