feat(emacs): use lean-server-send-cmd-async
This commit is contained in:
parent
677f4af801
commit
e7f6228001
3 changed files with 17 additions and 14 deletions
|
@ -553,8 +553,11 @@ Take out \"BEGININFO\" and \"ENDINFO\" and Use \"ACK\" as a delim."
|
|||
(let ((file-name (buffer-file-name))
|
||||
(line-number (line-number-at-pos)))
|
||||
(lean-server-check-current-file file-name)
|
||||
(lean-server-send-cmd (lean-cmd-info line-number)
|
||||
cont)))
|
||||
(lean-server-send-cmd-async (lean-cmd-info line-number)
|
||||
(lambda (info-record)
|
||||
(if (lean-info-record-nay info-record)
|
||||
(lean-get-info-record-at-point cont)
|
||||
(funcall cont info-record))))))
|
||||
|
||||
(defun lean-get-full-name-at-point-cont (info-record)
|
||||
"Continuation of lean-get-full-name-at-point"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
nil t "" nil (car key-list)))
|
||||
(option (cdr (assoc option-name option-record-alist)))
|
||||
(option-value (lean-option-read option)))
|
||||
(lean-server-send-cmd (lean-cmd-set option-name option-value) 'message)))
|
||||
(lean-server-send-cmd-async (lean-cmd-set option-name option-value) 'message)))
|
||||
|
||||
(defun lean-set-option ()
|
||||
"Set Lean option."
|
||||
|
@ -49,7 +49,7 @@
|
|||
(stringp tmp-str)
|
||||
(string= tmp-str str))
|
||||
val
|
||||
(error "%s is not an int value" str))))
|
||||
(error "%s is not an int value" str))))
|
||||
|
||||
(defun lean-option-read-uint (prompt)
|
||||
(interactive)
|
||||
|
@ -134,7 +134,7 @@
|
|||
(defun lean-options-parse-string (str)
|
||||
"Parse lines of option string into an entry of alist of lean-option-records
|
||||
|
||||
(NAME . OPTION-RECORD)."
|
||||
'(NAME . OPTION-RECORD)'."
|
||||
(let ((str-list (split-string str "\n"))
|
||||
str-str-list
|
||||
option-list)
|
||||
|
@ -151,8 +151,8 @@
|
|||
(defun lean-get-options (cont)
|
||||
"Get Lean option."
|
||||
(interactive)
|
||||
(lean-server-send-cmd (lean-cmd-options)
|
||||
(lambda (option-record-alist)
|
||||
(when cont
|
||||
(funcall cont option-record-alist)))))
|
||||
(lean-server-send-cmd-async (lean-cmd-options)
|
||||
(lambda (option-record-alist)
|
||||
(when cont
|
||||
(funcall cont option-record-alist)))))
|
||||
(provide 'lean-option)
|
||||
|
|
|
@ -60,15 +60,15 @@
|
|||
(defun lean-eval-cmd (lean-cmd)
|
||||
"Evaluate lean command."
|
||||
(interactive "sLean CMD: ")
|
||||
(lean-server-send-cmd (lean-cmd-eval lean-cmd)
|
||||
'message))
|
||||
(lean-server-send-cmd-async (lean-cmd-eval lean-cmd)
|
||||
'message))
|
||||
|
||||
;; Clear Cache
|
||||
(defun lean-clear-cache ()
|
||||
"Send CLEAR_CACHE command to lean-server"
|
||||
(interactive)
|
||||
(call-process (lean-get-executable "linja") nil 0 nil "clear-cache")
|
||||
(lean-server-send-cmd (lean-cmd-clear-cache)))
|
||||
(lean-server-send-cmd-async (lean-cmd-clear-cache)))
|
||||
|
||||
;; =======================================================
|
||||
;; Change Handling
|
||||
|
@ -138,14 +138,14 @@ pairs, compute changed-lines, inserted-lines, and removed-lines."
|
|||
(defun lean-after-change-handle-inserted (inserted-lines changed-lines)
|
||||
(lean-flush-changed-lines)
|
||||
(cl-loop for n in inserted-lines
|
||||
do (lean-server-send-cmd (lean-cmd-insert n (lean-grab-line n))))
|
||||
do (lean-server-send-cmd-async (lean-cmd-insert n (lean-grab-line n))))
|
||||
(setq lean-changed-lines changed-lines)
|
||||
(lean-flush-changed-lines))
|
||||
|
||||
(defun lean-after-change-handle-removed (removed-lines changed-lines)
|
||||
(lean-flush-changed-lines)
|
||||
(cl-loop for n in removed-lines
|
||||
do (lean-server-send-cmd (lean-cmd-remove n)))
|
||||
do (lean-server-send-cmd-async (lean-cmd-remove n)))
|
||||
(setq lean-changed-lines changed-lines)
|
||||
(lean-flush-changed-lines))
|
||||
|
||||
|
|
Loading…
Reference in a new issue