Closed gujiaxi closed 8 years ago
If you kill the inferior ESS buffer and restart it (after evaluating that code), is it still in normal state?
In my .emacs, I do it this way:
(let ((initial-state-emacs-modes '(...
ess-help-mode
inferior-ess-mode
...)))
(mapc (lambda (m)
(evil-set-initial-state m 'emacs))
initial-state-emacs-modes))
...and that seems to work. But I seem to remember that it only appears to set the evil state you specify when a buffer in that mode is created, and not when you switch to one that already exists.
If you kill the inferior ESS buffer and restart it (after evaluating that code), is it still in normal state?
Yes, it is still in normal state. As comparison, I can easily get into emacs state in inferior-python-mode
using the similar method.
In .emacs
:
;; evil
(require 'evil)
(evil-mode t)
(evil-set-initial-state 'inferior-ess-mode 'emacs)
;; ess
(require 'ess)
(add-to-list 'auto-mode-alist '("\\.[rR]\\'" . R-mode))
M-x R
to start a inferior-ess-mode
buffer.That's because ESS is not written in terms of proper modes. So the mode initialisation does not follow Emacs conventions because everything is done manually. In particular, after-change-major-mode-hook
is not run.
There is a long-term plan to rewrite ESS with derived modes. We could add the proper run-hooks at the end of inferior-ess-mode
though. Do you see any unintended side effects to this @vspinu?
In the meantime, one workaround for your problem is to add comint
to the Emacs initial state. May I ask why you don't keep it in Evil state? With these hooked in inferior-ess-mode-hook
, I personally think Evil is more usable:
(setq-local comint-use-prompt-regexp nil)
(setq-local inhibit-field-text-motion nil)
@lionel- Thanks, comint
way works like a charm.
I use Evil in most modes but I want to use its emacs-state in
inferior-ess-mode
. For this purpose, I add the following code in my .emacs file as usual:Unfortunately, it doesn't work. It is still evil-state, i.e. vim style bindings, in
inferior-ess-mode
. Isevil
invoked inside ESS? How can I enable Emacs state in ESS?