[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 107a0c4: Don't require a shell when loading htmlfon
From: |
Philipp Stephani |
Subject: |
[Emacs-diffs] master 107a0c4: Don't require a shell when loading htmlfontify |
Date: |
Fri, 27 Jan 2017 17:58:23 +0000 (UTC) |
branch: master
commit 107a0c4caa649bad88cdbb67439f67ed8105e41a
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>
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.
---
lisp/htmlfontify.el | 12 +++++++++---
test/lisp/htmlfontify-tests.el | 12 ++++++++++++
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index 21aac1a..74393ff 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -365,9 +365,15 @@ commands in `hfy-etags-cmd-alist'."
(defun hfy-which-etags ()
"Return a string indicating which flavor of etags we are using."
- (let ((v (shell-command-to-string (concat hfy-etags-bin " --version"))))
- (cond ((string-match "exube" v) "exuberant ctags")
- ((string-match "GNU E" v) "emacs etags" )) ))
+ (with-temp-buffer
+ (condition-case nil
+ (when (eq (call-process hfy-etags-bin nil t nil "--version") 0)
+ (goto-char (point-min))
+ (cond
+ ((looking-at-p "exube") "exuberant ctags")
+ ((looking-at-p "GNU E") "emacs etags")))
+ ;; Return nil if the etags binary isn't executable (Bug#25468).
+ (file-error nil))))
(defcustom hfy-etags-cmd
;; 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 15eb7c1..4a1d566 100644
--- a/test/lisp/htmlfontify-tests.el
+++ b/test/lisp/htmlfontify-tests.el
@@ -30,5 +30,17 @@
(symbol-function
'htmlfontify-load-rgb-file))))
+(ert-deftest htmlfontify-bug25468 ()
+ "Tests that htmlfontify can be loaded even if no shell is
+available (Bug#25468)."
+ (should (equal (let ((process-environment
+ (cons "SHELL=/does/not/exist" process-environment)))
+ (call-process
+ (expand-file-name (invocation-name) (invocation-directory))
+ nil nil nil
+ "--quick" "--batch"
+ (concat "--load=" (locate-library "htmlfontify"))))
+ 0)))
+
(provide 'htmlfontify-tests)
;; htmlfontify-tests.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 107a0c4: Don't require a shell when loading htmlfontify,
Philipp Stephani <=