fix(emacs/lean-server): respect order of messages in check-buffer-and-partition

This commit is contained in:
Soonho Kong 2014-09-10 12:46:08 -07:00
parent 7c4debd1d1
commit b51e8dd1b9

View file

@ -104,7 +104,7 @@
,(rx line-start (group "-- ENDFINDP") line-end)) ,(rx line-start (group "-- ENDFINDP") line-end))
(FINDG ,(rx line-start "-- BEGINFINDG" (* not-newline) line-end) (FINDG ,(rx line-start "-- BEGINFINDG" (* not-newline) line-end)
,(rx line-start (group "-- ENDFINDG") line-end)) ,(rx line-start (group "-- ENDFINDG") line-end))
(WAIT ,(rx line-start "-- BEGINWAIT" line-end) (WAIT ,(rx line-start "-- BEGINWAIT" line-end)
,(rx line-start (group "-- ENDWAIT") line-end)) ,(rx line-start (group "-- ENDWAIT") line-end))
(ERROR ,(rx line-start "-- " (0+ not-newline) line-end) (ERROR ,(rx line-start "-- " (0+ not-newline) line-end)
,(rx line-start (group "-- ERROR" (0+ not-newline)) line-end))) ,(rx line-start (group "-- ERROR" (0+ not-newline)) line-end)))
@ -124,12 +124,16 @@
(defun lean-server-check-buffer-and-partition (buf-str) (defun lean-server-check-buffer-and-partition (buf-str)
"Return the status of buffer." "Return the status of buffer."
(let (result) (when buf-str
(when buf-str (let (matches partition-result)
(cl-loop for (type beg-regex end-regex) in lean-server-syntax-pattern (setq matches
do (setq partition-result (lean-server-split-buffer buf-str beg-regex end-regex)) (cl-loop for (type beg-regex end-regex) in lean-server-syntax-pattern
if partition-result do (setq partition-result (lean-server-split-buffer buf-str beg-regex end-regex))
return `(,type ,partition-result))))) if partition-result
collect `(,type ,partition-result)))
(when matches
(-min-by (-on '< (lambda (type-partition-result) (length (car (cdr type-partition-result)))))
matches)))))
(defun lean-server-process-received-message (buf str) (defun lean-server-process-received-message (buf str)
"Process received message from lean-server" "Process received message from lean-server"