checking if the buffer exists (#256).
This commit is contained in:
parent
e9f38f10a2
commit
ce28a67e28
@ -80,9 +80,9 @@ nil does not display errors/warnings.
|
|||||||
(buf ghc-process-original-buffer))
|
(buf ghc-process-original-buffer))
|
||||||
(ghc-check-highlight-original-buffer file buf infos)))
|
(ghc-check-highlight-original-buffer file buf infos)))
|
||||||
(t
|
(t
|
||||||
(with-current-buffer ghc-process-original-buffer
|
(ghc-with-current-buffer ghc-process-original-buffer
|
||||||
(remove-overlays (point-min) (point-max) 'ghc-check t))))
|
(remove-overlays (point-min) (point-max) 'ghc-check t))))
|
||||||
(with-current-buffer ghc-process-original-buffer
|
(ghc-with-current-buffer ghc-process-original-buffer
|
||||||
(let ((len (length infos)))
|
(let ((len (length infos)))
|
||||||
(if (= len 0)
|
(if (= len 0)
|
||||||
(setq mode-line-process "")
|
(setq mode-line-process "")
|
||||||
@ -91,7 +91,7 @@ nil does not display errors/warnings.
|
|||||||
(wlen (- len elen)))
|
(wlen (- len elen)))
|
||||||
(setq mode-line-process (format " %d:%d" elen wlen))))))))
|
(setq mode-line-process (format " %d:%d" elen wlen))))))))
|
||||||
(t
|
(t
|
||||||
(with-current-buffer ghc-process-original-buffer
|
(ghc-with-current-buffer ghc-process-original-buffer
|
||||||
(setq mode-line-process " failed")))))
|
(setq mode-line-process " failed")))))
|
||||||
|
|
||||||
(defun ghc-to-info (errs)
|
(defun ghc-to-info (errs)
|
||||||
@ -114,7 +114,7 @@ nil does not display errors/warnings.
|
|||||||
(ghc-add infos info)))))))
|
(ghc-add infos info)))))))
|
||||||
|
|
||||||
(defun ghc-check-highlight-original-buffer (ofile buf infos)
|
(defun ghc-check-highlight-original-buffer (ofile buf infos)
|
||||||
(with-current-buffer buf
|
(ghc-with-current-buffer buf
|
||||||
(remove-overlays (point-min) (point-max) 'ghc-check t)
|
(remove-overlays (point-min) (point-max) 'ghc-check t)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
|
@ -205,4 +205,12 @@
|
|||||||
expr
|
expr
|
||||||
(concat "(" expr ")"))))
|
(concat "(" expr ")"))))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defmacro ghc-with-current-buffer (buf &rest body)
|
||||||
|
;; (declare (indent 1))
|
||||||
|
`(if (get-buffer ,buf)
|
||||||
|
(with-current-buffer ,buf
|
||||||
|
,@body)))
|
||||||
|
|
||||||
(provide 'ghc-func)
|
(provide 'ghc-func)
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
(buf (get-buffer-create (concat " ghc-modi:" name)))
|
(buf (get-buffer-create (concat " ghc-modi:" name)))
|
||||||
(file (buffer-file-name))
|
(file (buffer-file-name))
|
||||||
(cpro (get-process name)))
|
(cpro (get-process name)))
|
||||||
(with-current-buffer buf
|
(ghc-with-current-buffer buf
|
||||||
(unless ghc-process-running
|
(unless ghc-process-running
|
||||||
(setq ghc-process-running t)
|
(setq ghc-process-running t)
|
||||||
(setq ghc-process-original-buffer cbuf)
|
(setq ghc-process-original-buffer cbuf)
|
||||||
@ -69,7 +69,7 @@
|
|||||||
pro))
|
pro))
|
||||||
|
|
||||||
(defun ghc-process-filter (process string)
|
(defun ghc-process-filter (process string)
|
||||||
(with-current-buffer (process-buffer process)
|
(ghc-with-current-buffer (process-buffer process)
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(insert string)
|
(insert string)
|
||||||
(forward-line -1)
|
(forward-line -1)
|
||||||
@ -110,7 +110,7 @@
|
|||||||
;; (discard-input) avoids getting stuck.
|
;; (discard-input) avoids getting stuck.
|
||||||
(discard-input))
|
(discard-input))
|
||||||
(quit
|
(quit
|
||||||
(with-current-buffer (process-buffer pro)
|
(ghc-with-current-buffer (process-buffer pro)
|
||||||
(setq ghc-process-running nil)))))
|
(setq ghc-process-running nil)))))
|
||||||
ghc-process-results)
|
ghc-process-results)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user