I would like to suggest the following patch, that fixes the use of texdoc in general, but especially when emacs itself is used as the PDF viewer. Please let me know if there is some more standard way (through git or otherwise) to make a pull request.
The older way of calling texdoc would hang emacs when the viewer_pdf was
emacsclient. Moreover, the intended way to send the error message
assumes texdoc is called non-interactively.
* tex.el: use `make-process` to call `texdoc` with `-I` argument.
---
tex.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tex.el b/tex.el
index 93f2252..5448e94 100644
--- a/tex.el
+++ b/tex.el
@@ -6633,8 +6633,12 @@ enter the number of the file to view, anything else to skip: ") list)))
;; Recent Texdoc returns exit code 3 when it can't find the
;; specified document, according to
;; <URL:https://tug.org/texdoc/doc/texdoc.man1.pdf>
- (if (= (call-process "texdoc" nil nil nil "--view" pkg) 3)
- (message "No documentation found for %s" pkg)))))))
+ (make-process
+ :name "texdoc"
+ :command (list "texdoc" "-I" "--view" pkg)
+ :sentinel (lambda (proc string)
+ (when (= (process-exit-status proc) 3)
+ (message "No documentation found for %s" pkg)))))))))
(defun TeX-goto-info-page ()
"Read documentation for AUCTeX in the info system."
Best,
YDL