Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions jsonnet-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,8 @@ TYPE is an opening paren-like character."
;; Utilities for evaluating and jumping around Jsonnet code.
;;;###autoload
(defun jsonnet-eval-buffer ()
"Run jsonnet with the path of the current file."
"Run jsonnet with the path of the current file. This also works for
remote files accessed over TRAMP."
(interactive)
(let ((file-to-eval (file-truename (buffer-file-name)))
(search-dirs jsonnet-library-search-directories)
Expand All @@ -659,16 +660,18 @@ TYPE is an opening paren-like character."
(cl-loop for dir in search-dirs
collect "-J"
collect dir)
(list file-to-eval))))
(list (file-local-name file-to-eval))))
(dir-to-use-for-process-file (file-name-directory (buffer-file-name))))
(with-current-buffer (get-buffer-create output-buffer-name)
(setq buffer-read-only nil)
(erase-buffer)
(if (zerop (apply #'call-process cmd nil t nil args))
(progn
(when (fboundp 'json-mode)
(json-mode))
(view-mode))
(compilation-mode nil))
(let ((default-directory dir-to-use-for-process-file))
(if (zerop (apply #'process-file cmd nil t nil args))
(progn
(when (fboundp 'json-mode)
(json-mode))
(view-mode))
(compilation-mode nil)))
(goto-char (point-min))
(display-buffer (current-buffer) '(nil (inhibit-same-window . t)))))))

Expand Down
Loading