feat(emacs/lean-option): save lean-options to lean-global-option-alist

This commit is contained in:
Soonho Kong 2014-09-15 09:46:06 -07:00
parent f25f9a8fab
commit 75ab5e07d6
3 changed files with 18 additions and 1 deletions

View file

@ -20,6 +20,17 @@
(-drop 1 str-list)))
(string-join str-list "\n")))
(defun lean-option-string ()
(--reduce (format "%s %s" acc it)
(--map (format "-D %s=%s" (car it) (cdr it))
lean-global-option-alist)))
(defun lean-update-option-alist (name value)
(let ((needle (assoc-string name lean-global-option-alist)))
(when needle
(setq lean-global-option-alist (delq needle lean-global-option-alist)))
(setq lean-global-option-alist (cl-acons name value lean-global-option-alist))))
(defun lean-set-option-cont (option-record-alist)
(let* ((key-list (-map 'car option-record-alist))
(option-name
@ -28,7 +39,9 @@
nil t "" nil (car key-list)))
(option (cdr (assoc option-name option-record-alist)))
(option-value (lean-option-read option)))
(lean-server-send-cmd-async (lean-cmd-set option-name option-value) 'message)))
(lean-server-send-cmd-async
(lean-cmd-set option-name option-value)
(lambda (dummy) (lean-update-option-alist option-name option-value)))))
(defun lean-set-option ()
"Set Lean option."

View file

@ -151,6 +151,7 @@
(setq lean-global-server-last-time-sent nil)
(setq lean-global-async-task-queue nil)
(setq lean-global-nay-retry-counter 0)
(setq lean-global-option-alist nil)
(lean-server-cancel-retry-timer))
(defun lean-server-create-process ()

View file

@ -54,4 +54,7 @@ where TYPE := INFO | SET | EVAL | OPTIONS | SHOW | FINDP | FINDG | ERROR,
(defvar lean-global-before-change-text ""
"Before-change text")
(defvar lean-global-option-alist nil
"Current Lean options set by lean-set-option command")
(provide 'lean-variable)