aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-12-26 22:35:48 +0200
committerEli Zaretskii2015-12-26 22:35:48 +0200
commit4c361a95cc01a34bea140e633f55e0940177593a (patch)
tree2d7de755128f3c6d728191ee28d518f1a0bdceee
parent4b1436b702d56eedd27a0777fc7232cdfb7ac4f6 (diff)
downloademacs-4c361a95cc01a34bea140e633f55e0940177593a.tar.gz
emacs-4c361a95cc01a34bea140e633f55e0940177593a.zip
Don't try using /bin/sh in artist.el on MS-Windows
* lisp/textmodes/artist.el (artist-figlet-get-font-list-windows): New function. (artist-figlet-choose-font): Use it on MS-Windows and MS-DOS. (Bug#20167)
-rw-r--r--lisp/textmodes/artist.el28
1 files changed, 27 insertions, 1 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index a29418e6f84..373ab14e3fb 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -2873,10 +2873,36 @@ Returns a list of strings."
2873 (error "Failed to read available fonts: %s (%d)" stderr exit-code)) 2873 (error "Failed to read available fonts: %s (%d)" stderr exit-code))
2874 (artist-string-split stdout ".flf\n"))) 2874 (artist-string-split stdout ".flf\n")))
2875 2875
2876(defun artist-figlet-get-font-list-windows ()
2877 "Read in fonts on MS-Windows by collecting output of the `figlet' program.
2878Returns a list of strings."
2879 (let* ((ls-cmd "figlet -I2")
2880 (result (artist-system shell-file-name nil
2881 (list shell-command-switch ls-cmd)))
2882 (exit-code (elt result 0))
2883 (stdout (elt result 1))
2884 (stderr (elt result 2)))
2885 (if (not (= exit-code 0))
2886 (error "Failed to read available fonts: %s (%d)" stderr exit-code))
2887 (let ((dir-list (artist-string-split stdout "\n"))
2888 result)
2889 (mapc
2890 (lambda (dir)
2891 (let ((default-directory dir))
2892 (setq result (append (file-expand-wildcards "*.flf") result))))
2893 dir-list)
2894 (mapcar
2895 (lambda (file)
2896 (replace-regexp-in-string "\.flf\\'" "" file))
2897 result))))
2898
2876(defun artist-figlet-choose-font () 2899(defun artist-figlet-choose-font ()
2877 "Read any extra arguments for figlet." 2900 "Read any extra arguments for figlet."
2878 (interactive) 2901 (interactive)
2879 (let* ((avail-fonts (artist-figlet-get-font-list)) 2902 (let* ((avail-fonts
2903 (if (memq system-type '(windows-nt ms-dos))
2904 (artist-figlet-get-font-list-windows)
2905 (artist-figlet-get-font-list)))
2880 (font (completing-read (concat "Select font (default " 2906 (font (completing-read (concat "Select font (default "
2881 artist-figlet-default-font 2907 artist-figlet-default-font
2882 "): ") 2908 "): ")