GNU bug report logs - #14915
[PATCH] Enhancement to fortune.el

Previous Next

Package: emacs;

Reported by: Joshua Datko <jbdatko <at> gmail.com>

Date: Sat, 20 Jul 2013 05:16:02 UTC

Severity: wishlist

Tags: fixed, patch

Fixed in version 26.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14915 in the body.
You can then email your comments to 14915 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14915; Package emacs. (Sat, 20 Jul 2013 05:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Joshua Datko <jbdatko <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 20 Jul 2013 05:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Joshua Datko <jbdatko <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Enhancement to fortune.el
Date: Fri, 19 Jul 2013 21:01:30 -0600
So, this is my first time submitting a patch.  I believe I followed the
CONTRIBUTE instructions and I built this to the latest source in bzr but
please let me know if I need to correct anything.

It's a small change, but I'm willing to sign a copyright assignment
(hopefully, it's not my last submission.)

-Josh


** Description

This is an enhancement to fortune.el to display fortunes in the
mini-buffer.  The original implementation generates fortunes and
displays them to the buffer *fortune* (this behavior did not change),
but it would change the focus to the *fortune* buffer as well.

Sometimes, I would just want to see my fortune but NOT switch over to
that buffer, hence this patch which adds an interactive function (and
small helper function) to display the fortune in the mini-buffer.

** Changelog

2013-07-20  Josh Datko  <jbdatko <at> gmail.com>

	* fortune.el: Added fortune-message which displays fortunes to the
	minibuffer.

** Patch

=== modified file 'lisp/play/fortune.el'
*** lisp/play/fortune.el	2013-02-15 01:30:11 +0000
--- lisp/play/fortune.el	2013-07-20 02:25:53 +0000
*************** specifies the file to choose the fortune
*** 302,307 ****
--- 302,325 ----
                             (split-string fortune-program-options)
                           fortune-program-options) (list fort-file)))))))

+ (defun fortune-generate (&optional file)
+   "Generate a new fortune and return it as a string.
+ Without an optional FILE argument it will use the value of `fortune-file'."
+   (save-excursion
+     (progn (fortune-in-buffer t file)
+            (with-current-buffer fortune-buffer-name
+              (buffer-string)))))
+
+ ;;;###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)))
+   (message (fortune-generate file)))
+
  ;;;###autoload
  (defun fortune (&optional file)
    "Display a fortune cookie.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14915; Package emacs. (Wed, 24 Feb 2016 04:44:01 GMT) Full text and rfc822 format available.

Message #8 received at 14915 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Joshua Datko <jbdatko <at> gmail.com>
Cc: 14915 <at> debbugs.gnu.org
Subject: Re: bug#14915: [PATCH] Enhancement to fortune.el
Date: Wed, 24 Feb 2016 15:42:59 +1100
Joshua Datko <jbdatko <at> gmail.com> writes:

> This is an enhancement to fortune.el to display fortunes in the
> mini-buffer.  The original implementation generates fortunes and
> displays them to the buffer *fortune* (this behavior did not change),
> but it would change the focus to the *fortune* buffer as well.
>
> Sometimes, I would just want to see my fortune but NOT switch over to
> that buffer, hence this patch which adds an interactive function (and
> small helper function) to display the fortune in the mini-buffer.

Thanks for the patch.  I installed a variant of it on the Emacs trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 24 Feb 2016 04:44:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.2, send any further explanations to 14915 <at> debbugs.gnu.org and Joshua Datko <jbdatko <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 24 Feb 2016 04:44:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 23 Mar 2016 11:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:04 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 26.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:04 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 25.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 01 Jan 2017 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 228 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.