Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; Designed on a full Slackware 15 install.
- ;; Relies on the fortune application.
- ;; Parameters to control the output of fortune.
- ;; 'safe
- ;; 'maybe-offensive
- ;; 'offensive
- ;; 'star-trek
- (cl-defun get-fortune (&optional (category 'safe))
- "Use the included fortune application to return a saying."
- (with-temp-buffer
- (let* ((db (cond
- ((eq category 'safe) "all")
- ((eq category 'maybe-offensive) "-a")
- ((eq category 'offensive) "-o")
- ((eq category 'star-trek) "startrek")
- (t "all"))))
- (call-process "fortune" nil (current-buffer) nil db)
- (buffer-substring-no-properties (point-min) (point-max)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement