Display fortunes in scratch buffer

This commit is contained in:
Case Duckworth 2022-04-27 08:35:22 -05:00
parent 3f925fc0e3
commit 340c8583cc
1 changed files with 11 additions and 0 deletions

View File

@ -24,5 +24,16 @@ For `kill-buffer-query-functions'."
(next-line 2))
(rename-buffer (concat "*scratch<" mode ">*") t)))
(defun +scratch-fortune ()
(let* ((fmt (if (executable-find "fmt")
(format "| fmt -%d -s" (- fill-column 2))
""))
(s (string-trim
(if (executable-find "fortune")
(shell-command-to-string (concat "fortune -s" fmt))
"ABANDON ALL HOPE YE WHO ENTER HERE"))))
(concat (replace-regexp-in-string "^" ";; " s)
"\n\n")))
(provide '+scratch)
;;; +scratch.el ends here