[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 338f78a: Add a fortune-message command
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] master 338f78a: Add a fortune-message command |
Date: |
Wed, 24 Feb 2016 04:43:22 +0000 |
branch: master
commit 338f78ad6aa84583baa617591dbce1aa1caca4da
Author: Joshua Datko <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>
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
---
etc/NEWS | 4 ++++
lisp/play/fortune.el | 13 +++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 679532b..18810ea 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1750,6 +1750,10 @@ details.
It should be placed right where the docstring would be, and FORM is then
evaluated (and should return a string) when the closure is built.
+---
+** The new command `fortune-message' has been added, which displays
+fortunes in the echo area.
+
+++
** define-inline provides a new way to define inlinable functions.
diff --git a/lisp/play/fortune.el b/lisp/play/fortune.el
index 25fa3f6..4871c45 100644
--- a/lisp/play/fortune.el
+++ b/lisp/play/fortune.el
@@ -303,6 +303,19 @@ specifies the file to choose the fortune from."
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.
If called with a prefix asks for the FILE to choose the fortune from,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 338f78a: Add a fortune-message command,
Lars Ingebrigtsen <=