aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Stephani2017-01-17 18:24:29 +0100
committerPhilipp Stephani2017-01-27 18:37:58 +0100
commit107a0c4caa649bad88cdbb67439f67ed8105e41a (patch)
tree64bd49b53d7e3b7ef61e7ad86eecf6a36cbabdcc
parent412b8dac5277092e677b3cd57b0fd1a36893a26b (diff)
downloademacs-107a0c4caa649bad88cdbb67439f67ed8105e41a.tar.gz
emacs-107a0c4caa649bad88cdbb67439f67ed8105e41a.zip
Don't require a shell when loading htmlfontify
* lisp/htmlfontify.el (hfy-which-etags): Don't call a shell for detecting the etags version (Bug#25468). * test/lisp/htmlfontify-tests.el (htmlfontify-bug25468): Add unit test.
-rw-r--r--lisp/htmlfontify.el12
-rw-r--r--test/lisp/htmlfontify-tests.el12
2 files changed, 21 insertions, 3 deletions
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index 21aac1ab216..74393ffbaeb 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -365,9 +365,15 @@ commands in `hfy-etags-cmd-alist'."
365 365
366(defun hfy-which-etags () 366(defun hfy-which-etags ()
367 "Return a string indicating which flavor of etags we are using." 367 "Return a string indicating which flavor of etags we are using."
368 (let ((v (shell-command-to-string (concat hfy-etags-bin " --version")))) 368 (with-temp-buffer
369 (cond ((string-match "exube" v) "exuberant ctags") 369 (condition-case nil
370 ((string-match "GNU E" v) "emacs etags" )) )) 370 (when (eq (call-process hfy-etags-bin nil t nil "--version") 0)
371 (goto-char (point-min))
372 (cond
373 ((looking-at-p "exube") "exuberant ctags")
374 ((looking-at-p "GNU E") "emacs etags")))
375 ;; Return nil if the etags binary isn't executable (Bug#25468).
376 (file-error nil))))
371 377
372(defcustom hfy-etags-cmd 378(defcustom hfy-etags-cmd
373 ;; We used to wrap this in a `eval-and-compile', but: 379 ;; We used to wrap this in a `eval-and-compile', but:
diff --git a/test/lisp/htmlfontify-tests.el b/test/lisp/htmlfontify-tests.el
index 15eb7c170c9..4a1d566e96c 100644
--- a/test/lisp/htmlfontify-tests.el
+++ b/test/lisp/htmlfontify-tests.el
@@ -30,5 +30,17 @@
30 (symbol-function 30 (symbol-function
31 'htmlfontify-load-rgb-file)))) 31 'htmlfontify-load-rgb-file))))
32 32
33(ert-deftest htmlfontify-bug25468 ()
34 "Tests that htmlfontify can be loaded even if no shell is
35available (Bug#25468)."
36 (should (equal (let ((process-environment
37 (cons "SHELL=/does/not/exist" process-environment)))
38 (call-process
39 (expand-file-name (invocation-name) (invocation-directory))
40 nil nil nil
41 "--quick" "--batch"
42 (concat "--load=" (locate-library "htmlfontify"))))
43 0)))
44
33(provide 'htmlfontify-tests) 45(provide 'htmlfontify-tests)
34;; htmlfontify-tests.el ends here 46;; htmlfontify-tests.el ends here