Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: add a keybinding/command to restart IEx #336

Open
axelson opened this issue Jan 15, 2018 · 3 comments
Open

Feature request: add a keybinding/command to restart IEx #336

axelson opened this issue Jan 15, 2018 · 3 comments

Comments

@axelson
Copy link

axelson commented Jan 15, 2018

It appears that there is no keybinding to restart IEx. Would it be possible to add one? Times when a restarting IEx are necessary include: adding a new dependency, switching between plain IEx and iex -S mix. Right now you either have to restart emacs or manually kill the IEx process.

@maruks
Copy link

maruks commented Feb 19, 2018

write it yourself

(defun alchemist-iex-reload (&optional arg)
  (interactive "P")
  (when (buffer-live-p alchemist-iex-buffer)
    (kill-process (get-buffer-process alchemist-iex-buffer))
    (sleep-for 1)
    (if arg
	(call-interactively 'alchemist-iex-project-run)
        (call-interactively 'alchemist-iex-run))))
(eval-after-load 'elixir-mode
  '(progn
     (define-key elixir-mode-map (kbd "C-c a i t") 'alchemist-iex-reload)))

C-u C-c a i t runs alchemist-iex-project-run

@gausby
Copy link
Contributor

gausby commented Feb 19, 2018

I'd say it would be okay to introduce a version that use the universal-argument in the manner that @maruks suggest. If one can start iex from Alchemist one should be able to start it in a manner that replace the already running iex.

I vote for @maruks creating a pull request with his function definition :)

@axelson
Copy link
Author

axelson commented Feb 20, 2018

@maruks Thanks! That works nicely. I'm just starting to learn Emacs Lisp so I currently have a hard time writing my own functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants