Am Tue, 16 Oct 2012 09:19:47 +0100
schrieb Christoph LANGE <[email protected]>:
> Dear evil developers/users,
>
> I would like to generally open all files of a certain type (org-mode)
> in vi state but make exceptions for a few individual files. Using
> file local variables didn't work.
>
> I tried
>
> Local Variables:
> eval: (evil-emacs-state)
> End:
>
> but apparently the order of execution was the following:
>
> 1. load the file
> 2. apply the local variables, switching to Emacs state
> 3. here, or possibly before (2), switch buffer to org-mode
> 4. on seeing that org-mode is not in the list of
> evil-emacs-state-modes, switch to vi state
>
> If this assumption is right, is there any way of opening individual
> files in Emacs state?
I think your assumptions are right and there is currently no way.
But maybe the following patch could help. It defines a new variable
`evil-this-buffer-initial-state' that can be set to some value != nil
to overwrite the initial state in the current buffer. When set in a
file variable it should do what you want.
Best
Frank
diff -r 0fd01316e06e -r b64f9f90ca69 evil-core.el
--- a/evil-core.el Wed Oct 31 15:56:48 2012 +0100
+++ b/evil-core.el Wed Oct 31 17:33:43 2012 +0100
@@ -254,7 +254,8 @@
if no initial state is associated with BUFFER.
See also `evil-initial-state'."
(with-current-buffer (or buffer (current-buffer))
- (or (evil-initial-state-for-buffer-name (buffer-name))
+ (or evil-this-buffer-initial-state
+ (evil-initial-state-for-buffer-name (buffer-name))
(catch 'done
(dolist (mode minor-mode-map-alist)
(setq mode (car-safe mode))
diff -r 0fd01316e06e -r b64f9f90ca69 evil-vars.el
--- a/evil-vars.el Wed Oct 31 15:56:48 2012 +0100
+++ b/evil-vars.el Wed Oct 31 17:33:43 2012 +0100
@@ -898,6 +898,13 @@
(make-variable-buffer-local ',symbol)
(put ',symbol 'permanent-local t)))
+(evil-define-local-var evil-this-buffer-initial-state nil
+ "The initial state of the current buffer.
+If this variable is set to non-nil, it will overwrite all other
+possibilities to determine the initial state for the current
+buffer. Note that it must be set *before* evil is initialized,
+e.g. in a buffer local variable.")
+
(evil-define-local-var evil-state nil
"The current Evil state.
To change the state, use `evil-change-state'
_______________________________________________
implementations-list mailing list
[email protected]
https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list