Skip to content

Commit a152514

Browse files
committed
Optimize list scanning in response
1 parent 37963eb commit a152514

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

inf-clojure.el

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -968,18 +968,15 @@ the `inf-clojure-prompt`."
968968
;; Collect the output
969969
(set-buffer work-buffer)
970970
(goto-char (point-min))
971-
;; Skip past the command, if it was echoed
972-
(and (looking-at command)
973-
(forward-line))
974-
(let* ((beg (if beg-string
975-
(progn (search-forward beg-string nil t) (match-beginning 0))
976-
(point)))
977-
(end (if end-string
978-
(search-forward end-string nil t)
979-
(point-max)))
980-
(buffer-string (buffer-substring-no-properties beg end)))
981-
(when (and buffer-string (string-match inf-clojure-prompt buffer-string))
982-
(substring buffer-string 0 (match-beginning 0)))))))
971+
(let* ((beg (or (when (and beg-string (search-forward beg-string nil t))
972+
(match-beginning 0))
973+
(point-min)))
974+
(end (or (when end-string
975+
(search-forward end-string nil t))
976+
(point-max)))
977+
(prompt (when (search-forward inf-clojure-prompt nil t)
978+
(match-beginning 0))))
979+
(buffer-substring-no-properties beg (or prompt end))))))
983980

984981
(defun inf-clojure--nil-string-match-p (string)
985982
"Return true iff STRING is not nil.
@@ -1028,7 +1025,7 @@ for evaluation, therefore FORM should not include it."
10281025
See variable `inf-clojure-arglists-form'."
10291026
(thread-first
10301027
(format (inf-clojure-arglists-form) fn)
1031-
(inf-clojure--process-response (inf-clojure-proc))
1028+
(inf-clojure--process-response (inf-clojure-proc) "(" ")")
10321029
(inf-clojure--read-or-nil)
10331030
(inf-clojure--list-or-nil)))
10341031

@@ -1101,7 +1098,7 @@ See variable `inf-clojure-buffer'."
11011098
(when (not (string-blank-p expr))
11021099
(thread-first
11031100
(format (inf-clojure-completion-form) (substring-no-properties expr))
1104-
(inf-clojure--process-response (inf-clojure-proc))
1101+
(inf-clojure--process-response (inf-clojure-proc) "(" ")")
11051102
(inf-clojure--read-or-nil)
11061103
(inf-clojure--list-or-nil))))
11071104

0 commit comments

Comments
 (0)