diff options
author | Case Duckworth | 2022-04-27 08:35:22 -0500 |
---|---|---|
committer | Case Duckworth | 2022-04-27 08:35:22 -0500 |
commit | 340c8583cc75337d2b6529385b862584657dc752 (patch) | |
tree | 52c79cc19ea59566c12e984b699cf022d957969e | |
parent | Add +org-export-pre-hook to prepare the buffer before export (diff) | |
download | emacs-340c8583cc75337d2b6529385b862584657dc752.tar.gz emacs-340c8583cc75337d2b6529385b862584657dc752.zip |
Display fortunes in scratch buffer
-rw-r--r-- | lisp/+scratch.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/+scratch.el b/lisp/+scratch.el index b724a94..bd16ec2 100644 --- a/lisp/+scratch.el +++ b/lisp/+scratch.el | |||
@@ -24,5 +24,16 @@ For `kill-buffer-query-functions'." | |||
24 | (next-line 2)) | 24 | (next-line 2)) |
25 | (rename-buffer (concat "*scratch<" mode ">*") t))) | 25 | (rename-buffer (concat "*scratch<" mode ">*") t))) |
26 | 26 | ||
27 | (defun +scratch-fortune () | ||
28 | (let* ((fmt (if (executable-find "fmt") | ||
29 | (format "| fmt -%d -s" (- fill-column 2)) | ||
30 | "")) | ||
31 | (s (string-trim | ||
32 | (if (executable-find "fortune") | ||
33 | (shell-command-to-string (concat "fortune -s" fmt)) | ||
34 | "ABANDON ALL HOPE YE WHO ENTER HERE")))) | ||
35 | (concat (replace-regexp-in-string "^" ";; " s) | ||
36 | "\n\n"))) | ||
37 | |||
27 | (provide '+scratch) | 38 | (provide '+scratch) |
28 | ;;; +scratch.el ends here | 39 | ;;; +scratch.el ends here |