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

(hy-shell-eval-current-form) takes me to the *Hy* buffer #87

Open
lispercat opened this issue Dec 23, 2019 · 5 comments
Open

(hy-shell-eval-current-form) takes me to the *Hy* buffer #87

lispercat opened this issue Dec 23, 2019 · 5 comments

Comments

@lispercat
Copy link

Maybe it's a feature, but every time I press C-M-x it takes me to the Hy buffer so I have to need to go back to my source file.
Not sure if it's the intended behavior, just feels rather odd.
Is there a way to configure to stay in the source unless I explicitly want to go to Hy?

@ekaschalk
Copy link
Collaborator

You could always wrap it in a save-excursion or save-window-excursion.

@lispercat
Copy link
Author

lispercat commented Dec 25, 2019 via email

@TatriX
Copy link
Contributor

TatriX commented Apr 4, 2020

It would be amazing to have a defcustom to tweak this behavior.

@noobymcnoob
Copy link

Behavior similar to eval-last-sexp as default would be awesome.

@TatriX
Copy link
Contributor

TatriX commented Jul 22, 2020

Behavior similar to eval-last-sexp as default would be awesome.

You can try something like this:

(use-package hy-mode
  :bind (:map hy-mode-map ("C-c C-c" . my-hy-eval-last-sexp))
  :config
  ;; Don't echo python code back
  (setq hy-shell--interpreter-args '("--repl-output-fn" "hy.contrib.hy-repr.hy-repr"))

  (defun my-hy-eval-last-sexp ()
    (interactive)
    (save-window-excursion
      (hy-shell--send (hy--last-sexp-string)))))

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

No branches or pull requests

4 participants