From 8e613f365676277413ce734c6952887272cd4ce5 Mon Sep 17 00:00:00 2001 From: Durant Schoon Date: Tue, 17 Dec 2024 18:16:51 -0500 Subject: [PATCH 1/2] Modernize advice definition using advice-add Replace old defadvice form with modern advice-add syntax for er/prepare-for-more-expansions-internal. This maintains the same functionality while using the preferred advice system introduced in Emacs 24.4. --- evil-iedit-state.el | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/evil-iedit-state.el b/evil-iedit-state.el index e340a0a..c8f0bfa 100644 --- a/evil-iedit-state.el +++ b/evil-iedit-state.el @@ -166,15 +166,14 @@ If INTERACTIVE is non-nil then COMMAND is called interactively." ;; force expand-region temporary overlay map exit (setq overriding-terminal-local-map nil)) - (defadvice er/prepare-for-more-expansions-internal - (around iedit/prepare-for-more-expansions-internal activate) - ad-do-it - (let ((default-msg (car ad-return-value)) - (default-bindings (cdr ad-return-value))) - (setq ad-return-value - (cons (concat default-msg ", e to edit") - (add-to-list 'default-bindings - '("e" evil-iedit-state/iedit-mode-from-expand-region)))))))) + (advice-add 'er/prepare-for-more-expansions-internal :around + (lambda (orig-fun &rest args) + (let ((result (apply orig-fun args))) + (let ((default-msg (car result)) + (default-bindings (cdr result))) + (cons (concat default-msg ", e to edit") + (add-to-list 'default-bindings + '("e" evil-iedit-state/iedit-mode-from-expand-region))))))))) ;; redefine iedit-done to prevent iedit from putting the occurrence on the ;; kill-ring for no useful reason. From 57918191492daadfbdc41b3506b8de6d00d5a852 Mon Sep 17 00:00:00 2001 From: Durant Schoon Date: Mon, 13 Jan 2025 17:05:21 -0500 Subject: [PATCH 2/2] use a named advice instead of anonymous lambda as suggested by @fnussbaum --- evil-iedit-state.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/evil-iedit-state.el b/evil-iedit-state.el index c8f0bfa..75c6f5e 100644 --- a/evil-iedit-state.el +++ b/evil-iedit-state.el @@ -166,14 +166,14 @@ If INTERACTIVE is non-nil then COMMAND is called interactively." ;; force expand-region temporary overlay map exit (setq overriding-terminal-local-map nil)) - (advice-add 'er/prepare-for-more-expansions-internal :around - (lambda (orig-fun &rest args) - (let ((result (apply orig-fun args))) - (let ((default-msg (car result)) - (default-bindings (cdr result))) - (cons (concat default-msg ", e to edit") - (add-to-list 'default-bindings - '("e" evil-iedit-state/iedit-mode-from-expand-region))))))))) + (define-advice er/prepare-for-more-expansions-internal + (:around (orig-fun &rest args) evil-iedit-state) + (let* ((result (apply orig-fun args)) + (default-msg (car result)) + (default-bindings (cdr result))) + (cons (concat default-msg ", e to edit") + (add-to-list 'default-bindings + '("e" evil-iedit-state/iedit-mode-from-expand-region))))))) ;; redefine iedit-done to prevent iedit from putting the occurrence on the ;; kill-ring for no useful reason.