meow-edit / meow

Yet another modal editing on Emacs / 猫态编辑
GNU General Public License v3.0
1.07k stars 128 forks source link

compatibility issue with realgud in normal state #511

Open dekoponTree opened 7 months ago

dekoponTree commented 7 months ago

I'm using realgud to debug a python program.

In source window, when I press n, the defined behavior should be move to next line as in realgud.

Whereas if meow is enabled, the behavior is broken in normal state, behaved as search next. So far, the phenomenon is similar to the discussion

After entering the insert state, realgud behaves as predefined. But in insert state, I can't use the space key.

dekoponTree commented 7 months ago
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; realgud

(defvar meow--realgud-setup nil)

(defun meow--realgud-hook-function ()
  "Switch meow state when entering/leaving realgud."
  (if (bound-and-true-p realgud-short-key-mode)
      (meow--switch-to-motion)
    (meow--switch-to-normal)))

(defun meow--setup-realgud (enable)
  "Setup realgud.
Argument ENABLE non-nil means turn on."
  (setq meow--realgud-setup enable)
  (if enable
      (add-hook 'realgud-short-key-mode-hook 'meow--realgud-hook-function)
    (remove-hook 'realgud-short-key-mode-hook 'meow--realgud-hook-function)))

(eval-after-load "realgud" (lambda () (meow--setup-realgud t)))

Above codes have no effects. I have checked that realgud-short-key-mode and realgud-short-key-mode-hook are both existent.

dekoponTree commented 7 months ago

I have the following configuration

(eval-and-compile
  (setq use-package-always-ensure t)
  (setq use-package-always-defer t))

And I have installed realgud like this.

(use-package realgud)

After changing the installation commands into

(use-package realgud
  :demand t)

The above setup take into effects.

dekoponTree commented 7 months ago

I have just submitted a PR, and hope it will be merged. Thanks.

dekoponTree commented 7 months ago

After leaving realgud, meow is still in motion mode, instead of normal mode.

How to fix the patch so that meow switches to normal mode after leaving realgud?

Thanks!

DogLooksGood commented 7 months ago

I think you have to find a hook or a function which is called when leaving realgud.