calc embedded mode and evil mode

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

calc embedded mode and evil mode

Eric S Fraga
Hello all,

I use evil mode extensively.  However, I also use embedded calc
mode.  The latter cannot be in evil mode as it has its own
bindings.  However, switching to embedded mode (C-x * e) leaves the
editing mode as it is, i.e. in evil mode.  I have tried the following,
to no effect:

   (add-hook 'calc-embedded-mode-hook #'(evil-emacs-state))
   
although typing C-z (bound to evil-emacs-state) after C-x *e does switch
to emacs state.

Any suggestions most welcome!  Thank you.
--
Eric S Fraga via Emacs 27.0.50 & org 9.2.6 on Debian bullseye/sid


Reply | Threaded
Open this post in threaded view
|

Re: calc embedded mode and evil mode

Óscar Fuentes
Eric S Fraga <[hidden email]> writes:

> I use evil mode extensively.  However, I also use embedded calc
> mode.  The latter cannot be in evil mode as it has its own
> bindings.  However, switching to embedded mode (C-x * e) leaves the
> editing mode as it is, i.e. in evil mode.  I have tried the following,
> to no effect:
>
>    (add-hook 'calc-embedded-mode-hook #'(evil-emacs-state))
>    
> although typing C-z (bound to evil-emacs-state) after C-x *e does switch
> to emacs state.
>
> Any suggestions most welcome!  Thank you.

(add-hook 'calc-embedded-new-formula-hook #'evil-emacs-state)

does the trick of changing to evil-emacs-state here. I don't know about
a method for returning to some Evil state after exiting calc-embedded.

But if I invoke calc-embedded while Evil is in insert-state, I can use
calc-embedded just fine, at least for the simple tests I've tried.


Reply | Threaded
Open this post in threaded view
|

Re: calc embedded mode and evil mode

Eric S Fraga
On Friday,  8 Nov 2019 at 19:06, Óscar Fuentes wrote:
> (add-hook 'calc-embedded-new-formula-hook #'evil-emacs-state)
>
> does the trick of changing to evil-emacs-state here.

Ah, for some reason, I had assumed this hook would only be invoked when
creating a new formula from scratch.  Silly me!  Yes, this works well
indeed.  Thank you.

More importantly, thanks for pointing out that the embedded calc
keybindings all work in evil insert mode so maybe that's the better
route overall in any case.

--
Eric S Fraga via Emacs 27.0.50 & org 9.2.6 on Debian bullseye/sid