annotate lisp/play/fortune.el @ 98269:c4f6098c0914

Justin Bogner <mail at justinbogner.com> (tiny change) (fortune-program-options): Change to a list. (fortune-in-buffer): Use apply.
author Glenn Morris <rgm@gnu.org>
date Sat, 20 Sep 2008 20:57:36 +0000
parents 949bd6ad1ba4
children 7aacb688e121
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38425
c6e12c6b1498 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38397
diff changeset
1 ;;; fortune.el --- use fortune to create signatures
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
2
64701
34bd8e434dd7 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
3 ;; Copyright (C) 1999, 2001, 2002, 2003, 2004,
79716
54006a859bcc Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78227
diff changeset
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Author: Holger Schauer <Holger.Schauer@gmx.de>
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Keywords: games utils mail
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
38425
c6e12c6b1498 Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 38397
diff changeset
9 ;; This file is part of GNU Emacs.
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
94675
949bd6ad1ba4 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94675
949bd6ad1ba4 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
949bd6ad1ba4 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; (at your option) any later version.
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94675
949bd6ad1ba4 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;;; Commentary:
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; This utility allows you to automatically cut regions to a fortune
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;; file. In case that the region stems from an article buffer (mail or
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; news), it will try to automatically determine the author of the
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; fortune. It will also allow you to compile your fortune-database
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; as well as providing a function to extract a fortune for use as your
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; signature.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; Of course, it can simply display a fortune, too.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; Use prefix arguments to specify different fortune databases.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;;; Installation:
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
36 ;; Please check the customize settings -- you will at least have to
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
37 ;; modify the values of `fortune-dir' and `fortune-file'.
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; I then use this in my .gnus:
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;;(message "Making new signature: %s" (fortune-to-signature "~/fortunes/"))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; This automagically creates a new signature when starting up Gnus.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; Note that the call to fortune-to-signature specifies a directory in which
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; several fortune-files and their databases are stored.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; If you like to get a new signature for every message, you can also hook
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; it into message-mode:
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
47 ;; (add-hook 'message-setup-hook 'fortune-to-signature)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; This time no fortune-file is specified, so fortune-to-signature would use
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; the default-file as specified by fortune-file.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; I have also this in my .gnus:
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;;(add-hook 'gnus-article-mode-hook
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;; '(lambda ()
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;; (define-key gnus-article-mode-map "i" 'fortune-from-region)))
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
55 ;; which allows marking a region and then pressing "i" so that the marked
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; region will be automatically added to my favourite fortune-file.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;;; Code:
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;;; **************
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;;; Customizable Settings
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (defgroup fortune nil
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 "Settings for fortune."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
64 :link '(emacs-commentary-link "fortune.el")
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
65 :version "21.1"
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 :group 'games)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 (defgroup fortune-signature nil
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 "Settings for use of fortune for signatures."
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
69 :group 'fortune
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 :group 'mail)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 (defcustom fortune-dir "~/docs/ascii/misc/fortunes/"
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 "*The directory to look in for local fortune cookies files."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
74 :type 'directory
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
75 :group 'fortune)
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
76 (defcustom fortune-file
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
77 (expand-file-name "usenet" fortune-dir)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 "*The file in which local fortune cookies will be stored."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
79 :type 'file
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
80 :group 'fortune)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (defcustom fortune-database-extension ".dat"
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
82 "The extension of the corresponding fortune database.
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 Normally you won't have a reason to change it."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
84 :type 'string
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
85 :group 'fortune)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (defcustom fortune-program "fortune"
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 "Program to select a fortune cookie."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
88 :type 'string
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
89 :group 'fortune)
98269
c4f6098c0914 Justin Bogner <mail at justinbogner.com> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 94675
diff changeset
90 (defcustom fortune-program-options ()
c4f6098c0914 Justin Bogner <mail at justinbogner.com> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 94675
diff changeset
91 "Options to pass to the fortune program."
c4f6098c0914 Justin Bogner <mail at justinbogner.com> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 94675
diff changeset
92 :type '(repeat string)
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
93 :group 'fortune)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 (defcustom fortune-strfile "strfile"
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 "Program to compute a new fortune database."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
96 :type 'string
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
97 :group 'fortune)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (defcustom fortune-strfile-options ""
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
99 "Options to pass to the strfile program (a string)."
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
100 :type 'string
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
101 :group 'fortune)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (defcustom fortune-quiet-strfile-options "> /dev/null"
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 "Text added to the command for running `strfile'.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 By default it discards the output produced by `strfile'.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 Set this to \"\" if you would like to see the output."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
106 :type 'string
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
107 :group 'fortune)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (defcustom fortune-always-compile t
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 "*Non-nil means automatically compile fortune files.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 If nil, you must invoke `fortune-compile' manually to do that."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
112 :type 'boolean
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
113 :group 'fortune)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (defcustom fortune-author-line-prefix " -- "
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 "Prefix to put before the author name of a fortunate."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
116 :type 'string
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
117 :group 'fortune-signature)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (defcustom fortune-fill-column fill-column
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 "Fill column for fortune files."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
120 :type 'integer
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
121 :group 'fortune-signature)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 (defcustom fortune-from-mail "private e-mail"
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 "String to use to characterize that the fortune comes from an e-mail.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 No need to add an `in'."
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 :type 'string
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 :group 'fortune-signature)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (defcustom fortune-sigstart ""
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 "*Some text to insert before the fortune cookie, in a mail signature."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
129 :type 'string
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
130 :group 'fortune-signature)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (defcustom fortune-sigend ""
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 "*Some text to insert after the fortune cookie, in a mail signature."
38524
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
133 :type 'string
2d351e49dc96 Undo change of 2001-07-13.
Gerd Moellmann <gerd@gnu.org>
parents: 38425
diff changeset
134 :group 'fortune-signature)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 ;; not customizable settings
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (defvar fortune-buffer-name "*fortune*")
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
139 (defconst fortune-end-sep "\n%\n")
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 ;;; **************
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 ;;; Inserting a new fortune
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (defun fortune-append (string &optional interactive file)
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
145 "Appends STRING to the fortune FILE.
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 If INTERACTIVE is non-nil, don't compile the fortune file afterwards."
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
148 (setq file (expand-file-name
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 (substitute-in-file-name (or file fortune-file))))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 (if (file-directory-p file)
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
151 (error "Cannot append fortune to directory %s" file))
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 (if interactive ; switch to file and return buffer
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 (find-file-other-frame file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (find-file-noselect file))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (let ((fortune-buffer (get-file-buffer file)))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (set-buffer fortune-buffer)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 (goto-char (point-max))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (setq fill-column fortune-fill-column)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (setq auto-fill-inhibit-regexp "^%")
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (turn-on-auto-fill)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 (insert string fortune-end-sep)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (unless interactive
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (save-buffer)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 (if fortune-always-compile
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (fortune-compile file)))))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (defun fortune-ask-file ()
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 "Asks the user for a file-name."
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
170 (expand-file-name
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 (read-file-name
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 "Fortune file to use: "
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 fortune-dir nil nil "")))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174
37426
71d360920aad Fix autoload cookies.
Gerd Moellmann <gerd@gnu.org>
parents: 30860
diff changeset
175 ;;;###autoload
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 (defun fortune-add-fortune (string file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 "Add STRING to a fortune file FILE.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 Interactively, if called with a prefix argument,
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 read the file name to use. Otherwise use the value of `fortune-file'."
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 (interactive
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 (list (read-string "Fortune: ")
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 (if current-prefix-arg (fortune-ask-file))))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 (fortune-append string t file))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185
37426
71d360920aad Fix autoload cookies.
Gerd Moellmann <gerd@gnu.org>
parents: 30860
diff changeset
186 ;;;###autoload
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (defun fortune-from-region (beg end file)
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
188 "Append the current region to a local fortune-like data file.
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 Interactively, if called with a prefix argument,
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 read the file name to use. Otherwise use the value of `fortune-file'."
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
192 (interactive
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 (list (region-beginning) (region-end)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (if current-prefix-arg (fortune-ask-file))))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 (let ((string (buffer-substring beg end))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 author newsgroup help-point)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 ;; try to determine author ...
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (save-excursion
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 (goto-char (point-min))
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
200 (setq help-point
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 (search-forward-regexp
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 "^From: \\(.*\\)$"
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 (point-max) t))
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
204 (if help-point
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
205 (setq author (buffer-substring (match-beginning 1) help-point))
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 (setq author "An unknown author")))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 ;; ... and newsgroup
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 (save-excursion
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 (goto-char (point-min))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 (setq help-point
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 (search-forward-regexp
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 "^Newsgroups: \\(.*\\)$"
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 (point-max) t))
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
214 (if help-point
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 (setq newsgroup (buffer-substring (match-beginning 1) help-point))
37428
6586c75e5eda (fortune-from-region): Use `eq' instead of `eql'.
Gerd Moellmann <gerd@gnu.org>
parents: 37426
diff changeset
216 (setq newsgroup (if (or (eq major-mode 'gnus-article-mode)
6586c75e5eda (fortune-from-region): Use `eq' instead of `eql'.
Gerd Moellmann <gerd@gnu.org>
parents: 37426
diff changeset
217 (eq major-mode 'vm-mode)
6586c75e5eda (fortune-from-region): Use `eq' instead of `eql'.
Gerd Moellmann <gerd@gnu.org>
parents: 37426
diff changeset
218 (eq major-mode 'rmail-mode))
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 fortune-from-mail
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 "unknown"))))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 ;; append entry to end of fortune file, and display result
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 (setq string (concat "\"" string "\""
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 "\n"
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 fortune-author-line-prefix
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 author " in " newsgroup))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 (fortune-append string t file)))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 ;;; **************
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 ;;; Compile new database with strfile
37426
71d360920aad Fix autoload cookies.
Gerd Moellmann <gerd@gnu.org>
parents: 30860
diff changeset
232 ;;;###autoload
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 (defun fortune-compile (&optional file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 "Compile fortune file.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 If called with a prefix asks for the FILE to compile, otherwise uses
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 the value of `fortune-file'. This currently cannot handle directories."
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
238 (interactive
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 (list
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 (if current-prefix-arg
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 (fortune-ask-file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 fortune-file)))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 (let* ((fortune-file (expand-file-name (substitute-in-file-name file)))
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
244 (fortune-dat (expand-file-name
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 (substitute-in-file-name
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 (concat fortune-file fortune-database-extension)))))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 (cond ((file-exists-p fortune-file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 (if (file-exists-p fortune-dat)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 (cond ((file-newer-than-file-p fortune-file fortune-dat)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 (message "Compiling new fortune database %s" fortune-dat)
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
251 (shell-command
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 (concat fortune-strfile fortune-strfile-options
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 " " fortune-file fortune-quiet-strfile-options))))))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 (t (error "Can't compile fortune file %s" fortune-file)))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38524
diff changeset
255
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38524
diff changeset
256
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 ;;; **************
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 ;;; Use fortune for signature
37426
71d360920aad Fix autoload cookies.
Gerd Moellmann <gerd@gnu.org>
parents: 30860
diff changeset
259 ;;;###autoload
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 (defun fortune-to-signature (&optional file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 "Create signature from output of the fortune program.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 If called with a prefix asks for the FILE to choose the fortune from,
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 otherwise uses the value of `fortune-file'. If you want to have fortune
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 choose from a set of files in a directory, call interactively with prefix
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 and choose the directory as the fortune-file."
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
267 (interactive
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 (list
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 (if current-prefix-arg
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 (fortune-ask-file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 fortune-file)))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 (save-excursion
57825
627816ec9a05 (fortune-to-signature): Don't use interactive-p.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
273 (fortune-in-buffer t file)
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 (set-buffer fortune-buffer-name)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 (let* ((fortune (buffer-string))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 (signature (concat fortune-sigstart fortune fortune-sigend)))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 (setq mail-signature signature)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 (if (boundp 'message-signature)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 (setq message-signature signature)))))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 ;;; **************
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 ;;; Display fortune
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 (defun fortune-in-buffer (interactive &optional file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 "Put a fortune cookie in the *fortune* buffer.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286
57825
627816ec9a05 (fortune-to-signature): Don't use interactive-p.
Richard M. Stallman <rms@gnu.org>
parents: 52401
diff changeset
287 INTERACTIVE is ignored. Optional argument FILE,
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 when supplied, specifies the file to choose the fortune from."
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (let ((fortune-buffer (or (get-buffer fortune-buffer-name)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (generate-new-buffer fortune-buffer-name)))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 (fort-file (expand-file-name
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (substitute-in-file-name
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 (or file fortune-file)))))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (save-excursion
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (set-buffer fortune-buffer)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 (toggle-read-only 0)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 (erase-buffer)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 (if fortune-always-compile
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 (fortune-compile fort-file))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301
98269
c4f6098c0914 Justin Bogner <mail at justinbogner.com> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 94675
diff changeset
302 (apply 'call-process
c4f6098c0914 Justin Bogner <mail at justinbogner.com> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 94675
diff changeset
303 fortune-program ;; program to call
c4f6098c0914 Justin Bogner <mail at justinbogner.com> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 94675
diff changeset
304 nil fortune-buffer nil ;; INFILE BUFFER DISPLAYP
c4f6098c0914 Justin Bogner <mail at justinbogner.com> (tiny change)
Glenn Morris <rgm@gnu.org>
parents: 94675
diff changeset
305 fort-file fortune-program-options))))
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306
37426
71d360920aad Fix autoload cookies.
Gerd Moellmann <gerd@gnu.org>
parents: 30860
diff changeset
307 ;;;###autoload
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 (defun fortune (&optional file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 "Display a fortune cookie.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 If called with a prefix asks for the FILE to choose the fortune from,
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 otherwise uses the value of `fortune-file'. If you want to have fortune
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 choose from a set of files in a directory, call interactively with prefix
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 and choose the directory as the fortune-file."
30860
d0e5a99cbda1 (fortune) <defgroup>: Add :version.
Dave Love <fx@gnu.org>
parents: 25480
diff changeset
315 (interactive
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 (list
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (if current-prefix-arg
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 (fortune-ask-file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 fortune-file)))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 (fortune-in-buffer t file)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 (switch-to-buffer (get-buffer fortune-buffer-name))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 (toggle-read-only 1))
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 ;;; Provide ourselves.
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 (provide 'fortune)
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 79716
diff changeset
328 ;; arch-tag: a1e4cb8a-3792-40e7-86a7-fc75ce094bcc
25480
f33ed9540026 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 ;;; fortune.el ends here