branch: elpa/idris-mode commit cb71c82e13a487305ded56487310ac8f49c114a1 Author: Marek L <nospam.ke...@gmail.com> Commit: Marek L <nospam.ke...@gmail.com>
Rename and unify `idris-pop-to-repl` and `idris-switch-to-output-buffer` in favour of command `idris-switch-to-repl` Why: To reduce the maintainance as both `pop-to-repl` and `switch-to-output-buffer` had almost identical expected behaviour. Secondly `idris-switch-to-repl` creates better symetry with `idris-switch-to-last-idris-buffer` --- idris-commands.el | 13 +++---------- idris-keys.el | 2 +- idris-repl.el | 8 +++++--- test-data/GenerateDef.idr | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/idris-commands.el b/idris-commands.el index af7eb582fb..040ecf75a5 100644 --- a/idris-commands.el +++ b/idris-commands.el @@ -939,20 +939,13 @@ type-correct, so loading will fail." "Remove Idris event hooks set after connection with Idris established." (dolist (h idris-event-hooks) (remove-hook 'idris-event-hooks h))) -(defun idris-pop-to-repl () - "Go to the REPL, if one is open." - (interactive) - (let ((buf (get-buffer idris-repl-buffer-name))) - (if buf - (pop-to-buffer buf) - (error "No Idris REPL buffer is open")))) +(define-obsolete-function-alias 'idris-pop-to-repl 'idris-switch-to-repl "2022-12-28") (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. +the same as for command `idris-switch-to-repl', +so it is convenient to jump between Idris code and REPL. Inspired by `cider-switch-to-last-clojure-buffer' https://github.com/clojure-emacs/cider" diff --git a/idris-keys.el b/idris-keys.el index 7dc5b97027..e639373382 100644 --- a/idris-keys.el +++ b/idris-keys.el @@ -75,7 +75,7 @@ (defun idris-define-general-keys (map) "Define keys that are generally useful for all Idris modes in the keymap MAP." - (define-key map (kbd "C-c C-z") 'idris-pop-to-repl) + (define-key map (kbd "C-c C-z") 'idris-switch-to-repl) (define-key map (kbd "<mouse-3>") 'prop-menu-show-menu) (define-key map (kbd "C-c C-SPC") 'prop-menu-by-completing-read)) diff --git a/idris-repl.el b/idris-repl.el index ae4c0b40ab..910f253603 100644 --- a/idris-repl.el +++ b/idris-repl.el @@ -159,18 +159,20 @@ If ALWAYS-INSERT is non-nil, always insert a prompt at the end of the buffer." (idris-repl-insert-prompt) (insert current-input)))) -(defun idris-switch-to-output-buffer () +(defun idris-switch-to-repl () "Select the output buffer and scroll to bottom." (interactive) (pop-to-buffer (idris-repl-buffer)) (goto-char (point-max))) +(define-obsolete-function-alias 'idris-switch-to-output-buffer 'idris-switch-to-repl "2022-12-28") + (autoload 'idris-run "idris-commands.el") ;;;###autoload (defun idris-repl () (interactive) (idris-run) - (idris-switch-to-output-buffer)) + (idris-switch-to-repl)) (defvar idris-repl-mode-map (let ((map (make-sparse-keymap))) @@ -190,7 +192,7 @@ 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 + (substitute-key-definition 'idris-switch-to-repl 'idris-switch-to-last-idris-buffer map) map) diff --git a/test-data/GenerateDef.idr b/test-data/GenerateDef.idr index 885ac9514a..0456cafb86 100644 --- a/test-data/GenerateDef.idr +++ b/test-data/GenerateDef.idr @@ -20,7 +20,7 @@ C-c C-r idris-refine C-c C-s idris-add-clause C-c C-t idris-type-at-point C-c C-w idris-make-with-block -C-c C-z idris-pop-to-repl +C-c C-z idris-switch-to-repl C-c C-S-a idris-proof-search-next C-c C-S-g idris-generate-def-next C-c C-SPC prop-menu-by-completing-read