branch: externals/auctex
commit fa309c9559f0a6dc3428daca6896f615e7030521
Author: Tassilo Horn <[email protected]>
Commit: Tassilo Horn <[email protected]>
Fix error when tex.el is loaded while default-directory doesn't exist
* tex.el (TeX-view-program-select-evince): Bind `default-directory' to
HOME for the shell command testing for the availability of
evince-based viewer. That triggered an error when tex.el is loaded as
response to finding a tex file in a non-existent directory which at
this point is the value of `default-directory' (bug#50225).
---
tex.el | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/tex.el b/tex.el
index 46d6bbc..65ece76 100644
--- a/tex.el
+++ b/tex.el
@@ -1265,12 +1265,18 @@ viewer."
(if (TeX-evince-dbus-p de app :forward)
(intern (format "TeX-%s-sync-view" app))
`(,app (mode-io-correlate
- ;; With evince 3, -p N opens the page *labeled* N,
- ;; and -i,--page-index the physical page N.
- ,(if (string-match "--page-index"
- (shell-command-to-string (concat app "
--help")))
- " -i %(outpage)"
- " -p %(outpage)")) " %o")))
+ ;; When tex.el is loaded as response to opening a tex file
+ ;; in a non-existent directory, we need to make sure
+ ;; `default-directory' exists, otherwise the shell-command
+ ;; below will error (bug#50225).
+ ,(let ((default-directory (file-name-as-directory
+ (expand-file-name "~"))))
+ ;; With evince 3, -p N opens the page *labeled* N,
+ ;; and -i,--page-index the physical page N.
+ (if (string-match "--page-index"
+ (shell-command-to-string (concat app "
--help")))
+ " -i %(outpage)"
+ " -p %(outpage)"))) " %o")))
(defvar TeX-view-program-list-builtin
(cond