hlissner / evil-snipe

2-char searching ala vim-sneak & vim-seek, for evil-mode
MIT License
336 stars 25 forks source link

Overrides keybindings of CIDER #61

Closed NightMachinery closed 3 years ago

NightMachinery commented 6 years ago

See https://github.com/clojure-emacs/cider/issues/2275 They say it's evil-snipe's issue. In short, when CIDER's debugger (it's similar to edebug, but for Clojure) is activated, it should get the 's' key, not evil-snipe.

hlissner commented 6 years ago

I'm not familiar with CIDER's debugger, but you can prevent evil-snipe from being enabled in certain major modes by adding it to evil-snipe-disabled-modes, or by adding turn-off-evil-snipe-mode to the appropriate hook. e.g.

;; NOTE: I'm guessing the major mode and hook names
(push 'cider-debug-mode evil-snipe-disabled-modes)
;; or
(add-hook 'cider-debug-mode-hook #'turn-off-evil-snipe-mode)

If you tell me what the appropriate major-mode is, I'll be happy to add it to evil-snipe-disabled-modes's default.

NightMachinery commented 6 years ago

@hlissner Here is the fix (there is no major mode for the debugger):

(add-hook 'cider--debug-mode-hook (lambda ()
                                      (if (bound-and-true-p cider--debug-mode)
                                          (turn-off-evil-snipe-mode)
                                        (turn-on-evil-snipe-mode))))

Can you add it to evil-snipe? Or is the 'cider--debug-mode-hook problematic when CIDER is not loaded?

hlissner commented 6 years ago

It isn't problematic, but I am hesitant to use this solution, because this is really an issue with evil not prioritizing minor mode maps correctly (a known issue). Could you try this:

(add-hook 'cider-mode-hook #'evil-normalize-keymaps)
(add-hook 'cider--debug-mode-hook #'evil-normalize-keymaps)

And let me know if that changes your situation?

NightMachinery commented 6 years ago

@hlissner No, it didn't work. If you think the issue is with evil, can you file a bug report? I didn't have a good experience with evil maintainers.

hlissner commented 6 years ago

A bug report already exists (juggling keymaps is a general -- and difficult -- problem), but I'm not entirely confident that it is entirely to blame either. It could also be the load-order in Spacemacs, loading cider before evil-snipe, for whatever reason.

That said, this isn't the first time evil-snipe has encroached into other plugins (like magit, mu4e, and org-agenda) and I'm looking for a reasonable way around it.

On another note: in a buffer with cider--debug-mode active, could you report to me the value of minor-mode-alist?

