[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/idris-mode 103f1e5fbf 2/8: Add ability to quickly switch f
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/idris-mode 103f1e5fbf 2/8: Add ability to quickly switch from Idris repl to |
Date: |
Fri, 11 Nov 2022 06:58:58 -0500 (EST) |
branch: elpa/idris-mode
commit 103f1e5fbfcddce4cabd02da19eff5eac69edc5c
Author: Marek L <nospam.keram@gmail.com>
Commit: Marek Labos <marek@syftapp.com>
Add ability to quickly switch from Idris repl to
last Idris source code file using:
`M-x idris-switch-to-last-idris-buffer` or key binding
used to jump from a file to repl (`C-c C-z` by default).
This is simplified version of `cider-switch-to-last-clojure-buffer` from
https://github.com/clojure-emacs/cider/blob/master/cider-mode.el#L122-L145
---
idris-commands.el | 18 ++++++++++++++++++
idris-repl.el | 3 +++
2 files changed, 21 insertions(+)
diff --git a/idris-commands.el b/idris-commands.el
index 6e0f7485db..9e77008042 100644
--- a/idris-commands.el
+++ b/idris-commands.el
@@ -949,6 +949,24 @@ 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)
+ (if-let* ((a-buf (seq-find
+ (lambda (b) (eq 'idris-mode (buffer-local-value
'major-mode b)))
+ (buffer-list))))
+ (pop-to-buffer a-buf `(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.")
- [nongnu] elpa/idris-mode updated (8933ab84f9 -> 1adee4fe06), ELPA Syncer, 2022/11/11
- [nongnu] elpa/idris-mode d1a9171fd7 1/8: Jump to last Idris Code buffer when we quit buffer, ELPA Syncer, 2022/11/11
- [nongnu] elpa/idris-mode cba57f7ff4 6/8: Merge pull request #557 from keram/jump-back-on-quit, ELPA Syncer, 2022/11/11
- [nongnu] elpa/idris-mode e7e2a6c3bc 3/8: Remove dependency on if-let* defined in subr-x, ELPA Syncer, 2022/11/11
- [nongnu] elpa/idris-mode 1adee4fe06 8/8: Merge pull request #560 from keram/interactive-s-flag, ELPA Syncer, 2022/11/11
- [nongnu] elpa/idris-mode 103f1e5fbf 2/8: Add ability to quickly switch from Idris repl to,
ELPA Syncer <=
- [nongnu] elpa/idris-mode e1fd68e494 4/8: Revert removal of s flag from interactive., ELPA Syncer, 2022/11/11
- [nongnu] elpa/idris-mode bc44e934f8 5/8: Stop CI run?, ELPA Syncer, 2022/11/11
- [nongnu] elpa/idris-mode 7a0b5c736d 7/8: Merge pull request #558 from keram/jump-to-file-from-repl, ELPA Syncer, 2022/11/11