branch: elpa/isl
commit 1d0842b87d902b8acaaeebbc00fa60c37dbab0dd
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    DRY and no need to send error now
    
    just return empty string instead.
---
 isl.el | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/isl.el b/isl.el
index 75f3223026..4cdcc2b624 100644
--- a/isl.el
+++ b/isl.el
@@ -1236,9 +1236,9 @@ Arguments INITIAL-INPUT and DEFAULT are same as in 
`read-from-minibuffer'."
                    (region-beginning)
                    (region-end))))
       (if (or (> (length region) isl-max-region-length)
+              ;; Prevent inserting multiline string in minibuf.
               (string-match-p "\n" region))
-          (user-error "Isl: Region not suitable for using as default")
-        region))))
+        "" region))))
 
 (defun isl-search-1 (&optional resume input)
   "Start an isl session in `current-buffer'.
@@ -1272,12 +1272,7 @@ Note that INPUT cannot be used with a non nil value for 
RESUME."
          (default (isl--default))
          blink-matching-paren)
     (when (stringp default)
-      (setq default (funcall format-fn
-                             ;; Prevent inserting multiline string in
-                             ;; minibuf.
-                             (if (string-match "\n" default)
-                                 (or (isl--thing-at-point) "")
-                               default))))
+      (setq default (funcall format-fn (or default ""))))
     (deactivate-mark)
     (unwind-protect
          (condition-case-unless-debug nil

Reply via email to