hercules icon indicating copy to clipboard operation
hercules copied to clipboard

hercules + evil causes breakage

Open holtzermann17 opened this issue 3 years ago • 1 comments

Hi, I love the idea of using Hercules together with Evil to learn my way around the new set of bindings. And it almost works!

Here's a screenshot set up to show the motion keys, just via:

(defun help-evil-motion ()
  (interactive))
(global-set-key (kbd "<f2> m") 'help-evil-motion)

Screenshot from 2021-03-24 14-23-54

However! I run into trouble actually using Hercules and Evil together, since with Hercules installed, something goes wrong with my data entry into the M-x. Let me illustrate:

Screenshot from 2021-03-24 15-07-59

I've reduced my configuration down to something minimal for reproduction purposes:

;;; Hello Emacs
(message "Start load")

(setq debug-on-error t)
(setq eval-expression-print-level 100
      eval-expression-print-length 100)

(when (>= emacs-major-version 24)
  (require 'package)
  (add-to-list 'package-archives '("melpa" .  "https://raw.githubusercontent.com/d12frosted/elpa-mirror/master/melpa/") t)
  (package-initialize)
  )
;;; Evil
(require 'evil)
;;; Hercules
(require 'hercules)

(defun help-evil-normal ()
  (interactive))
(global-set-key (kbd "<f2> n") 'help-evil-normal)

(hercules-def
 :toggle-funs #'help-evil-normal
 :keymap 'evil-normal-state-map
 :transient nil)

(defun help-evil-motion ()
  (interactive))
(global-set-key (kbd "<f2> m") 'help-evil-motion)

(hercules-def
 :toggle-funs #'help-evil-motion
 :keymap 'evil-motion-state-map
 :transient nil)

(defun help-evil-insert ()
  (interactive))
(global-set-key (kbd "<f2> i") 'help-evil-insert)

(hercules-def
 :toggle-funs #'help-evil-insert
 :keymap 'evil-insert-state-map
 :transient nil)
;;;End load
(message "End load")

Instructions for reproduction:

Save the above as ~/hercules-evil.el, then load with emacs -Q -nw -l ~/hercules-evil.el, then run:

  • M-x evil-mode
  • f2 n
  • M-x switch-to-buffer (you won't be able to type all of the characters here)
  • f2 n
  • Now M-x switch-to-buffer works

— I believe this demonstrates the expected behaviour.

HOWEVER, now run Emacs like this: emacs -Q -l ~/hercules-evil.el and I think you will observe that on the GUI version of Emacs, you cannot go through the full process just described.

Instead, Evil mode takes over the minibuffer (for example) making it difficult to even quit Emacs properly!

holtzermann17 avatar Mar 24 '21 18:03 holtzermann17