branch: externals/substitute
commit 8ac39041584b01524408fc5ed9fa71dfb0c01b8d
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Simplify substitute--setup-scope
---
 substitute.el | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/substitute.el b/substitute.el
index 841a3d4b77..51014e1d64 100644
--- a/substitute.el
+++ b/substitute.el
@@ -153,13 +153,12 @@ Pass to it the TARGET and SCOPE arguments."
 
 (defun substitute--setup-scope (target scope)
   "Derive SCOPE for TARGET."
-  (let (scope-fn)
-    (pcase scope
-      ('below (setq scope-fn (substitute--scope-current-and-below target)))
-      ('above (setq scope-fn (substitute--scope-current-and-above target)))
-      ('defun (setq scope-fn (substitute--scope-current-defun)))
-      (_ (setq scope-fn (substitute--scope-top-of-buffer))))
-    (funcall scope-fn)))
+  (funcall
+   (pcase scope
+     ('below (substitute--scope-current-and-below target))
+     ('above (substitute--scope-current-and-above target))
+     ('defun (substitute--scope-current-defun))
+     (_ (substitute--scope-top-of-buffer)))))
 
 (defun substitute--operate (target sub &optional scope)
   "Substitute TARGET with SUB in SCOPE.

Reply via email to