blob: c9e0ae6b6f18b2a2a31be0503ddc9a2214bc94d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
;; filename: figlet.el
;; Kirby Files, 9/18/94. kfiles@bbn.com
;; add font completion: James LewisMoss 27 Oct 2000, dres@debian.org
;; feel free to modify and distribute; there's not a lot here.
;; call M-x figlet-message to insert a large ascii text in your buffer.
;; Current option is to center text. Feel free to change this if you'd
;; like.
(defvar fig-options "-c")
(setq save-eval-depth max-lisp-eval-depth)
(setq max-lisp-eval-depth 1000)
(defun collapse-lists (da-list)
(cond ((stringp da-list) (list da-list))
((null da-list) nil)
(t (append (collapse-lists (car da-list))
(collapse-lists (cdr da-list))))))
(defun generate-figlet-font-list (loc-list)
"Generate a list of figlet fonts."
(mapcar
'(lambda (element)
(cons element nil))
(mapcar
'(lambda (one-file)
(let ((point (string-match ".flf" one-file)))
(substring one-file 0 point)))
(collapse-lists
(mapcar
'(lambda (dir-string)
(directory-files (expand-file-name dir-string)
nil ".*\.flf"))
loc-list)))))
;; replace this with "figlet -I2" to get the default font dir
(defvar fig-font-locations '("/usr/share/figlet"))
(defvar fig-font-list (generate-figlet-font-list fig-font-locations))
(defun figlet-message ()
"Inserts large message of text in ASCII font into current buffer"
(interactive)
(setq str (read-from-minibuffer "Enter message: "))
(setq font
(completing-read "Which font: " fig-font-list nil t))
(call-process "figlet" nil t t "-f" font fig-options str)
(message "Done printing"))
(setq max-lisp-eval-depth save-eval-depth)
|