Mercurial > emacs
annotate lisp/gnus/gnus-undo.el @ 20892:18f3cb26243f before-miles-orphaned-changes gcc-2_8_1-980401 gcc-2_8_1-980407 gcc-2_8_1-980412 gcc-2_8_1-980413 gcc-2_8_1-RELEASE gcc_2_8_1-980315 libc-980214 libc-980215 libc-980216 libc-980217 libc-980218 libc-980219 libc-980220 libc-980221 libc-980222 libc-980223 libc-980224 libc-980225 libc-980226 libc-980227 libc-980228 libc-980301 libc-980302 libc-980303 libc-980304 libc-980306 libc-980307 libc-980308 libc-980309 libc-980310 libc-980311 libc-980312 libc-980313 libc-980314 libc-980315 libc-980316 libc-980317 libc-980318 libc-980319 libc-980320 libc-980321 libc-980322 libc-980323 libc-980324 libc-980325 libc-980326 libc-980327 libc-980328 libc-980329 libc-980330 libc-980331 libc-980401 libc-980402 libc-980403 libc-980404 libc-980405 libc-980406 libc-980407 libc-980408 libc-980409 libc-980410 libc-980411 libc-980412 libc-980413 libc-980414 libc-980428 libc-980429 libc-980430 libc-980501 libc-980502 libc-980503 libc-980504 libc-980505 libc-980506 libc-980507 libc-980508 libc-980509 libc-980510 libc-980512 libc-980513 libc-980514 libc-980515 libc-980516 libc-980517 libc-980518 libc-980519 libc-980520 libc-980521 libc-980522 libc-980523 libc-980524 libc-980525 libc-980526 libc-980527 libc-980528 libc-980529 libc-980530 libc-980531 libc-980601 libc-980602 libc-980603 libc-980604 libc-980605 libc-980606 libc-980607 libc-980608 libc-980609 libc-980610 libc-980611 libc-980612 libc-980613
Add PentiumII (i786). Add '7' to all i[3456] entries.
Add AMD and Cyrix names for P5 and P6.
author | Richard Kenner <kenner@gnu.org> |
---|---|
date | Fri, 13 Feb 1998 12:16:46 +0000 |
parents | 5f1ab3dd344d |
children | 15fc6acbae7a |
rev | line source |
---|---|
17493 | 1 ;;; gnus-undo.el --- minor mode for undoing in Gnus |
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc. | |
3 | |
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no> | |
5 ;; Keywords: news | |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 ;;; Commentary: | |
25 | |
26 ;; This package allows arbitrary undoing in Gnus buffers. As all the | |
27 ;; Gnus buffers aren't very text-oriented (what is in the buffers is | |
28 ;; just some random representation of the actual data), normal Emacs | |
29 ;; undoing doesn't work at all for Gnus. | |
30 ;; | |
31 ;; This package works by letting Gnus register functions for reversing | |
32 ;; actions, and then calling these functions when the user pushes the | |
33 ;; `undo' key. As with normal `undo', there it is possible to set | |
34 ;; undo boundaries and so on. | |
35 ;; | |
36 ;; Internally, the undo sequence is represented by the | |
37 ;; `gnus-undo-actions' list, where each element is a list of functions | |
38 ;; to be called, in sequence, to undo some action. (An "action" is a | |
39 ;; collection of functions.) | |
40 ;; | |
41 ;; For instance, a function for killing a group will call | |
42 ;; `gnus-undo-register' with a function that un-kills the group. This | |
43 ;; package will put that function into an action. | |
44 | |
45 ;;; Code: | |
46 | |
19531
f5b98be7c142
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
47 (eval-when-compile (require 'cl)) |
f5b98be7c142
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
48 |
17493 | 49 (require 'gnus-util) |
50 (require 'gnus) | |
51 | |
52 (defvar gnus-undo-mode nil | |
53 "Minor mode for undoing in Gnus buffers.") | |
54 | |
55 (defvar gnus-undo-mode-hook nil | |
56 "Hook called in all `gnus-undo-mode' buffers.") | |
57 | |
58 ;;; Internal variables. | |
59 | |
60 (defvar gnus-undo-actions nil) | |
61 (defvar gnus-undo-boundary t) | |
62 (defvar gnus-undo-last nil) | |
63 (defvar gnus-undo-boundary-inhibit nil) | |
64 | |
65 ;;; Minor mode definition. | |
66 | |
67 (defvar gnus-undo-mode-map nil) | |
68 | |
69 (unless gnus-undo-mode-map | |
70 (setq gnus-undo-mode-map (make-sparse-keymap)) | |
71 | |
72 (gnus-define-keys gnus-undo-mode-map | |
73 "\M-\C-_" gnus-undo | |
74 "\C-_" gnus-undo | |
75 "\C-xu" gnus-undo | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
76 ;; many people are used to type `C-/' on X terminals and get `C-_'. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
77 [(control /)] gnus-undo)) |
17493 | 78 |
79 (defun gnus-undo-make-menu-bar () | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
80 ;; This is disabled for the time being. |
17493 | 81 (when nil |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
82 (define-key-after (current-local-map) [menu-bar file gnus-undo] |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
83 (cons "Undo" 'gnus-undo-actions) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
84 [menu-bar file whatever]))) |
17493 | 85 |
86 (defun gnus-undo-mode (&optional arg) | |
87 "Minor mode for providing `undo' in Gnus buffers. | |
88 | |
89 \\{gnus-undo-mode-map}" | |
90 (interactive "P") | |
91 (set (make-local-variable 'gnus-undo-mode) | |
92 (if (null arg) (not gnus-undo-mode) | |
93 (> (prefix-numeric-value arg) 0))) | |
94 (set (make-local-variable 'gnus-undo-actions) nil) | |
95 (set (make-local-variable 'gnus-undo-boundary) t) | |
96 (when gnus-undo-mode | |
97 ;; Set up the menu. | |
98 (when (gnus-visual-p 'undo-menu 'menu) | |
99 (gnus-undo-make-menu-bar)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
100 (gnus-add-minor-mode 'gnus-undo-mode "" gnus-undo-mode-map) |
17493 | 101 (make-local-hook 'post-command-hook) |
102 (add-hook 'post-command-hook 'gnus-undo-boundary nil t) | |
103 (run-hooks 'gnus-undo-mode-hook))) | |
104 | |
105 ;;; Interface functions. | |
106 | |
107 (defun gnus-disable-undo (&optional buffer) | |
108 "Disable undoing in the current buffer." | |
109 (interactive) | |
110 (save-excursion | |
111 (when buffer | |
112 (set-buffer buffer)) | |
113 (gnus-undo-mode -1))) | |
114 | |
115 (defun gnus-undo-boundary () | |
116 "Set Gnus undo boundary." | |
117 (if gnus-undo-boundary-inhibit | |
118 (setq gnus-undo-boundary-inhibit nil) | |
119 (setq gnus-undo-boundary t))) | |
120 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
121 (defun gnus-undo-force-boundary () |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
122 "Set Gnus undo boundary." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
123 (setq gnus-undo-boundary-inhibit nil |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
124 gnus-undo-boundary t)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19531
diff
changeset
|
125 |
17493 | 126 (defun gnus-undo-register (form) |
127 "Register FORMS as something to be performed to undo a change. | |
128 FORMS may use backtick quote syntax." | |
129 (when gnus-undo-mode | |
130 (gnus-undo-register-1 | |
131 `(lambda () | |
132 ,form)))) | |
133 | |
134 (put 'gnus-undo-register 'lisp-indent-function 0) | |
135 (put 'gnus-undo-register 'edebug-form-spec '(body)) | |
136 | |
137 (defun gnus-undo-register-1 (function) | |
138 "Register FUNCTION as something to be performed to undo a change." | |
139 (when gnus-undo-mode | |
140 (cond | |
141 ;; We are on a boundary, so we create a new action. | |
142 (gnus-undo-boundary | |
143 (push (list function) gnus-undo-actions) | |
144 (setq gnus-undo-boundary nil)) | |
145 ;; Prepend the function to an old action. | |
146 (gnus-undo-actions | |
147 (setcar gnus-undo-actions (cons function (car gnus-undo-actions)))) | |
148 ;; Initialize list. | |
149 (t | |
150 (setq gnus-undo-actions (list (list function))))) | |
151 (setq gnus-undo-boundary-inhibit t))) | |
152 | |
153 (defun gnus-undo (n) | |
154 "Undo some previous changes in Gnus buffers. | |
155 Repeat this command to undo more changes. | |
156 A numeric argument serves as a repeat count." | |
157 (interactive "p") | |
158 (unless gnus-undo-mode | |
159 (error "Undoing is not enabled in this buffer")) | |
160 (message "%s" last-command) | |
161 (when (or (not (eq last-command 'gnus-undo)) | |
162 (not gnus-undo-last)) | |
163 (setq gnus-undo-last gnus-undo-actions)) | |
164 (let ((action (pop gnus-undo-last))) | |
165 (unless action | |
166 (error "Nothing further to undo")) | |
167 (setq gnus-undo-actions (delq action gnus-undo-actions)) | |
168 (setq gnus-undo-boundary t) | |
169 (while action | |
170 (funcall (pop action))))) | |
171 | |
172 (provide 'gnus-undo) | |
173 | |
174 ;;; gnus-undo.el ends here |