Mercurial > emacs
annotate lisp/play/bruce.el @ 107087:392cb4c24760
Fix up various corner case problems.
* doc-view.el (doc-view-last-page-number): New function.
(doc-view-mode, doc-view-last-page, doc-view-goto-page): Use it.
(doc-view-goto-page): Avoid inf-loops when the conversion fails.
(doc-view-kill-proc): Avoid inf-loop in freak cases.
(doc-view-reconvert-doc): Use the new recursive delete-directory.
(doc-view-convert-current-doc): Don't create the resolution.el file
here any more.
(doc-view-pdf/ps->png): Do it here instead.
(doc-view-already-converted-p): Check that resolution.el is present.
(doc-view-pdf->png): Don't rely on doc-view-pdf/ps->png for the few
windows that are not yet showing images.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 04 Feb 2010 20:53:40 -0500 |
parents | 1d1d5d9bd884 |
children | 376148b31b5e |
rev | line source |
---|---|
47726
33d53d287ee4
Add "no-byte-compile: t" in first line.
Juanma Barranquero <lekktu@gmail.com>
parents:
42041
diff
changeset
|
1 ;;; bruce.el --- bruce phrase utility for overloading the Communications -*- no-byte-compile: t -*- |
20323 | 2 ;;; Decency Act snoops, if any. |
3 | |
74509 | 4 ;; Copyright (C) 1988, 1993, 1997, 2001, 2002, 2003, 2004, |
106815 | 5 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
20323 | 6 |
7 ;; Maintainer: FSF | |
8 ;; Keywords: games | |
9 ;; Created: Jan 1997 | |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
94675
949bd6ad1ba4
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
20323 | 14 ;; 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
|
15 ;; 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
|
16 ;; (at your option) any later version. |
20323 | 17 |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; 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
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
20323 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;; This program was written to protest the miss-named "Communications | |
29 ;; Decency Act of 1996. This Act bans "indecent speech", whatever that is, | |
42041 | 30 ;; from the Internet. For more on the CDA, see Richard Stallman's essay on |
20323 | 31 ;; censorship, included in the etc directory of emacs distributions 19.34 |
32 ;; and up. See also http://www.eff.org/blueribbon.html. | |
33 | |
34 ;; For many years, emacs has included a program called Spook. This program | |
35 ;; adds a series of "keywords" to email just before it goes out. On the | |
36 ;; theory that the NSA monitors people's email, the keywords would be | |
37 ;; picked up by the NSA's snoop computers, causing them to waste time | |
38 ;; reading your meeting schedule notices or other email boring to everyone | |
39 ;; but you and (you hope) the recipient. See below (I left in the original | |
40 ;; writeup when I made this conversion), or the emacs documentation at | |
41 ;; ftp://prep.ai.mit.edu/pub/gnu/emacs-manual*. | |
42 | |
43 ;; Bruce is a direct copy of spook, with the word "spook" replaced with | |
44 ;; the word "bruce". Thanks to "esr", whoever he, she or it may be, this | |
45 ;; conversion was an extremely easy piece of editing, suitable for a first | |
46 ;; essay at elisp programming. | |
47 | |
48 ;; You may think of the name as having been derived from a certain Monty | |
49 ;; Python routine. Or from Lenny Bruce, who opposed censorship in his own | |
50 ;; inimitable way. Bruce does exactly what Spook does: it throws keywords | |
51 ;; into your email messages or other documents. | |
52 | |
53 ;; However, in order to comply with the CDA as interpreted by Richard | |
54 ;; Stallman (see the essay on censorship), bruce is distributed without a | |
55 ;; data file from which to select words at random. Sorry about that. I | |
56 ;; believe the average user will be able to come up with a few words on | |
57 ;; his or her own. If that is a problem, feel free to ask any American | |
42041 | 58 ;; teenager, preferably one who attends a government school. Failing |
20323 | 59 ;; that, you might write to Mr. Clinton or Ms Reno or their successors and |
60 ;; ask them for suggestions. Think of it as a public spirited act: the | |
61 ;; time they spend answering you is time not spent persecuting someone | |
62 ;; else. However, do ask them to respond by snail mail, where their | |
63 ;; suggestions would be legal. | |
64 | |
65 ;; To build the data file, just start a file called bruce.lines in the etc | |
66 ;; directory of your emacs distribution. Note that each phrase or word has | |
67 ;; to be followed by an ascii 0, control-@. See the file spook.lines in | |
68 ;; the etc directory for an example. In emacs, use c-q c-@ to insert the | |
69 ;; ascii 0s. | |
70 | |
71 ;; Once you have edited up a data file, you have to tell emacs how to find | |
42041 | 72 ;; the program bruce. Add the following two lines to your .emacs file. Be |
20323 | 73 ;; sure to uncomment the second line. |
74 | |
75 ;; for bruce mode | |
76 ;; (autoload 'bruce "bruce" "Use the Bruce program to protest the CDA" t) | |
77 | |
78 ;; Shut down emacs and fire it up again. Then "M-x bruce" should put some | |
79 ;; shocking words in the current buffer. | |
80 | |
81 | |
82 ;; Please note that I am not suggesting that you actually use this program | |
83 ;; to add "illegal" words to your email, or any other purpose. First, you | |
84 ;; don't really need a program to do it, and second, it would be illegal | |
85 ;; for me to suggest or advise that you actually break the law. This | |
86 ;; program was written as a demonstration only, and as an act of political | |
87 ;; protest and free expression protected by the First Amendment, or | |
88 ;; whatever is left of it. | |
89 | |
90 | |
91 ;; We now return to the original writeup for spook: | |
92 | |
93 ;; Steve Strassmann <straz@media-lab.media.mit.edu> didn't write the | |
94 ;; program spook, from which this was adapted, and even if he did, he | |
95 ;; really didn't mean for you to use it in an anarchistic way. | |
96 ;; | |
97 ;; To use this: | |
98 ;; Just before sending mail, do M-x spook. | |
99 ;; A number of phrases will be inserted into your buffer, to help | |
100 ;; give your message that extra bit of attractiveness for automated | |
101 ;; keyword scanners. Help defeat the NSA trunk trawler! | |
102 | |
103 ;;; Code: | |
104 | |
105 (require 'cookie1) | |
106 | |
107 ; Variables | |
21363 | 108 (defgroup bruce nil |
109 "Insert phrases selected at random from a file into a buffer." | |
110 :prefix "bruce-" | |
111 :group 'games) | |
20323 | 112 |
21363 | 113 (defcustom bruce-phrases-file "~/bruce.lines" |
42041 | 114 "Keep your favourite phrases here." |
21363 | 115 :type 'file |
116 :group 'bruce) | |
117 | |
118 (defcustom bruce-phrase-default-count 15 | |
119 "Default number of phrases to insert." | |
120 :type 'integer | |
121 :group 'bruce) | |
20323 | 122 |
123 ;;;###autoload | |
124 (defun bruce () | |
125 "Adds that special touch of class to your outgoing mail." | |
126 (interactive) | |
127 (or (file-exists-p bruce-phrases-file) | |
128 (error "You need to create %s" bruce-phrases-file)) | |
129 (cookie-insert bruce-phrases-file | |
130 bruce-phrase-default-count | |
131 "Checking authorization..." | |
132 "Checking authorization...Approved")) | |
133 | |
134 ;;;###autoload | |
135 (defun snarf-bruces () | |
136 "Return a vector containing the lines from `bruce-phrases-file'." | |
137 (or (file-exists-p bruce-phrases-file) | |
138 (error "You need to create %s" bruce-phrases-file)) | |
139 (cookie-snarf bruce-phrases-file | |
140 "Checking authorization..." | |
141 "Checking authorization...Approved")) | |
142 | |
143 ;; Note: the implementation that used to take up most of this file has been | |
144 ;; cleaned up, generalized, gratuitously broken by esr, and now resides in | |
145 ;; cookie1.el. | |
146 | |
48341
595c4a350a47
Add provide call.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47726
diff
changeset
|
147 (provide 'bruce) |
595c4a350a47
Add provide call.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
47726
diff
changeset
|
148 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
79716
diff
changeset
|
149 ;; arch-tag: b83ded51-4ccb-41ef-8bd6-3b521e81dd9b |
20323 | 150 ;;; bruce.el ends here |