]> 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 25fa3f66ef1ac35ea1fec6e6e962981ac2f1e933..4871c459023f17e57ff4e24644e559dd797e112a 100644 (file)
@@ -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.