tonini / alchemist.el

Elixir Tooling Integration Into Emacs
http://www.alchemist-elixir.org
906 stars 103 forks source link

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

Open axelson opened 6 years ago

axelson commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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