fix(emacs/lean-type): problem with lean-eldoc-nay-retry-time

If (current-idle-time) is non-zero, we need to set a timer to run
eldoc-documentation-function again when idle-time = (current-idle-time)
+ retry-delay.
This commit is contained in:
Soonho Kong 2014-08-26 23:58:02 -07:00
parent a1a14cf425
commit 224a4feba2
3 changed files with 24 additions and 21 deletions

View file

@ -501,22 +501,23 @@ Take out \"BEGININFO\" and \"ENDINFO\" and Use \"ACK\" as a delim."
(defun lean-get-info-record (file-name line-number column-number) (defun lean-get-info-record (file-name line-number column-number)
"Get info list from lean server using file-name and line-number" "Get info list from lean server using file-name and line-number"
(lean-server-check-current-file file-name) (when (and file-name line-number column-number)
(lean-server-send-cmd (lean-cmd-info line-number)) (lean-server-check-current-file file-name)
(while (not lean-global-server-message-to-process) (lean-server-send-cmd (lean-cmd-info line-number))
(accept-process-output (lean-server-get-process) 0 50 t)) (while (not lean-global-server-message-to-process)
(pcase lean-global-server-message-to-process (accept-process-output (lean-server-get-process) 0 50 t))
(`(INFO ,pre ,body) (pcase lean-global-server-message-to-process
(lean-server-log "The following pre-message will be thrown away:") (`(INFO ,pre ,body)
(lean-server-log "%s" pre) (lean-server-log "The following pre-message will be thrown away:")
(setq lean-global-server-message-to-process nil) (lean-server-log "%s" pre)
(lean-info-record-parse body file-name column-number)) (setq lean-global-server-message-to-process nil)
(`(,type ,pre , body) (lean-info-record-parse body file-name column-number))
(lean-server-log "The following pre-message will be thrown away:") (`(,type ,pre , body)
(lean-server-log "%s" pre) (lean-server-log "The following pre-message will be thrown away:")
(lean-server-log "Something other than INFO detected: %S" type) (lean-server-log "%s" pre)
;; (lean-server-log "Body: %S" body) (lean-server-log "Something other than INFO detected: %S" type)
(setq lean-global-server-message-to-process nil)))) ;; (lean-server-log "Body: %S" body)
(setq lean-global-server-message-to-process nil)))))
(defun lean-get-info-record-at-point () (defun lean-get-info-record-at-point ()
"Get info-record at the current point" "Get info-record at the current point"

View file

@ -45,7 +45,7 @@
:group 'lean :group 'lean
:type 'boolean) :type 'boolean)
(defcustom lean-eldoc-nay-retry-time 0.1 (defcustom lean-eldoc-nay-retry-time 0.3
"When eldoc-function had nay, try again after this amount of time.") "When eldoc-function had nay, try again after this amount of time.")
(defcustom lean-flycheck-checker-name "lmake" (defcustom lean-flycheck-checker-name "lmake"

View file

@ -35,10 +35,12 @@
info-string) info-string)
(cond (cond
((and info-record (lean-info-record-nay info-record)) ((and info-record (lean-info-record-nay info-record))
(lean-server-log "NAY Detected") (run-with-idle-timer
(run-with-idle-timer lean-eldoc-nay-retry-time (if (current-idle-time)
nil (time-add (seconds-to-time lean-eldoc-nay-retry-time) (current-idle-time))
'lean-eldoc-documentation-function) lean-eldoc-nay-retry-time)
nil
'lean-eldoc-documentation-function)
nil) nil)
(info-record (info-record
(setq info-string (lean-info-record-to-string info-record)) (setq info-string (lean-info-record-to-string info-record))