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

Fix: Revert de0b62b604e87ce43e2adc9e09bcd5174e8b877a (evil-with-delay change) #755

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 40 additions & 18 deletions evil-collection.el
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,16 @@ modes in the current buffer."
nil "^[^.]")))))
(find-file (evil-collection--mode-file mode "README.org")))

(defun evil-collection--delay (condition form hook &optional append local name)
"Execute FORM when CONDITION becomes true, checking with HOOK.
NAME specifies the name of the entry added to HOOK. If APPEND is
non-nil, the entry is appended to the hook. If LOCAL is non-nil,
the buffer-local value of HOOK is modified.

This is a backport of `evil-delay' without the deprecation notice to deal with CI until migration can be done.
Ref: https://github.com/emacs-evil/evil-collection/issues/750"
(eval `(evil-with-delay ,condition (,hook ,append ,local ,name) ,form) t))

;;;###autoload
(cl-defun evil-collection-translate-minor-mode-key (states modes
&rest translations
Expand Down Expand Up @@ -707,16 +717,22 @@ invocation."
(dolist (mode-symbol modes)
(let ((keymap-symbol (intern (format "%S-map" mode-symbol))))
(dolist (state states)
(evil-with-delay `(and (boundp ',keymap-symbol)
(keymapp ,keymap-symbol))
`(after-load-functions
(let ((hook-name
(symbol-name
(cl-gensym
(format "evil-collection-translate-key-in-%s" keymap-symbol)))))
(evil-collection--delay `(and (boundp ',keymap-symbol)
(keymapp ,keymap-symbol))
`(evil-collection--translate-minor-mode-key
',state
',mode-symbol
',translations
,destructive)
'after-load-functions
t
nil
(symbol-name
(cl-gensym
(format "evil-collection-translate-key-in-%s" ,keymap-symbol))))
(evil-collection--translate-minor-mode-key state mode-symbol
translations destructive))))))
hook-name))))))


(defun evil-collection--translate-minor-mode-key (state
mode-symbol
Expand Down Expand Up @@ -812,16 +828,22 @@ invocation."
(setq states (list states)))
(dolist (keymap-symbol keymaps)
(dolist (state states)
(evil-with-delay `(and (boundp ',keymap-symbol)
(keymapp ,keymap-symbol))
`(after-load-functions
t
nil
(symbol-name
(cl-gensym
(format "evil-collection-translate-key-in-%s" ,keymap-symbol))))
(evil-collection--translate-key state keymap-symbol
translations destructive)))))
(let ((hook-name
(symbol-name
(cl-gensym
(format "evil-collection-translate-key-in-%s" keymap-symbol)))))
(evil-collection--delay `(and (boundp ',keymap-symbol)
(keymapp ,keymap-symbol))
`(evil-collection--translate-key
',state
',keymap-symbol
',translations
,destructive)
'after-load-functions
t
nil
hook-name)))))


;;;###autoload
(defmacro evil-collection-swap-key (states keymaps &rest args)
Expand Down
Loading