summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerry Agbobada <gerry@gagbo.net>2023-09-17 12:13:15 +0200
committerYoumu <condy0919@gmail.com>2023-09-22 22:11:49 +0800
commitac2862cfb03fcaffe46994bc1e4df6d1f3eac0d1 (patch)
tree14520f26060464162f3091635aff2e6c60870d32
parent0f558f36c1e91835e3daa32254ae081d8c9f0e98 (diff)
Revert de0b62b604e87ce43e2adc9e09bcd5174e8b877a
On top of reverting the change, it relies on an intern backport of the old evil-delay macro to avoid issues with CI.
-rw-r--r--evil-collection.el58
1 files changed, 40 insertions, 18 deletions
diff --git a/evil-collection.el b/evil-collection.el
index 7d87299..864be4a 100644
--- a/evil-collection.el
+++ b/evil-collection.el
@@ -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
@@ -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
@@ -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)