diff options
author | Kyle Meyer <kyle@kyleam.com> | 2021-03-21 13:41:39 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2021-03-21 13:41:39 -0400 |
commit | c1fa5ea76f175e8bf8e466b4f47fca87176e5b0c (patch) | |
tree | c8ced605fc840f5b4265af82eb572ac944c854b7 | |
parent | a9f38b1c2279fec0604a4474de891f88af6b205e (diff) | |
parent | 5450d64202412630b069c4823e475ef2e8a9e3fd (diff) | |
download | org-mode-c1fa5ea76f175e8bf8e466b4f47fca87176e5b0c.tar.gz |
Merge branch 'maint'
-rw-r--r-- | lisp/ob-exp.el | 7 | ||||
-rw-r--r-- | lisp/org.el | 16 | ||||
-rw-r--r-- | testing/lisp/test-ob-exp.el | 8 |
3 files changed, 28 insertions, 3 deletions
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index e851ff6..c579080 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 4db2dbe..c58708a 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 f6be51f..9581f28 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) |