Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hercules + evil causes breakage #1

Open
holtzermann17 opened this issue Mar 24, 2021 · 1 comment
Open

hercules + evil causes breakage #1

holtzermann17 opened this issue Mar 24, 2021 · 1 comment

Comments

@holtzermann17
Copy link

holtzermann17 commented Mar 24, 2021

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!

@jeff-phil
Copy link

jeff-phil commented Feb 20, 2024

@holtzermann17

This is because the hercules pop-up is still active, and using those keys from the displayed keymap. I have a default hide-funs list that always includes read-from-minibuffer and keyboard-quit. So taking one of your hercules-def statements above, here it is with :hide-funs line:

(hercules-def
 :toggle-funs #'help-evil-normal
 :keymap 'evil-normal-state-map
 :hide-funs '(read-from-minibuffer keyboard-quit)
 :transient nil)

Now, when you interactively call M-x or eval-expression or get prompted to save a file, etc. hercules will hide so you can type freely.

You will need to do that for each of your hercules-def's above.

Alternative, and probably better, there is a very nice PR that automatically shows and hides: #2 hercules when minibuffer is needed, and then restores it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants