Skip to content

Commit fe14918

Browse files
committed
update target file directly inside child emacs process
1 parent 47b6e24 commit fe14918

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

mason.el

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,22 +269,20 @@ To be used with `mason--process' and `mason--process-sync'."
269269
(defun mason--update-target (then)
270270
"Update target and call THEN."
271271
(let* ((reg-dir (mason--expand-child-file-name "registry" mason-dir))
272-
(out-file (mason--expand-child-file-name "target" reg-dir))
273-
output)
272+
(out-file (mason--expand-child-file-name "target" reg-dir)))
274273
(when (file-exists-p out-file)
275274
(setq mason--target (ignore-errors (mason--read-data out-file))))
276275
(if (not (null mason--target))
277276
(funcall then)
278277
(mason--process
279-
(mason--emacs-cmd '(message "%S" (mason--get-target)))
280-
:filter (lambda (_ o) (setq output (concat output o)))
278+
(mason--emacs-cmd
279+
`(make-directory ,reg-dir t)
280+
`(with-temp-file ,out-file
281+
(prin1 (mason--get-target) (current-buffer))))
281282
:then
282283
(lambda (success)
283284
(if (not success) (error "Updating target failed")
284-
(setq mason--target (read output))
285-
(make-directory reg-dir t)
286-
(with-temp-file out-file
287-
(insert output))
285+
(setq mason--target (mason--read-data out-file))
288286
(funcall then)))))))
289287

290288
(defun mason--target-match (str)

0 commit comments

Comments
 (0)