Created
April 24, 2014 21:12
-
-
Save sellout/11269679 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ansi-color-insertion-filter (proc string) | |
(when (buffer-live-p (process-buffer proc)) | |
(with-current-buffer (process-buffer proc) | |
(save-excursion | |
;; Insert the text, advancing the process marker. | |
(goto-char (process-mark proc)) | |
(insert (ansi-color-apply string)) | |
(set-marker (process-mark proc) (point))) | |
(goto-char (process-mark proc))))) | |
(defun idris-ipkg-command (ipkg-file command) | |
"Run a command on ipkg-file. The command can be build, install, or clean." | |
;; Idris must have its working directory in the same place as the ipkg file | |
(let ((dir (file-name-directory ipkg-file)) | |
(file (file-name-nondirectory ipkg-file)) | |
(cmd (cond ((equal command 'build) "--build") | |
((equal command 'install) "--install") | |
((equal command 'clean) "--clean") | |
(t (error "Invalid command name %s" command))))) | |
(unless dir | |
(error "Unable to determine directory for filename '%s'" ipkg-file)) | |
(let ((default-directory dir)) ; default-directory is a special variable - this starts idris in dir | |
(set-process-filter (start-process (concat "idris " cmd) | |
idris-ipkg-build-buffer-name idris-interpreter-path cmd file) | |
'ansi-color-insertion-filter) | |
(with-current-buffer idris-ipkg-build-buffer-name | |
(idris-ipkg-build-mode)) | |
(pop-to-buffer idris-ipkg-build-buffer-name)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment