aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Datko2016-02-24 15:42:28 +1100
committerLars Ingebrigtsen2016-02-24 15:42:28 +1100
commit338f78ad6aa84583baa617591dbce1aa1caca4da (patch)
treeb502217b91610c5274898e0e75f1058d2b130b11
parentbed990a747b0cc6d9d91ca08afc84473642f8cb3 (diff)
downloademacs-338f78ad6aa84583baa617591dbce1aa1caca4da.tar.gz
emacs-338f78ad6aa84583baa617591dbce1aa1caca4da.zip
Add a fortune-message command
* lisp/play/fortune.el (fortune-message): Add a command to display fortunes in the echo area (bug#14915). Copyright-paperwork-exempt: yes
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/play/fortune.el13
2 files changed, 17 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 679532b89c7..18810eabf2c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1750,6 +1750,10 @@ details.
1750It should be placed right where the docstring would be, and FORM is then 1750It should be placed right where the docstring would be, and FORM is then
1751evaluated (and should return a string) when the closure is built. 1751evaluated (and should return a string) when the closure is built.
1752 1752
1753---
1754** The new command `fortune-message' has been added, which displays
1755fortunes in the echo area.
1756
1753+++ 1757+++
1754** define-inline provides a new way to define inlinable functions. 1758** define-inline provides a new way to define inlinable functions.
1755 1759
diff --git a/lisp/play/fortune.el b/lisp/play/fortune.el
index 25fa3f66ef1..4871c459023 100644
--- a/lisp/play/fortune.el
+++ b/lisp/play/fortune.el
@@ -303,6 +303,19 @@ specifies the file to choose the fortune from."
303 fortune-program-options) (list fort-file))))))) 303 fortune-program-options) (list fort-file)))))))
304 304
305;;;###autoload 305;;;###autoload
306(defun fortune-message (&optional file)
307 "Display a fortune cookie to the mini-buffer.
308If called with a prefix, it has the same behavior as `fortune'.
309Optional FILE is a fortune file from which a cookie will be selected."
310 (interactive (list (if current-prefix-arg
311 (fortune-ask-file)
312 fortune-file)))
313 (with-temp-buffer
314 (let ((fortune-buffer-name (current-buffer)))
315 (fortune-in-buffer t file)
316 (message "%s" (buffer-string)))))
317
318;;;###autoload
306(defun fortune (&optional file) 319(defun fortune (&optional file)
307 "Display a fortune cookie. 320 "Display a fortune cookie.
308If called with a prefix asks for the FILE to choose the fortune from, 321If called with a prefix asks for the FILE to choose the fortune from,