Under Evil, a digit in the break buffer takes the restart, because the buffer's keys take precedence over Evil's
This commit is contained in:
parent
2250548b07
commit
04f5d5a349
@ -702,6 +702,14 @@ anyone who would rather TAB always moved."
|
||||
map)
|
||||
"Keys in `flan-cnr-mode'.")
|
||||
|
||||
;; Evil's normal state binds 0, the other digits and RET above any major
|
||||
;; mode's map, so under Evil a digit moved point or started a count and took
|
||||
;; nothing. This map takes precedence over Evil's state maps instead; the keys
|
||||
;; it does not bind, j and k among them, are still Evil's.
|
||||
(with-eval-after-load 'evil
|
||||
(when (fboundp 'evil-make-overriding-map)
|
||||
(evil-make-overriding-map flan-cnr-mode-map)))
|
||||
|
||||
(define-derived-mode flan-cnr-mode special-mode "flan-break"
|
||||
"What a stopped Flan program is offering."
|
||||
(setq buffer-read-only t))
|
||||
|
||||
@ -1704,6 +1704,47 @@ stopped program, which is the case where it should fire."
|
||||
(file-name-directory load-file-name))
|
||||
nil t)
|
||||
|
||||
;; The break buffer's keys under Evil, pressed through the command loop rather
|
||||
;; than called. Evil's normal state binds 0 (beginning of line), 1-9 (a count)
|
||||
;; and RET (next line) above any major mode's map, so without the buffer's map
|
||||
;; taking precedence a digit moved point and took nothing. Run only where
|
||||
;; Evil is installed: -Q loads no packages, so it is looked for in the two
|
||||
;; places a package install puts it, and turned off again afterwards so nothing
|
||||
;; above or below this runs under it.
|
||||
(let* ((dirs (append (file-expand-wildcards "~/.config/emacs/elpa/evil-[0-9]*")
|
||||
(file-expand-wildcards "~/.emacs.d/elpa/evil-[0-9]*")
|
||||
(file-expand-wildcards "~/.config/emacs/elpa/goto-chg-*")
|
||||
(file-expand-wildcards "~/.emacs.d/elpa/goto-chg-*")))
|
||||
(load-path (append dirs load-path)))
|
||||
(if (not (require 'evil nil t))
|
||||
(message " skip the break buffer under Evil (Evil is not installed)")
|
||||
(evil-mode 1)
|
||||
(unwind-protect
|
||||
(let* ((sent nil)
|
||||
(flan-cnr-request-function
|
||||
(lambda (form) (setq sent form) (list :status "ok")))
|
||||
(buf (test-flan--cnr
|
||||
(list :condition "Missing" :restarts '("retry" "skip")))))
|
||||
(switch-to-buffer buf)
|
||||
(evil-initialize-state)
|
||||
(goto-char (point-min))
|
||||
(execute-kbd-macro (kbd "0"))
|
||||
(test-flan--check "under Evil, 0 takes restart 0"
|
||||
(equal sent '(:op "restart-at" :index 0 :name "retry")))
|
||||
(setq sent nil)
|
||||
(switch-to-buffer buf)
|
||||
(execute-kbd-macro (kbd "1"))
|
||||
(test-flan--check "under Evil, 1 takes restart 1"
|
||||
(equal sent '(:op "restart-at" :index 1 :name "skip")))
|
||||
(setq sent nil)
|
||||
(switch-to-buffer buf)
|
||||
(goto-char (point-min))
|
||||
(search-forward " 1: ")
|
||||
(execute-kbd-macro (kbd "RET"))
|
||||
(test-flan--check "under Evil, RET takes the restart on its line"
|
||||
(equal sent '(:op "restart-at" :index 1 :name "skip"))))
|
||||
(evil-mode -1))))
|
||||
|
||||
(message "\n%d checks, %d failures" test-flan--ran test-flan--failures)
|
||||
(kill-emacs (if (> test-flan--failures 0) 1 0))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user