NightMachinery commented 6 years ago
((follow-mode follow-mode-line-text)
 (gnus-dead-summary-mode " Dead")
 (doc-view-minor-mode " DocView")
 (mmm-mode " MMM")
 (emoji-cheat-sheet-plus-display-mode " emoji")
 (git-gutter+-mode #1="")
 (company-search-mode company-search-lighter)
 (company-mode " ⓐ")
 (typed-clojure-mode " Typed")
 (goto-address-prog-mode #1#)
 (goto-address-mode #1#)
 (bug-reference-prog-mode #1#)
 (bug-reference-mode #1#)
 (auto-highlight-symbol-mode #1#)
 (highlight-numbers-mode #1#)
 (highlight-parentheses-mode #1#)
 (hs-minor-mode #1#)
 (rainbow-delimiters-mode #1#)
 (projectile-mode #1#)
 (clj-refactor-mode " cljr")
 (superword-mode " ²")
 (subword-mode " ⓒ")
 (sgml-electric-tag-pair-mode "/e")
 (paredit-mode paredit-lighter)
 (yas-minor-mode " ⓨ")
 (cider--debug-mode " DEBUG")
 (cider-mode cider-mode-line)
 (archive-subfile-mode " Archive")
 (cider-auto-test-mode
  (cider-mode " Test"))
 (orgtbl-mode #1#)
 (org-table-follow-field-mode " TblFollow")
 (magit-blame-mode magit-blame-mode-lighter)
 (magit-file-mode magit-file-mode-lighter)
 (magit-wip-before-change-mode magit-wip-before-change-mode-lighter)
 (magit-wip-after-apply-mode magit-wip-after-apply-mode-lighter)
 (magit-wip-after-save-local-mode magit-wip-after-save-local-mode-lighter)
 (smerge-mode #1#)
 (git-commit-mode #1#)
 (mml-mode " MML")
 (with-editor-mode with-editor-mode-lighter)
 (org-cdlatex-mode " OCDL")
 (orgstruct-mode " OrgStruct")
 (org-src-mode " OrgSrc")
 (cider-popup-buffer-mode
  (" cider-tmp"))
 (cider-enlighten-mode
  (cider-mode " light"))
 (view-mode " View")
 (lispyville-mode " LYVLE")
 (lispy-other-mode " [other]")
 (lispy-goto-mode " [goto]")
 (lispy-mode " LY")
 (ivy-mode #1#)
 (multiple-cursors-mode mc/mode-line)
 (semantic-minor-modes-format semantic-minor-modes-format)
 (semantic-highlight-edits-mode "/e")
 (semantic-show-unmatched-syntax-mode "/u")
 (edebug-mode " *Debugging*")
 (zoom-mode " Z")
 (atomic-chrome-edit-mode " AtomicChrome")
 (linum-relative-mode linum-relative-lighter)
 (hl-todo-mode #1#)
 (ws-butler-mode #1#)
 (purpose-mode #1#)
 (volatile-highlights-mode #1#)
 (vi-tilde-fringe-mode #1#)
 (persp-mode #1#)
 (markdown-live-preview-mode " MD-Preview")
 (lsp-mode #1#)
 (compilation-minor-mode " Compilation")
 (compilation-shell-minor-mode " Shell-Compile")
 (compilation-in-progress " Compiling")
 (xref-etags-mode #1#)
 (linum-mode #1#)
 (importmagic-mode " import")
 (image-minor-mode
  (:eval
    (if image-type
        (format " Image[%s]" image-type)
      " Image")))
 (helm-mode #1#)
 (helm-migemo-mode " Hmio")
 (flycheck-mode " ⓢ")
 (flx-ido-mode #1#)
 (fci-mode #1#)
 (evil-snipe-local-mode #1#)
 (smartparens-mode " ⓟ")
 (evil-escape-mode #1#)
 (anzu-mode #1#)
 (editorconfig-mode #1#)
 (edit-server-edit-mode " EditSrv")
 (outline-minor-mode " Outl")
 (diff-hl-dir-mode #1#)
 (diff-hl-mode diff-hl-lighter)
 (vc-parent-buffer vc-parent-buffer-name)
 (diff-minor-mode " Diff")
 (anaconda-eldoc-mode #1#)
 (anaconda-mode #1#)
 (adaptive-wrap-prefix-mode #1#)
 (hybrid-mode " hybrid")
 (which-key-mode " Ⓚ")
 (override-global-mode #1#)
 (undo-tree-visualizer-selection-mode "Select")
 (undo-tree-mode #1#)
 (reveal-mode
  (global-reveal-mode nil " Reveal"))
 (flyspell-mode " Ⓢ")
 (ispell-minor-mode " Spell")
 (package-build-minor-mode " PBuild")
 (global-auto-revert-mode global-auto-revert-mode-text)
 (auto-revert-tail-mode auto-revert-tail-mode-text)
 (auto-revert-mode auto-revert-mode-text)
 (page-break-lines-mode #1#)
 (eldoc-mode #1#)
 (visible-mode " Vis")
 (visual-line-mode " Ⓛ")
 (next-error-follow-minor-mode " Fol")
 (abbrev-mode #1#)
 (overwrite-mode overwrite-mode)
 (auto-fill-function " Fill")
 (defining-kbd-macro " Def")
 (isearch-mode isearch-mode)
 (iedit-mode
  (" Iedit:"
   (:eval
     (format
      #("%d/%d" 0 5
        (face font-lock-warning-face))
      iedit-occurrence-index
      (iedit-counter)))))
 (ace-window-mode ace-window-mode))

Note that my own workaround is running.

On Fri, May 4, 2018 at 3:21 PM, Henrik Lissner notifications@github.com wrote:

A bug report already exists (juggling keymaps is a general -- and difficult -- problem), but I'm not entirely confident that is to blame either. That said, this isn't the first time evil-snipe has encroached into other plugins (like magit, mu4e, and org-agenda), and I'm looking for a reasonable way around it.

On another note: in a buffer with cider--debug-mode active, could you report to me the value of minor-mode-alist?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hlissner/evil-snipe/issues/61#issuecomment-386566230, or mute the thread https://github.com/notifications/unsubscribe-auth/Aii--gTgwE4m7gyhIUeFGIItIM_LTJybks5tvDKvgaJpZM4TgMuh .

hlissner commented 6 years ago

Could you show me minor-mode-alist with your workaround disabled? I need to see if evil-snipe has higher precedence than cider--debug-mode.

hlissner commented 3 years ago

Sorry for the tremendously late response. Looking back, I realize this is an issue inherent to how evil (and minor-mode) keymap precedence works. That is, evil-snipe-mode and cider--debug-mode are both minor modes, but evil-snipe is using evil's keybinding system to bind keys only in normal/visual states, which evil will prioritize over cider's non-evil keymaps.

With that said, this conflict is neither evil-snipe's nor cider's responsibility to resolve. At best, it may be evil's, but this is more a case of "this is how evil works", rather than a bug.

Besides the solution you came up with, the only other possible solution that comes to mind is:

(evil-define-minor-mode-key 'normal 'cider--debug-mode
  "s" #'cider-debug-mode-send-reply)

As there is no decent solution to this issue I will close this.