feat(emacs/lean-cmd): add lean-clear-cache

Close #99
This commit is contained in:
Soonho Kong 2014-09-01 22:36:26 -07:00
parent 8dec18018c
commit a08ad99dba
3 changed files with 26 additions and 11 deletions

View file

@ -80,6 +80,10 @@ It has the effect of evaluating a command in the end of the current file"
"Display all configuration options available in Lean."
`(OPTIONS))
(defun lean-cmd-clear-cache ()
"Clear Cache"
`(CLEAR-CACHE))
;; Type
;; ====
(defun lean-cmd-type (cmd)
@ -199,20 +203,24 @@ It has the effect of evaluating a command in the end of the current file"
(defun lean-cmd-options-to-string (cmd)
"Convert Options command to string"
(format "OPTIONS"))
(defun lean-cmd-clear-cache-to-string (cmd)
"Convert Options command to string"
(format "CLEAR_CACHE"))
(defun lean-cmd-to-string (cmd)
"Convert command to string"
(cl-case (lean-cmd-type cmd)
('LOAD (lean-cmd-load-to-string cmd))
('VISIT (lean-cmd-visit-to-string cmd))
('REPLACE (lean-cmd-replace-to-string cmd))
('INSERT (lean-cmd-insert-to-string cmd))
('REMOVE (lean-cmd-remove-to-string cmd))
('INFO (lean-cmd-info-to-string cmd))
('CHECK (lean-cmd-check-to-string cmd))
('SET (lean-cmd-set-to-string cmd))
('EVAL (lean-cmd-eval-to-string cmd))
('OPTIONS (lean-cmd-options-to-string cmd))))
('LOAD (lean-cmd-load-to-string cmd))
('VISIT (lean-cmd-visit-to-string cmd))
('REPLACE (lean-cmd-replace-to-string cmd))
('INSERT (lean-cmd-insert-to-string cmd))
('REMOVE (lean-cmd-remove-to-string cmd))
('INFO (lean-cmd-info-to-string cmd))
('CHECK (lean-cmd-check-to-string cmd))
('SET (lean-cmd-set-to-string cmd))
('EVAL (lean-cmd-eval-to-string cmd))
('OPTIONS (lean-cmd-options-to-string cmd))
('CLEAR-CACHE (lean-cmd-clear-cache-to-string cmd))))
;; -- Test
(cl-assert (string= (lean-cmd-to-string (lean-cmd-load "~/work/lean/basic.lean"))

View file

@ -11,7 +11,7 @@
(interactive)
(let ((ltags-file-name (lean-get-executable "linja"))
tags-file-name)
(call-process ltags-file-name nil nil nil "TAGS"))
(call-process ltags-file-name nil 0 nil "TAGS"))
(unless tags-table-list
(setq tags-file-name (lean-find-file-upward "TAGS"))
(when tags-file-name

View file

@ -82,6 +82,13 @@
(lean-server-log "Something other than EVAL detected: %S" type)
(setq lean-global-server-message-to-process nil))))
;; 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)))
;; =======================================================
;; Change Handling
;; =======================================================