branch: master
commit e9b1e69f1df22b39105ae15c1c7b9d5e54f366ca
Author: mookid <nathan.mor...@m4x.org>
Commit: mookid <nathan.mor...@m4x.org>

    Refactor.
---
 loccur.el |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/loccur.el b/loccur.el
index c48ce3e..2b4c543 100644
--- a/loccur.el
+++ b/loccur.el
@@ -174,11 +174,12 @@ When called interactively, either prompts the user for 
REGEXP or,
 when called with an active region, uses the content of the
 region."
   (interactive
-   (if (region-active-p)
-       (list (buffer-substring (mark) (point)))
-     (if loccur-mode
-         (list nil)
-       (list (read-string "Loccur: " (loccur-prompt) 'loccur-history)))))
+   (cond ((region-active-p)
+          (list (buffer-substring (mark) (point))))
+         (loccur-mode
+          (list nil))
+         (t
+          (list (read-string "Loccur: " (loccur-prompt) 'loccur-history)))))
   (when (region-active-p) (deactivate-mark))
   (if (or loccur-mode
           (= (length regex) 0))

Reply via email to