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

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

[nongnu] elpa/idris-mode 063a63b770 17/18: Merge pull request #586 from


From: ELPA Syncer
Subject: [nongnu] elpa/idris-mode 063a63b770 17/18: Merge pull request #586 from idris-hackers/revert-583-update-pr-465
Date: Thu, 8 Dec 2022 05:59:08 -0500 (EST)

branch: elpa/idris-mode
commit 063a63b770ce8d2c543591e356b364d78db0363b
Merge: 51caa5f3a5 9ebd0a7d26
Author: Jan de Muijnck-Hughes <jfdm@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #586 from idris-hackers/revert-583-update-pr-465
    
    Revert "Restore position after case split"
---
 idris-commands.el | 54 ++++++++++++++++++++++--------------------------------
 inferior-idris.el |  1 -
 2 files changed, 22 insertions(+), 33 deletions(-)

diff --git a/idris-commands.el b/idris-commands.el
index 780fb65505..f69909c5f5 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -90,33 +90,24 @@
   (idris-run)
   (idris-repl-buffer))
 
-(defvar idris-retry 0)
-
 (defun idris-switch-working-directory (new-working-directory)
   "Switch working directory to NEW-WORKING-DIRECTORY."
-  (if (= idris-protocol-version 0)
-      (progn
-        (message "-t- idris-switch-working-directory connection not yet 
complete %s" idris-retry)
-        (sit-for 0.05)
-        (if (< 1 5)
-            (setq idris-retry (1+ idris-retry))
-          (idris-switch-working-directory new-working-directory)))
-    (setq idris-retry 0)
-    (unless (string= idris-process-current-working-directory 
new-working-directory)
-      (let* ((path (if (> idris-protocol-version 1)
-                       (prin1-to-string new-working-directory)
-                     new-working-directory))
-             (eval-result (idris-eval `(:interpret ,(concat ":cd " path))))
-             (result-msg (or (car-safe eval-result) "")))
-        ;; Check if the message from Idris contains the new directory path.
-        ;; Before check drop the last character (slash) in the path
-        ;; as the message does not include it.
-        (if (string-match-p (file-truename (substring new-working-directory 0 
-1))
-                            result-msg)
-            (progn
-              (message result-msg)
-              (setq idris-process-current-working-directory 
new-working-directory))
-          (error "Failed to switch the working directory %s" eval-result))))))
+  (unless (string= idris-process-current-working-directory 
new-working-directory)
+    (idris-ensure-process-and-repl-buffer)
+    (let* ((path (if (> idris-protocol-version 1)
+                     (prin1-to-string new-working-directory)
+                   new-working-directory))
+           (eval-result (idris-eval `(:interpret ,(concat ":cd " path))))
+           (result-msg (or (car-safe eval-result) "")))
+      ;; Check if the message from Idris contains the new directory path.
+      ;; Before check drop the last character (slash) in the path
+      ;; as the message does not include it.
+      (if (string-match-p (file-truename (substring new-working-directory 0 
-1))
+                          result-msg)
+          (progn
+            (message result-msg)
+            (setq idris-process-current-working-directory 
new-working-directory))
+        (error "Failed to switch the working directory %s" eval-result)))))
 
 (defun idris-list-holes-on-load ()
   "Use the user's settings from customize to determine whether to list the 
holes."
@@ -576,20 +567,19 @@ Useful for writing papers or slides."
 
 
 (defun idris-case-split ()
-  "Case split the pattern variable at point."
+  "Case split the pattern variable at point"
   (interactive)
   (let ((what (idris-thing-at-point)))
     (when (car what)
       (save-excursion (idris-load-file-sync))
-      (let ((result (car (idris-eval `(:case-split ,(cdr what) ,(car what)))))
-            (initial-position (point)))
+      (let ((result (car (idris-eval `(:case-split ,(cdr what) ,(car what))))))
         (if (<= (length result) 2)
             (message "Can't case split %s" (car what))
           (delete-region (line-beginning-position) (line-end-position))
           (if (> idris-protocol-version 1)
               (insert (substring result 0 (length result)))
-            (insert (substring result 0 (1- (length result)))))
-          (goto-char initial-position))))))
+              (insert (substring result 0 (1- (length result))))
+              ))))))
 
 (defun idris-make-cases-from-hole ()
   "Make a case expression from the metavariable at point."
@@ -603,8 +593,8 @@ Useful for writing papers or slides."
           (delete-region (line-beginning-position) (line-end-position))
           (if (> idris-protocol-version 1)
               (insert (substring result 0 (length result)))
-            (insert (substring result 0 (1- (length result)))))
-          (search-backward "_ of\n"))))))
+              (insert (substring result 0 (1- (length result))))
+              ))))))
 
 (defun idris-case-dwim ()
   "If point is on a hole name, make it into a case expression.
diff --git a/inferior-idris.el b/inferior-idris.el
index 02e21d6d86..8c2ae7b89c 100644
--- a/inferior-idris.el
+++ b/inferior-idris.el
@@ -75,7 +75,6 @@
 (defun idris-version-hook-function (event)
   (pcase event
     (`(:protocol-version ,version ,minor)
-     (message "-t- idris-version-hook-function 1")
      (setf idris-protocol-version version)
      (setf idris-protocol-version-minor minor)
      (remove-hook 'idris-event-hooks 'idris-version-hook-function)



reply via email to

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