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

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

[nongnu] elpa/idris-mode 7a0b5c736d 7/8: Merge pull request #558 from ke


From: ELPA Syncer
Subject: [nongnu] elpa/idris-mode 7a0b5c736d 7/8: Merge pull request #558 from keram/jump-to-file-from-repl
Date: Fri, 11 Nov 2022 06:58:58 -0500 (EST)

branch: elpa/idris-mode
commit 7a0b5c736d15fcb6d67fb584f30236a7fedad715
Merge: cba57f7ff4 e7e2a6c3bc
Author: Jan de Muijnck-Hughes <jfdm@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #558 from keram/jump-to-file-from-repl
    
    Add ability to quickly switch from Idris repl to
---
 idris-commands.el | 19 +++++++++++++++++++
 idris-repl.el     |  3 +++
 2 files changed, 22 insertions(+)

diff --git a/idris-commands.el b/idris-commands.el
index 6e0f7485db..a11bba322a 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -949,6 +949,25 @@ type-correct, so loading will fail."
         (pop-to-buffer buf)
       (error "No Idris REPL buffer is open."))))
 
+(defun idris-switch-to-last-idris-buffer ()
+  "Switch to the last Idris buffer.
+The default keybinding for this command is
+the same as variable `idris-pop-to-repl',
+so that it is very convenient to jump between a
+Idris buffer and the REPL buffer.
+
+Inspired by `cider-switch-to-last-clojure-buffer'
+https://github.com/clojure-emacs/cider";
+  (interactive)
+  (if (derived-mode-p 'idris-repl-mode)
+      (let ((idris-buffer (seq-find
+                           (lambda (b) (eq 'idris-mode (buffer-local-value 
'major-mode b)))
+                           (buffer-list))))
+        (if idris-buffer
+            (pop-to-buffer idris-buffer `(display-buffer-reuse-window))
+          (user-error "No Idris buffer found")))
+    (user-error "Not in a Idris REPL buffer")))
+
 (defun idris-quit ()
   "Quit the Idris process, cleaning up the state synchronized with Emacs."
   (interactive)
diff --git a/idris-repl.el b/idris-repl.el
index bf081eb9c4..509fd1c93d 100644
--- a/idris-repl.el
+++ b/idris-repl.el
@@ -187,6 +187,9 @@ If ALWAYS-INSERT is non-nil, always insert a prompt at the 
end of the buffer."
                   idris-define-general-keys
                   idris-define-active-term-keys)
              do (funcall keyer map))
+    (substitute-key-definition 'idris-pop-to-repl
+                               'idris-switch-to-last-idris-buffer
+                               map)
     map)
   "Keymap used in Idris REPL mode.")
 



reply via email to

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