unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Deny keymap changes made by `evil-integration'
@ 2015-07-25 11:43 Alexander Shukaev
  2015-07-25 11:47 ` Eli Zaretskii
  2015-07-27 20:46 ` Robert Thorpe
  0 siblings, 2 replies; 12+ messages in thread
From: Alexander Shukaev @ 2015-07-25 11:43 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

`evil-integration' has quite some forms like

(eval-after-load 'dired
  '(progn
     ;; use the standard Dired bindings as a base
     (defvar dired-mode-map)
     (evil-make-overriding-map dired-mode-map 'normal)
     (evil-add-hjkl-bindings dired-mode-map 'normal
       "J" 'dired-goto-file                   ; "j"
       "K" 'dired-do-kill-lines               ; "k"
       "r" 'dired-do-redisplay                ; "l"
       ;; ":d", ":v", ":s", ":e"
       ";" (lookup-key dired-mode-map ":"))))

for various packages.  I would like to learn how to either revert
these changes back to the default state (i.e. `dired-mode-map' should
be crystal clean as it was before loading `evil') or, even better,
prevent `evil-integration' from doing such changes.  For instance,
I've tried

(let ((dired-mode-map))
  (require 'evil)
  ...
)

and it didn't work.  Any ideas?

Thanks,
Alexander



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-25 11:43 Deny keymap changes made by `evil-integration' Alexander Shukaev
@ 2015-07-25 11:47 ` Eli Zaretskii
  2015-07-25 11:58   ` Alexander Shukaev
  2015-07-27 20:46 ` Robert Thorpe
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2015-07-25 11:47 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 25 Jul 2015 13:43:09 +0200
> From: Alexander Shukaev <haroogan@gmail.com>
> 
> `evil-integration' has quite some forms like
> 
> (eval-after-load 'dired
>   '(progn
>      ;; use the standard Dired bindings as a base
>      (defvar dired-mode-map)
>      (evil-make-overriding-map dired-mode-map 'normal)
>      (evil-add-hjkl-bindings dired-mode-map 'normal
>        "J" 'dired-goto-file                   ; "j"
>        "K" 'dired-do-kill-lines               ; "k"
>        "r" 'dired-do-redisplay                ; "l"
>        ;; ":d", ":v", ":s", ":e"
>        ";" (lookup-key dired-mode-map ":"))))
> 
> for various packages.  I would like to learn how to either revert
> these changes back to the default state (i.e. `dired-mode-map' should
> be crystal clean as it was before loading `evil') or, even better,
> prevent `evil-integration' from doing such changes.  For instance,
> I've tried
> 
> (let ((dired-mode-map))
>   (require 'evil)
>   ...
> )
> 
> and it didn't work.  Any ideas?

Would reloading Dired be OK?



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-25 11:47 ` Eli Zaretskii
@ 2015-07-25 11:58   ` Alexander Shukaev
  2015-07-25 12:33     ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Alexander Shukaev @ 2015-07-25 11:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

>> `evil-integration' has quite some forms like
>>
>> (eval-after-load 'dired
>>   '(progn
>>      ;; use the standard Dired bindings as a base
>>      (defvar dired-mode-map)
>>      (evil-make-overriding-map dired-mode-map 'normal)
>>      (evil-add-hjkl-bindings dired-mode-map 'normal
>>        "J" 'dired-goto-file                   ; "j"
>>        "K" 'dired-do-kill-lines               ; "k"
>>        "r" 'dired-do-redisplay                ; "l"
>>        ;; ":d", ":v", ":s", ":e"
>>        ";" (lookup-key dired-mode-map ":"))))
>>
>> for various packages.  I would like to learn how to either revert
>> these changes back to the default state (i.e. `dired-mode-map' should
>> be crystal clean as it was before loading `evil') or, even better,
>> prevent `evil-integration' from doing such changes.  For instance,
>> I've tried
>>
>> (let ((dired-mode-map))
>>   (require 'evil)
>>   ...
>> )
>>
>> and it didn't work.  Any ideas?
>
> Would reloading Dired be OK?
>

That's an idea, Eli, but does that mean that I have to spam something like

(with-eval-after-load 'evil
  (with-evail-after-load 'dired
    (unload-feature 'dired)
    (require 'dired))

  (with-evail-after-load 'whatever
    (unload-feature 'whatever)
    (require 'whatever))

  ...)

for every package that is modified by `evil-integration'?



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-25 11:58   ` Alexander Shukaev
@ 2015-07-25 12:33     ` Eli Zaretskii
  2015-07-25 12:52       ` Alexander Shukaev
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2015-07-25 12:33 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 25 Jul 2015 13:58:45 +0200
> From: Alexander Shukaev <haroogan@gmail.com>
> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
> 
> > Would reloading Dired be OK?
> >
> 
> That's an idea, Eli, but does that mean that I have to spam something like
> 
> (with-eval-after-load 'evil
>   (with-evail-after-load 'dired
>     (unload-feature 'dired)
>     (require 'dired))
> 
>   (with-evail-after-load 'whatever
>     (unload-feature 'whatever)
>     (require 'whatever))
> 
>   ...)

You can just

  (load "whatever")

instead of the unload-require dance.

> for every package that is modified by `evil-integration'?

If there are many of them, that raises a question: what is it that you
want from 'evil-integration' that justifies using it?  (I don't use
Evil.)  Are there any options in that package that would allow you to
have what you want, but without the parts you don't want?



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-25 12:33     ` Eli Zaretskii
@ 2015-07-25 12:52       ` Alexander Shukaev
  2015-07-25 13:20         ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Alexander Shukaev @ 2015-07-25 12:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

>> for every package that is modified by `evil-integration'?
>
> If there are many of them, that raises a question: what is it that you
> want from 'evil-integration' that justifies using it?  (I don't use
> Evil.)  Are there any options in that package that would allow you to
> have what you want, but without the parts you don't want?
>

They implemented `evil' too intrusively, i.e. `(require 'evil)' would
also `(require 'evil-integration)' and some other trash that I don't
want personally.  Also, note that though `evil-integration' has lots
of intrusive trash, it also contains some valuable integrations which
are absolutely essential and simply rewriting those excerpts manually
could be a possibility but then I would have to maintain those myself.

>> > Would reloading Dired be OK?
>> >
>>
>> That's an idea, Eli, but does that mean that I have to spam something like
>>
>> (with-eval-after-load 'evil
>>   (with-evail-after-load 'dired
>>     (unload-feature 'dired)
>>     (require 'dired))
>>
>>   (with-evail-after-load 'whatever
>>     (unload-feature 'whatever)
>>     (require 'whatever))
>>
>>   ...)
>
> You can just
>
>   (load "whatever")
>
> instead of the unload-require dance.
>

Do you propose

(with-eval-after-load 'evil
   (with-evail-after-load 'dired
     (load "dired"))

   (with-evail-after-load 'whatever
     (load "whatever"))

   ...)

?  Still I have 2 problems with this.  First of all, shouldn't there
be an infinite recursion here (with-eval-after-load/load combo)?
Secondly, `evil-integration' wraps it's configurations for `dired'
also with `eval-after-load'; doesn't this mean that reloading `dired'
will not change anything because the wrapped snippet (from
`evil-integration') will execute again?

Regards,
Alexander



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-25 12:52       ` Alexander Shukaev
@ 2015-07-25 13:20         ` Eli Zaretskii
  2015-07-25 13:23           ` Alexander Shukaev
  2015-07-26 12:24           ` Martin Yrjölä
  0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2015-07-25 13:20 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 25 Jul 2015 14:52:43 +0200
> From: Alexander Shukaev <haroogan@gmail.com>
> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
> 
> They implemented `evil' too intrusively, i.e. `(require 'evil)' would
> also `(require 'evil-integration)' and some other trash that I don't
> want personally.

I'd suggest a careful reading of the code, looking for ways of
disabling the too-intrusive stuff.

> Do you propose
> 
> (with-eval-after-load 'evil
>    (with-evail-after-load 'dired
>      (load "dired"))
> 
>    (with-evail-after-load 'whatever
>      (load "whatever"))
> 
>    ...)
> 
> ?

Something like that, yes.

> Still I have 2 problems with this.  First of all, shouldn't there
> be an infinite recursion here (with-eval-after-load/load combo)?
> Secondly, `evil-integration' wraps it's configurations for `dired'
> also with `eval-after-load'; doesn't this mean that reloading `dired'
> will not change anything because the wrapped snippet (from
> `evil-integration') will execute again?

Nothing that (let (after-load-alist) (load "...")) couldn't solve.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-25 13:20         ` Eli Zaretskii
@ 2015-07-25 13:23           ` Alexander Shukaev
  2015-07-27 21:09             ` John Mastro
  2015-07-26 12:24           ` Martin Yrjölä
  1 sibling, 1 reply; 12+ messages in thread
From: Alexander Shukaev @ 2015-07-25 13:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

>> Still I have 2 problems with this.  First of all, shouldn't there
>> be an infinite recursion here (with-eval-after-load/load combo)?
>> Secondly, `evil-integration' wraps it's configurations for `dired'
>> also with `eval-after-load'; doesn't this mean that reloading `dired'
>> will not change anything because the wrapped snippet (from
>> `evil-integration') will execute again?
>
> Nothing that (let (after-load-alist) (load "...")) couldn't solve.
>

Nice trick!  Thanks, Eli.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-25 13:20         ` Eli Zaretskii
  2015-07-25 13:23           ` Alexander Shukaev
@ 2015-07-26 12:24           ` Martin Yrjölä
  2015-07-26 18:56             ` Alexander Shukaev
  1 sibling, 1 reply; 12+ messages in thread
From: Martin Yrjölä @ 2015-07-26 12:24 UTC (permalink / raw)
  To: help-gnu-emacs


Eli Zaretskii writes:
>> Date: Sat, 25 Jul 2015 14:52:43 +0200
>> From: Alexander Shukaev <haroogan@gmail.com>
>> Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
>> 
>> They implemented `evil' too intrusively, i.e. `(require 'evil)' would
>> also `(require 'evil-integration)' and some other trash that I don't
>> want personally.
>
> I'd suggest a careful reading of the code, looking for ways of
> disabling the too-intrusive stuff.
>

Have you tried `M-x evil-emacs-state'? It should revert back to the
standard Emacs keybindings. To make this the default behavior for
dired buffers you can change the `evil-emacs-state-modes'-variable:

(add-to-list 'evil-emacs-state-modes 'dired-mode)

Best regards,
Martin Yrjölä



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-26 12:24           ` Martin Yrjölä
@ 2015-07-26 18:56             ` Alexander Shukaev
  0 siblings, 0 replies; 12+ messages in thread
From: Alexander Shukaev @ 2015-07-26 18:56 UTC (permalink / raw)
  To: Martin Yrjölä; +Cc: help-gnu-emacs

> Have you tried `M-x evil-emacs-state'? It should revert back to the
> standard Emacs keybindings. To make this the default behavior for
> dired buffers you can change the `evil-emacs-state-modes'-variable:
>
> (add-to-list 'evil-emacs-state-modes 'dired-mode)
>
> Best regards,
> Martin Yrjölä
>

I'm well aware of all those Evil details.  This, however, has nothing
to do with the final goal.  The goal is to remove evil-specific
bindings from `dired-mode-map' (and others) completely rather than
just switch the state.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-25 11:43 Deny keymap changes made by `evil-integration' Alexander Shukaev
  2015-07-25 11:47 ` Eli Zaretskii
@ 2015-07-27 20:46 ` Robert Thorpe
  1 sibling, 0 replies; 12+ messages in thread
From: Robert Thorpe @ 2015-07-27 20:46 UTC (permalink / raw)
  To: Alexander Shukaev; +Cc: help-gnu-emacs

Alexander Shukaev <haroogan@gmail.com> writes:

> Hello,
>
> `evil-integration' has quite some forms like
...
> and it didn't work.  Any ideas?

You could try looking on the Emacs Reddit, or asking there.  A lot of
people there use Evil.

BR,
Robert Thorpe



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-25 13:23           ` Alexander Shukaev
@ 2015-07-27 21:09             ` John Mastro
  2015-07-28 13:28               ` Alexander Shukaev
  0 siblings, 1 reply; 12+ messages in thread
From: John Mastro @ 2015-07-27 21:09 UTC (permalink / raw)
  To: help-gnu-emacs

>>> Still I have 2 problems with this.  First of all, shouldn't there
>>> be an infinite recursion here (with-eval-after-load/load combo)?
>>> Secondly, `evil-integration' wraps it's configurations for `dired'
>>> also with `eval-after-load'; doesn't this mean that reloading `dired'
>>> will not change anything because the wrapped snippet (from
>>> `evil-integration') will execute again?
>>
>> Nothing that (let (after-load-alist) (load "...")) couldn't solve.
>>
>
> Nice trick!  Thanks, Eli.

You can use Eli's suggestions to put together something like the below
that's fairly clean/simple and avoids all the repetition of spelling it
out for each mode.

You may have already done this but throwing it out there just in case.

    (defun defeat-evil (modes)
      (eval-after-load 'evil
        `(progn
           ,@(mapcar (lambda (mode)
                       `(eval-after-load ',mode
                          (let (after-load-alist)
                            (load ,(symbol-name mode)))))
                     modes))))

    (defeat-evil '(dired whatever))

-- 
john



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Deny keymap changes made by `evil-integration'
  2015-07-27 21:09             ` John Mastro
@ 2015-07-28 13:28               ` Alexander Shukaev
  0 siblings, 0 replies; 12+ messages in thread
From: Alexander Shukaev @ 2015-07-28 13:28 UTC (permalink / raw)
  To: John Mastro; +Cc: help-gnu-emacs

> You can use Eli's suggestions to put together something like the below
> that's fairly clean/simple and avoids all the repetition of spelling it
> out for each mode.
>
> You may have already done this but throwing it out there just in case.
>
>     (defun defeat-evil (modes)
>       (eval-after-load 'evil
>         `(progn
>            ,@(mapcar (lambda (mode)
>                        `(eval-after-load ',mode
>                           (let (after-load-alist)
>                             (load ,(symbol-name mode)))))
>                      modes))))
>
>     (defeat-evil '(dired whatever))
>
> --
> john
>

Thanks, John, handy macro indeed.  One question though, why did you
decide to make it a macro rather than function?  Any advantages in
this case?



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-07-28 13:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-25 11:43 Deny keymap changes made by `evil-integration' Alexander Shukaev
2015-07-25 11:47 ` Eli Zaretskii
2015-07-25 11:58   ` Alexander Shukaev
2015-07-25 12:33     ` Eli Zaretskii
2015-07-25 12:52       ` Alexander Shukaev
2015-07-25 13:20         ` Eli Zaretskii
2015-07-25 13:23           ` Alexander Shukaev
2015-07-27 21:09             ` John Mastro
2015-07-28 13:28               ` Alexander Shukaev
2015-07-26 12:24           ` Martin Yrjölä
2015-07-26 18:56             ` Alexander Shukaev
2015-07-27 20:46 ` Robert Thorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).