syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.7k stars 4.9k forks source link

IELM buffers override minor mode keys and duplicate menus #9391

Closed dsedivec closed 4 years ago

dsedivec commented 7 years ago

Description :octocat:

IELM buffers get all their menus doubled, and keys in ielm-map cannot be overridden by minor modes such as paredit.

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart:

Expected behaviour: :heart: :smile:

Something is putting ielm-map into evil-mode-map-alist like (cons t ielm-map) in IELM buffers. evil-mode-map-alist, in turn, is always in emulation-mode-map-alists in Spacemacs (AFAIK), which means ielm-map bindings always override minor mode maps in IELM buffers.

I have not observed this change in evil-mode-map-alist in other modes so far. When editing an Emacs Lisp file, or even in the spacemacs/report-issue-mode buffer where I am typing this bug report, evil-mode-map-alist is simply (and remember that I'm in holy mode):

((evil-emacs-state-local-minor-mode keymap)
 (evil-emacs-state-minor-mode keymap
                              (26 . evil-exit-emacs-state)))

I cannot figure out what is putting ielm-map in evil-mode-map-alist.

System Info :computer:

bmag commented 7 years ago

Seeing the same in other comint-derived modes: inferior-python-mode and shell-mode. (on develop branch, hybrid editing style)

bmag commented 7 years ago

This is an old upstream bug in Evil: https://github.com/emacs-evil/evil/issues/344

montag451 commented 7 years ago

I use this piece of code to fix the problem, it's not ideal but at least it lets me use paredit in IELM buffer:

(defun my/fix-evil-hiding-minor-mode-map (&rest _args)
  "See `https://github.com/syl20bnr/spacemacs/issues/9391'"
  (let ((mjm-keymap (intern-soft (format "%s-map" major-mode))))
    (when mjm-keymap
      (setq evil-mode-map-alist
        (cl-loop for (c . k) in evil-mode-map-alist
             unless (and (eq c t) (eq k (symbol-value mjm-keymap)))
             collect (cons c k))))))
(advice-add 'evil-normalize-keymaps :after #'my/fix-evil-hiding-minor-mode-map)

Hope it helps!

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!