Open barslmn opened 8 months ago
I hit the same issue. Going deeper, org-auto-tangle
uses async-start
to tangle asynchronously. This starts a new Emacs process that does not know the existing ssh connection.
I can think of two ways to fix it
,(async-inject-variables "tramp-ssh-controlmaster-options")
make-thread
so that everything happens in the same process.I did not get (1) to work but can get (2) working. Here is the rewritten version. One cons it that it might freeze the UI like usual org-babel-tangle
.
(defun org-auto-tangle-async (file)
"Invoke `org-babel-tangle-file' asynchronously on FILE."
(message "Tangling %s..." (buffer-file-name))
(make-thread
(let* ((buf-vars (plist-get (org-auto-tangle--get-inbuffer-options)
:with-vars))
(with-vars (if buf-vars
(mapcar #'intern
(org-uniquify (org-split-string
(symbol-name buf-vars) ":")))
org-auto-tangle-with-vars))
(preserved (mapcar (lambda (v)
(cons v (symbol-value v)))
(append '(org-src-preserve-indentation
org-babel-pre-tangle-hook
org-babel-post-tangle-hook)
with-vars)))
(evaluate (not (member file org-auto-tangle-babel-safelist))))
(let ((start-time (current-time))
(non-essential t)
(org-confirm-babel-evaluate evaluate))
(cl-progv (mapcar #'car preserved) (mapcar #'cdr preserved)
(org-babel-tangle-file file))
(let ((tangle-time (float-time (time-since start-time)))
(message-string (format "Tangling %S completed after" file)))
(message "%s %.2f seconds" message-string tangle-time))))))
Hi, thanks for the great package.
I got the following block:
I can tangle this with the
org-bable-tangle
command. But org-auto-tangle gives the following error:org-auto-tangle: 0.6.0 GNU Emacs v29.1 nil Doom core v3.0.0-pre HEAD -> master 03d692f1 2023-12-08 15:11:45 -0500 Doom modules v23.12.0-pre HEAD -> master 03d692f1 2023-12-08 15:11:45 -0500