diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index e851ff624..c5790800b 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -216,8 +216,11 @@ this template." (delete-region begin end) (insert replacement))))) ((or `babel-call `inline-babel-call) - (org-babel-exp-do-export (org-babel-lob-get-info element) - 'lob) + (org-babel-exp-do-export + (or (org-babel-lob-get-info element) + (user-error "Unknown Babel reference: %s" + (org-element-property :call element))) + 'lob) (let ((rep (org-fill-template org-babel-exp-call-line-template diff --git a/lisp/org.el b/lisp/org.el index 4db2dbe04..c58708a5f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8768,7 +8768,21 @@ If the file does not exist, throw an error." (save-window-excursion (message "Running %s...done" cmd) - (start-process-shell-command cmd nil cmd) + ;; Handlers such as "gio open" and kde-open5 start viewer in background + ;; and exit immediately. Avoid `start-process' since it assumes + ;; :connection-type 'pty and kills children processes with SIGHUP + ;; when temporary terminal session is finished. + (make-process + :name "org-open-file" :connection-type 'pipe :noquery t + :buffer nil ; use "*Messages*" for debugging + :sentinel (lambda (proc event) + (when (and (memq (process-status proc) '(exit signal)) + (/= (process-exit-status proc) 0)) + (message + "Command %s: %s." + (mapconcat #'identity (process-command proc) " ") + (substring event 0 -1)))) + :command (list shell-file-name shell-command-switch cmd)) (and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait)))) ((or (stringp cmd) (eq cmd 'emacs)) diff --git a/testing/lisp/test-ob-exp.el b/testing/lisp/test-ob-exp.el index f6be51ffe..9581f2866 100644 --- a/testing/lisp/test-ob-exp.el +++ b/testing/lisp/test-ob-exp.el @@ -585,6 +585,14 @@ src_emacs-lisp{(+ 1 1)}" (org-babel-exp-process-buffer)) (buffer-string))))) +(ert-deftest ob-exp/unknown-call-reference () + "Test exporting with a call that references an unknown name." + (should-error + (org-test-with-temp-text + "call_foo()" + (let ((org-export-use-babel t)) + (org-babel-exp-process-buffer))) + :type 'user-error)) (provide 'test-ob-exp)