Skip to content

Conversation

@keram
Copy link
Contributor

@keram keram commented Sep 23, 2025

Why:
Allows to jump to the repl without having to manually start repl using a shortcut.

This change improves user experience. For example in scenario:

  • user visits foo.idr file
  • make some change and wants to verify it in repl
  • presses C-c C-z (default key binding for `idris-switch-to-repl')
  • and it is taken to the repl with the current file loaded

Previously invoking idris-switch-to-repl on a "cold" idr file would return an error: "idris-repl has no process".

@keram keram force-pushed the jump-to-repl-from-cold branch 3 times, most recently from 32a9313 to 76d183c Compare September 23, 2025 16:33
@keram keram marked this pull request as draft September 25, 2025 14:42
idris-repl.el Outdated
(interactive)
(if (and buffer-file-name
;; in Emacs 29.1 > we can use string-equal-ignore-case
(string= "idr" (downcase (file-name-extension buffer-file-name))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not the case that idris files can have other extensions if we are in literate mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I have updated the implementation to check also for lidr files although I don't have any good lidr examples to test it with.

@keram keram force-pushed the jump-to-repl-from-cold branch from b339073 to 1686c02 Compare September 27, 2025 13:04
"Load the current Idris file buffer and jump to the Idris REPL."
(interactive)
(if (or (idris-idr-p) (idris-lidr-p))
(idris-load-file-sync)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using synchronous load as async idris-load-file causes point to be moved from repl back to source file.

@keram keram force-pushed the jump-to-repl-from-cold branch from 1686c02 to d0495e9 Compare October 4, 2025 15:29
@keram keram force-pushed the jump-to-repl-from-cold branch from d0495e9 to ba38636 Compare November 16, 2025 15:39
(idris-run)
(idris-switch-to-repl))
(pop-to-buffer (idris-repl-buffer))
(goto-char (point-max)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed (idris-switch-to-repl) because user can invoke idris-repl without being in Idris file
and idris-switch-to-repl has now dependency to be invoked only within idr or lidr files.

@keram keram marked this pull request as ready for review November 16, 2025 15:47
@keram keram marked this pull request as draft November 17, 2025 10:03
…idris-switch-to-repl`

Why:
Allows to jump to the repl without having to manually start repl
using a shortcut
Why:
When jumping to a repl from non-loaded file
we want to do optimistic load.
Ergo even if Idris finds errors in the file the jump
to the repl should succeed.
@keram keram force-pushed the jump-to-repl-from-cold branch from ba38636 to 8b42812 Compare November 17, 2025 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants