]> code.delx.au - gnu-emacs/blobdiff - lisp/play/fortune.el
Remove compatibility with Emacs 24.3 in octave-mode
[gnu-emacs] / lisp / play / fortune.el
index 965f6a99b9c91e27606df603f77d023b7eae5c2c..4871c459023f17e57ff4e24644e559dd797e112a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; fortune.el --- use fortune to create signatures
 
-;; Copyright (C) 1999, 2001-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: Holger Schauer <Holger.Schauer@gmx.de>
 ;; Keywords: games utils mail
@@ -302,6 +302,19 @@ specifies the file to choose the fortune from."
                            (split-string fortune-program-options)
                          fortune-program-options) (list fort-file)))))))
 
+;;;###autoload
+(defun fortune-message (&optional file)
+  "Display a fortune cookie to the mini-buffer.
+If called with a prefix, it has the same behavior as `fortune'.
+Optional FILE is a fortune file from which a cookie will be selected."
+  (interactive (list (if current-prefix-arg
+                         (fortune-ask-file)
+                       fortune-file)))
+  (with-temp-buffer
+    (let ((fortune-buffer-name (current-buffer)))
+      (fortune-in-buffer t file)
+      (message "%s" (buffer-string)))))
+
 ;;;###autoload
 (defun fortune (&optional file)
   "Display a fortune cookie.