From 340c8583cc75337d2b6529385b862584657dc752 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 27 Apr 2022 08:35:22 -0500 Subject: Display fortunes in scratch buffer --- lisp/+scratch.el | 11 +++++++++++ 1 file changed, 11 insertions(+) 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'." (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 -- cgit 1.4.1-21-gabe81