Mercurial > emacs
annotate lisp/gnus/gnus-util.el @ 32604:c8b8e93bf2fd
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Wed, 18 Oct 2000 08:52:23 +0000 |
parents | 51cea22fd2aa |
children | 86023b6d3cad |
rev | line source |
---|---|
17493 | 1 ;;; gnus-util.el --- utility functions for Gnus |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3 ;; Free Software Foundation, Inc. |
17493 | 4 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 6 ;; Keywords: news |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;; Nothing in this file depends on any other parts of Gnus -- all | |
28 ;; functions and macros in this file are utility functions that are | |
29 ;; used by Gnus and may be used by any other package without loading | |
30 ;; Gnus first. | |
31 | |
32 ;;; Code: | |
33 | |
34 (require 'custom) | |
19523
6713d6efcfde
Require cl only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
35 (eval-when-compile (require 'cl)) |
17493 | 36 (require 'nnheader) |
37 (require 'message) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
38 (require 'time-date) |
17493 | 39 |
40 (eval-and-compile | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
41 (autoload 'rmail-insert-rmail-file-header "rmail") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
42 (autoload 'rmail-count-new-messages "rmail") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
43 (autoload 'rmail-show-message "rmail")) |
17493 | 44 |
45 (defun gnus-boundp (variable) | |
46 "Return non-nil if VARIABLE is bound and non-nil." | |
47 (and (boundp variable) | |
48 (symbol-value variable))) | |
49 | |
50 (defmacro gnus-eval-in-buffer-window (buffer &rest forms) | |
51 "Pop to BUFFER, evaluate FORMS, and then return to the original window." | |
52 (let ((tempvar (make-symbol "GnusStartBufferWindow")) | |
53 (w (make-symbol "w")) | |
54 (buf (make-symbol "buf"))) | |
55 `(let* ((,tempvar (selected-window)) | |
56 (,buf ,buffer) | |
57 (,w (get-buffer-window ,buf 'visible))) | |
58 (unwind-protect | |
59 (progn | |
60 (if ,w | |
61 (progn | |
62 (select-window ,w) | |
63 (set-buffer (window-buffer ,w))) | |
64 (pop-to-buffer ,buf)) | |
65 ,@forms) | |
66 (select-window ,tempvar))))) | |
67 | |
68 (put 'gnus-eval-in-buffer-window 'lisp-indent-function 1) | |
69 (put 'gnus-eval-in-buffer-window 'edebug-form-spec '(form body)) | |
70 | |
71 (defmacro gnus-intern-safe (string hashtable) | |
72 "Set hash value. Arguments are STRING, VALUE, and HASHTABLE." | |
73 `(let ((symbol (intern ,string ,hashtable))) | |
74 (or (boundp symbol) | |
75 (set symbol nil)) | |
76 symbol)) | |
77 | |
78 ;; Added by Geoffrey T. Dairiki <dairiki@u.washington.edu>. A safe way | |
79 ;; to limit the length of a string. This function is necessary since | |
80 ;; `(substr "abc" 0 30)' pukes with "Args out of range". | |
81 (defsubst gnus-limit-string (str width) | |
82 (if (> (length str) width) | |
83 (substring str 0 width) | |
84 str)) | |
85 | |
86 (defsubst gnus-functionp (form) | |
87 "Return non-nil if FORM is funcallable." | |
88 (or (and (symbolp form) (fboundp form)) | |
89 (and (listp form) (eq (car form) 'lambda)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
90 (byte-code-function-p form))) |
17493 | 91 |
92 (defsubst gnus-goto-char (point) | |
93 (and point (goto-char point))) | |
94 | |
95 (defmacro gnus-buffer-exists-p (buffer) | |
96 `(let ((buffer ,buffer)) | |
97 (when buffer | |
98 (funcall (if (stringp buffer) 'get-buffer 'buffer-name) | |
99 buffer)))) | |
100 | |
101 (defmacro gnus-kill-buffer (buffer) | |
102 `(let ((buf ,buffer)) | |
103 (when (gnus-buffer-exists-p buf) | |
104 (kill-buffer buf)))) | |
105 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
106 (defalias 'gnus-point-at-bol |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
107 (if (fboundp 'point-at-bol) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
108 'point-at-bol |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
109 'line-beginning-position)) |
17493 | 110 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
111 (defalias 'gnus-point-at-eol |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
112 (if (fboundp 'point-at-eol) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
113 'point-at-eol |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
114 'line-end-position)) |
17493 | 115 |
116 (defun gnus-delete-first (elt list) | |
117 "Delete by side effect the first occurrence of ELT as a member of LIST." | |
118 (if (equal (car list) elt) | |
119 (cdr list) | |
120 (let ((total list)) | |
121 (while (and (cdr list) | |
122 (not (equal (cadr list) elt))) | |
123 (setq list (cdr list))) | |
124 (when (cdr list) | |
125 (setcdr list (cddr list))) | |
126 total))) | |
127 | |
128 ;; Delete the current line (and the next N lines). | |
129 (defmacro gnus-delete-line (&optional n) | |
130 `(delete-region (progn (beginning-of-line) (point)) | |
131 (progn (forward-line ,(or n 1)) (point)))) | |
132 | |
133 (defun gnus-byte-code (func) | |
134 "Return a form that can be `eval'ed based on FUNC." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
135 (let ((fval (indirect-function func))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
136 (if (byte-code-function-p fval) |
17493 | 137 (let ((flist (append fval nil))) |
138 (setcar flist 'byte-code) | |
139 flist) | |
140 (cons 'progn (cddr fval))))) | |
141 | |
142 (defun gnus-extract-address-components (from) | |
143 (let (name address) | |
144 ;; First find the address - the thing with the @ in it. This may | |
145 ;; not be accurate in mail addresses, but does the trick most of | |
146 ;; the time in news messages. | |
147 (when (string-match "\\b[^@ \t<>]+[!@][^@ \t<>]+\\b" from) | |
148 (setq address (substring from (match-beginning 0) (match-end 0)))) | |
149 ;; Then we check whether the "name <address>" format is used. | |
150 (and address | |
151 ;; Linear white space is not required. | |
152 (string-match (concat "[ \t]*<" (regexp-quote address) ">") from) | |
153 (and (setq name (substring from 0 (match-beginning 0))) | |
154 ;; Strip any quotes from the name. | |
155 (string-match "\".*\"" name) | |
156 (setq name (substring name 1 (1- (match-end 0)))))) | |
157 ;; If not, then "address (name)" is used. | |
158 (or name | |
159 (and (string-match "(.+)" from) | |
160 (setq name (substring from (1+ (match-beginning 0)) | |
161 (1- (match-end 0))))) | |
162 (and (string-match "()" from) | |
163 (setq name address)) | |
164 ;; XOVER might not support folded From headers. | |
165 (and (string-match "(.*" from) | |
166 (setq name (substring from (1+ (match-beginning 0)) | |
167 (match-end 0))))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
168 (list (if (string= name "") nil name) (or address from)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
169 |
17493 | 170 |
171 (defun gnus-fetch-field (field) | |
172 "Return the value of the header FIELD of current article." | |
173 (save-excursion | |
174 (save-restriction | |
175 (let ((case-fold-search t) | |
176 (inhibit-point-motion-hooks t)) | |
177 (nnheader-narrow-to-headers) | |
178 (message-fetch-field field))))) | |
179 | |
180 (defun gnus-goto-colon () | |
181 (beginning-of-line) | |
182 (search-forward ":" (gnus-point-at-eol) t)) | |
183 | |
184 (defun gnus-remove-text-with-property (prop) | |
185 "Delete all text in the current buffer with text property PROP." | |
186 (save-excursion | |
187 (goto-char (point-min)) | |
188 (while (not (eobp)) | |
189 (while (get-text-property (point) prop) | |
190 (delete-char 1)) | |
191 (goto-char (next-single-property-change (point) prop nil (point-max)))))) | |
192 | |
193 (defun gnus-newsgroup-directory-form (newsgroup) | |
194 "Make hierarchical directory name from NEWSGROUP name." | |
195 (let ((newsgroup (gnus-newsgroup-savable-name newsgroup)) | |
196 (len (length newsgroup)) | |
197 idx) | |
198 ;; If this is a foreign group, we don't want to translate the | |
199 ;; entire name. | |
200 (if (setq idx (string-match ":" newsgroup)) | |
201 (aset newsgroup idx ?/) | |
202 (setq idx 0)) | |
203 ;; Replace all occurrences of `.' with `/'. | |
204 (while (< idx len) | |
205 (when (= (aref newsgroup idx) ?.) | |
206 (aset newsgroup idx ?/)) | |
207 (setq idx (1+ idx))) | |
208 newsgroup)) | |
209 | |
210 (defun gnus-newsgroup-savable-name (group) | |
211 ;; Replace any slashes in a group name (eg. an ange-ftp nndoc group) | |
212 ;; with dots. | |
213 (nnheader-replace-chars-in-string group ?/ ?.)) | |
214 | |
215 (defun gnus-string> (s1 s2) | |
216 (not (or (string< s1 s2) | |
217 (string= s1 s2)))) | |
218 | |
219 ;;; Time functions. | |
220 | |
221 (defun gnus-file-newer-than (file date) | |
222 (let ((fdate (nth 5 (file-attributes file)))) | |
223 (or (> (car fdate) (car date)) | |
224 (and (= (car fdate) (car date)) | |
225 (> (nth 1 fdate) (nth 1 date)))))) | |
226 | |
227 ;;; Keymap macros. | |
228 | |
229 (defmacro gnus-local-set-keys (&rest plist) | |
230 "Set the keys in PLIST in the current keymap." | |
231 `(gnus-define-keys-1 (current-local-map) ',plist)) | |
232 | |
233 (defmacro gnus-define-keys (keymap &rest plist) | |
234 "Define all keys in PLIST in KEYMAP." | |
235 `(gnus-define-keys-1 (quote ,keymap) (quote ,plist))) | |
236 | |
237 (defmacro gnus-define-keys-safe (keymap &rest plist) | |
238 "Define all keys in PLIST in KEYMAP without overwriting previous definitions." | |
239 `(gnus-define-keys-1 (quote ,keymap) (quote ,plist) t)) | |
240 | |
241 (put 'gnus-define-keys 'lisp-indent-function 1) | |
242 (put 'gnus-define-keys-safe 'lisp-indent-function 1) | |
243 (put 'gnus-local-set-keys 'lisp-indent-function 1) | |
244 | |
245 (defmacro gnus-define-keymap (keymap &rest plist) | |
246 "Define all keys in PLIST in KEYMAP." | |
247 `(gnus-define-keys-1 ,keymap (quote ,plist))) | |
248 | |
249 (put 'gnus-define-keymap 'lisp-indent-function 1) | |
250 | |
251 (defun gnus-define-keys-1 (keymap plist &optional safe) | |
252 (when (null keymap) | |
253 (error "Can't set keys in a null keymap")) | |
254 (cond ((symbolp keymap) | |
255 (setq keymap (symbol-value keymap))) | |
256 ((keymapp keymap)) | |
257 ((listp keymap) | |
258 (set (car keymap) nil) | |
259 (define-prefix-command (car keymap)) | |
260 (define-key (symbol-value (caddr keymap)) (cadr keymap) (car keymap)) | |
261 (setq keymap (symbol-value (car keymap))))) | |
262 (let (key) | |
263 (while plist | |
264 (when (symbolp (setq key (pop plist))) | |
265 (setq key (symbol-value key))) | |
266 (if (or (not safe) | |
267 (eq (lookup-key keymap key) 'undefined)) | |
268 (define-key keymap key (pop plist)) | |
269 (pop plist))))) | |
270 | |
271 (defun gnus-completing-read (default prompt &rest args) | |
272 ;; Like `completing-read', except that DEFAULT is the default argument. | |
273 (let* ((prompt (if default | |
274 (concat prompt " (default " default ") ") | |
275 (concat prompt " "))) | |
276 (answer (apply 'completing-read prompt args))) | |
277 (if (or (null answer) (zerop (length answer))) | |
278 default | |
279 answer))) | |
280 | |
281 ;; Two silly functions to ensure that all `y-or-n-p' questions clear | |
282 ;; the echo area. | |
283 (defun gnus-y-or-n-p (prompt) | |
284 (prog1 | |
285 (y-or-n-p prompt) | |
286 (message ""))) | |
287 | |
288 (defun gnus-yes-or-no-p (prompt) | |
289 (prog1 | |
290 (yes-or-no-p prompt) | |
291 (message ""))) | |
292 | |
293 (defun gnus-dd-mmm (messy-date) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
294 "Return a string like DD-MMM from a big messy string." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
295 (condition-case () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
296 (format-time-string "%d-%b" (safe-date-to-time messy-date)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
297 (error " - "))) |
17493 | 298 |
299 (defmacro gnus-date-get-time (date) | |
300 "Convert DATE string to Emacs time. | |
301 Cache the result as a text property stored in DATE." | |
302 ;; Either return the cached value... | |
303 `(let ((d ,date)) | |
304 (if (equal "" d) | |
305 '(0 0) | |
306 (or (get-text-property 0 'gnus-time d) | |
307 ;; or compute the value... | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
308 (let ((time (safe-date-to-time d))) |
17493 | 309 ;; and store it back in the string. |
310 (put-text-property 0 1 'gnus-time time d) | |
311 time))))) | |
312 | |
313 (defsubst gnus-time-iso8601 (time) | |
31785 | 314 "Return a string of TIME in YYYYMMDDTHHMMSS format." |
17493 | 315 (format-time-string "%Y%m%dT%H%M%S" time)) |
316 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
317 (defun gnus-date-iso8601 (date) |
31785 | 318 "Convert the DATE to YYYYMMDDTHHMMSS." |
17493 | 319 (condition-case () |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
320 (gnus-time-iso8601 (gnus-date-get-time date)) |
17493 | 321 (error ""))) |
322 | |
323 (defun gnus-mode-string-quote (string) | |
324 "Quote all \"%\"'s in STRING." | |
325 (save-excursion | |
326 (gnus-set-work-buffer) | |
327 (insert string) | |
328 (goto-char (point-min)) | |
329 (while (search-forward "%" nil t) | |
330 (insert "%")) | |
331 (buffer-string))) | |
332 | |
333 ;; Make a hash table (default and minimum size is 256). | |
334 ;; Optional argument HASHSIZE specifies the table size. | |
335 (defun gnus-make-hashtable (&optional hashsize) | |
336 (make-vector (if hashsize (max (gnus-create-hash-size hashsize) 256) 256) 0)) | |
337 | |
338 ;; Make a number that is suitable for hashing; bigger than MIN and | |
339 ;; equal to some 2^x. Many machines (such as sparcs) do not have a | |
340 ;; hardware modulo operation, so they implement it in software. On | |
341 ;; many sparcs over 50% of the time to intern is spent in the modulo. | |
342 ;; Yes, it's slower than actually computing the hash from the string! | |
343 ;; So we use powers of 2 so people can optimize the modulo to a mask. | |
344 (defun gnus-create-hash-size (min) | |
345 (let ((i 1)) | |
346 (while (< i min) | |
347 (setq i (* 2 i))) | |
348 i)) | |
349 | |
350 (defcustom gnus-verbose 7 | |
351 "*Integer that says how verbose Gnus should be. | |
352 The higher the number, the more messages Gnus will flash to say what | |
353 it's doing. At zero, Gnus will be totally mute; at five, Gnus will | |
354 display most important messages; and at ten, Gnus will keep on | |
355 jabbering all the time." | |
356 :group 'gnus-start | |
357 :type 'integer) | |
358 | |
359 ;; Show message if message has a lower level than `gnus-verbose'. | |
360 ;; Guideline for numbers: | |
361 ;; 1 - error messages, 3 - non-serious error messages, 5 - messages | |
362 ;; for things that take a long time, 7 - not very important messages | |
363 ;; on stuff, 9 - messages inside loops. | |
364 (defun gnus-message (level &rest args) | |
365 (if (<= level gnus-verbose) | |
366 (apply 'message args) | |
367 ;; We have to do this format thingy here even if the result isn't | |
368 ;; shown - the return value has to be the same as the return value | |
369 ;; from `message'. | |
370 (apply 'format args))) | |
371 | |
372 (defun gnus-error (level &rest args) | |
373 "Beep an error if LEVEL is equal to or less than `gnus-verbose'." | |
374 (when (<= (floor level) gnus-verbose) | |
375 (apply 'message args) | |
376 (ding) | |
377 (let (duration) | |
378 (when (and (floatp level) | |
379 (not (zerop (setq duration (* 10 (- level (floor level))))))) | |
380 (sit-for duration)))) | |
381 nil) | |
382 | |
383 (defun gnus-split-references (references) | |
384 "Return a list of Message-IDs in REFERENCES." | |
385 (let ((beg 0) | |
386 ids) | |
387 (while (string-match "<[^>]+>" references beg) | |
388 (push (substring references (match-beginning 0) (setq beg (match-end 0))) | |
389 ids)) | |
390 (nreverse ids))) | |
391 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
392 (defsubst gnus-parent-id (references &optional n) |
17493 | 393 "Return the last Message-ID in REFERENCES. |
394 If N, return the Nth ancestor instead." | |
395 (when references | |
396 (let ((ids (inline (gnus-split-references references)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
397 (while (nthcdr (or n 1) ids) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
398 (setq ids (cdr ids))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
399 (car ids)))) |
17493 | 400 |
401 (defsubst gnus-buffer-live-p (buffer) | |
402 "Say whether BUFFER is alive or not." | |
403 (and buffer | |
404 (get-buffer buffer) | |
405 (buffer-name (get-buffer buffer)))) | |
406 | |
407 (defun gnus-horizontal-recenter () | |
408 "Recenter the current buffer horizontally." | |
409 (if (< (current-column) (/ (window-width) 2)) | |
410 (set-window-hscroll (get-buffer-window (current-buffer) t) 0) | |
411 (let* ((orig (point)) | |
412 (end (window-end (get-buffer-window (current-buffer) t))) | |
413 (max 0)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
414 (when end |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
415 ;; Find the longest line currently displayed in the window. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
416 (goto-char (window-start)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
417 (while (and (not (eobp)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
418 (< (point) end)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
419 (end-of-line) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
420 (setq max (max max (current-column))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
421 (forward-line 1)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
422 (goto-char orig) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
423 ;; Scroll horizontally to center (sort of) the point. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
424 (if (> max (window-width)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
425 (set-window-hscroll |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
426 (get-buffer-window (current-buffer) t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
427 (min (- (current-column) (/ (window-width) 3)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
428 (+ 2 (- max (window-width))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
429 (set-window-hscroll (get-buffer-window (current-buffer) t) 0)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
430 max)))) |
17493 | 431 |
432 (defun gnus-read-event-char () | |
433 "Get the next event." | |
434 (let ((event (read-event))) | |
435 ;; should be gnus-characterp, but this can't be called in XEmacs anyway | |
436 (cons (and (numberp event) event) event))) | |
437 | |
438 (defun gnus-sortable-date (date) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
439 "Make string suitable for sorting from DATE." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
440 (gnus-time-iso8601 (date-to-time date))) |
17493 | 441 |
442 (defun gnus-copy-file (file &optional to) | |
443 "Copy FILE to TO." | |
444 (interactive | |
445 (list (read-file-name "Copy file: " default-directory) | |
446 (read-file-name "Copy file to: " default-directory))) | |
447 (unless to | |
448 (setq to (read-file-name "Copy file to: " default-directory))) | |
449 (when (file-directory-p to) | |
450 (setq to (concat (file-name-as-directory to) | |
451 (file-name-nondirectory file)))) | |
452 (copy-file file to)) | |
453 | |
454 (defun gnus-kill-all-overlays () | |
455 "Delete all overlays in the current buffer." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
456 (let* ((overlayss (overlay-lists)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
457 (buffer-read-only nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
458 (overlays (delq nil (nconc (car overlayss) (cdr overlayss))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
459 (while overlays |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
460 (delete-overlay (pop overlays))))) |
17493 | 461 |
462 (defvar gnus-work-buffer " *gnus work*") | |
463 | |
464 (defun gnus-set-work-buffer () | |
465 "Put point in the empty Gnus work buffer." | |
466 (if (get-buffer gnus-work-buffer) | |
467 (progn | |
468 (set-buffer gnus-work-buffer) | |
469 (erase-buffer)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
470 (set-buffer (gnus-get-buffer-create gnus-work-buffer)) |
17493 | 471 (kill-all-local-variables) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
472 (mm-enable-multibyte))) |
17493 | 473 |
474 (defmacro gnus-group-real-name (group) | |
475 "Find the real name of a foreign newsgroup." | |
476 `(let ((gname ,group)) | |
477 (if (string-match "^[^:]+:" gname) | |
478 (substring gname (match-end 0)) | |
479 gname))) | |
480 | |
481 (defun gnus-make-sort-function (funs) | |
482 "Return a composite sort condition based on the functions in FUNC." | |
483 (cond | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
484 ;; Just a simple function. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
485 ((gnus-functionp funs) funs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
486 ;; No functions at all. |
17493 | 487 ((null funs) funs) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
488 ;; A list of functions. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
489 ((or (cdr funs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
490 (listp (car funs))) |
17493 | 491 `(lambda (t1 t2) |
492 ,(gnus-make-sort-function-1 (reverse funs)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
493 ;; A list containing just one function. |
17493 | 494 (t |
495 (car funs)))) | |
496 | |
497 (defun gnus-make-sort-function-1 (funs) | |
498 "Return a composite sort condition based on the functions in FUNC." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
499 (let ((function (car funs)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
500 (first 't1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
501 (last 't2)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
502 (when (consp function) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
503 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
504 ;; Reversed spec. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
505 ((eq (car function) 'not) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
506 (setq function (cadr function) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
507 first 't2 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
508 last 't1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
509 ((gnus-functionp function) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
510 ;; Do nothing. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
511 ) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
512 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
513 (error "Invalid sort spec: %s" function)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
514 (if (cdr funs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
515 `(or (,function ,first ,last) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
516 (and (not (,function ,last ,first)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
517 ,(gnus-make-sort-function-1 (cdr funs)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
518 `(,function ,first ,last)))) |
17493 | 519 |
520 (defun gnus-turn-off-edit-menu (type) | |
521 "Turn off edit menu in `gnus-TYPE-mode-map'." | |
522 (define-key (symbol-value (intern (format "gnus-%s-mode-map" type))) | |
523 [menu-bar edit] 'undefined)) | |
524 | |
525 (defun gnus-prin1 (form) | |
526 "Use `prin1' on FORM in the current buffer. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
527 Bind `print-quoted' and `print-readably' to t while printing." |
17493 | 528 (let ((print-quoted t) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
529 (print-readably t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
530 (print-escape-multibyte nil) |
17493 | 531 print-level print-length) |
532 (prin1 form (current-buffer)))) | |
533 | |
534 (defun gnus-prin1-to-string (form) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
535 "The same as `prin1', but bind `print-quoted' and `print-readably' to t." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
536 (let ((print-quoted t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
537 (print-readably t)) |
17493 | 538 (prin1-to-string form))) |
539 | |
540 (defun gnus-make-directory (directory) | |
541 "Make DIRECTORY (and all its parents) if it doesn't exist." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
542 (let ((file-name-coding-system nnmail-pathname-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
543 (when (and directory |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
544 (not (file-exists-p directory))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
545 (make-directory directory t))) |
17493 | 546 t) |
547 | |
548 (defun gnus-write-buffer (file) | |
549 "Write the current buffer's contents to FILE." | |
550 ;; Make sure the directory exists. | |
551 (gnus-make-directory (file-name-directory file)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
552 (let ((file-name-coding-system nnmail-pathname-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
553 ;; Write the buffer. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
554 (write-region (point-min) (point-max) file nil 'quietly))) |
17493 | 555 |
556 (defun gnus-delete-file (file) | |
557 "Delete FILE if it exists." | |
558 (when (file-exists-p file) | |
559 (delete-file file))) | |
560 | |
561 (defun gnus-strip-whitespace (string) | |
562 "Return STRING stripped of all whitespace." | |
563 (while (string-match "[\r\n\t ]+" string) | |
564 (setq string (replace-match "" t t string))) | |
565 string) | |
566 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
567 (defsubst gnus-put-text-property-excluding-newlines (beg end prop val) |
17493 | 568 "The same as `put-text-property', but don't put this prop on any newlines in the region." |
569 (save-match-data | |
570 (save-excursion | |
571 (save-restriction | |
572 (goto-char beg) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
573 (while (re-search-forward gnus-emphasize-whitespace-regexp end 'move) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
574 (gnus-put-text-property beg (match-beginning 0) prop val) |
17493 | 575 (setq beg (point))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
576 (gnus-put-text-property beg (point) prop val))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
577 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
578 (defun gnus-put-text-property-excluding-characters-with-faces (beg end |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
579 prop val) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
580 "The same as `put-text-property', but don't put props on characters with the `gnus-face' property." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
581 (let ((b beg)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
582 (while (/= b end) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
583 (when (get-text-property b 'gnus-face) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
584 (setq b (next-single-property-change b 'gnus-face nil end))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
585 (when (/= b end) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
586 (gnus-put-text-property |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
587 b (setq b (next-single-property-change b 'gnus-face nil end)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
588 prop val))))) |
17493 | 589 |
590 ;;; Protected and atomic operations. dmoore@ucsd.edu 21.11.1996 | |
591 ;;; The primary idea here is to try to protect internal datastructures | |
592 ;;; from becoming corrupted when the user hits C-g, or if a hook or | |
593 ;;; similar blows up. Often in Gnus multiple tables/lists need to be | |
594 ;;; updated at the same time, or information can be lost. | |
595 | |
596 (defvar gnus-atomic-be-safe t | |
597 "If t, certain operations will be protected from interruption by C-g.") | |
598 | |
599 (defmacro gnus-atomic-progn (&rest forms) | |
600 "Evaluate FORMS atomically, which means to protect the evaluation | |
601 from being interrupted by the user. An error from the forms themselves | |
602 will return without finishing the operation. Since interrupts from | |
603 the user are disabled, it is recommended that only the most minimal | |
604 operations are performed by FORMS. If you wish to assign many | |
605 complicated values atomically, compute the results into temporary | |
606 variables and then do only the assignment atomically." | |
607 `(let ((inhibit-quit gnus-atomic-be-safe)) | |
608 ,@forms)) | |
609 | |
610 (put 'gnus-atomic-progn 'lisp-indent-function 0) | |
611 | |
612 (defmacro gnus-atomic-progn-assign (protect &rest forms) | |
613 "Evaluate FORMS, but insure that the variables listed in PROTECT | |
614 are not changed if anything in FORMS signals an error or otherwise | |
615 non-locally exits. The variables listed in PROTECT are updated atomically. | |
616 It is safe to use gnus-atomic-progn-assign with long computations. | |
617 | |
618 Note that if any of the symbols in PROTECT were unbound, they will be | |
619 set to nil on a sucessful assignment. In case of an error or other | |
620 non-local exit, it will still be unbound." | |
621 (let* ((temp-sym-map (mapcar (lambda (x) (list (make-symbol | |
622 (concat (symbol-name x) | |
623 "-tmp")) | |
624 x)) | |
625 protect)) | |
626 (sym-temp-map (mapcar (lambda (x) (list (cadr x) (car x))) | |
627 temp-sym-map)) | |
628 (temp-sym-let (mapcar (lambda (x) (list (car x) | |
629 `(and (boundp ',(cadr x)) | |
630 ,(cadr x)))) | |
631 temp-sym-map)) | |
632 (sym-temp-let sym-temp-map) | |
633 (temp-sym-assign (apply 'append temp-sym-map)) | |
634 (sym-temp-assign (apply 'append sym-temp-map)) | |
635 (result (make-symbol "result-tmp"))) | |
636 `(let (,@temp-sym-let | |
637 ,result) | |
638 (let ,sym-temp-let | |
639 (setq ,result (progn ,@forms)) | |
640 (setq ,@temp-sym-assign)) | |
641 (let ((inhibit-quit gnus-atomic-be-safe)) | |
642 (setq ,@sym-temp-assign)) | |
643 ,result))) | |
644 | |
645 (put 'gnus-atomic-progn-assign 'lisp-indent-function 1) | |
646 ;(put 'gnus-atomic-progn-assign 'edebug-form-spec '(sexp body)) | |
647 | |
648 (defmacro gnus-atomic-setq (&rest pairs) | |
649 "Similar to setq, except that the real symbols are only assigned when | |
650 there are no errors. And when the real symbols are assigned, they are | |
651 done so atomically. If other variables might be changed via side-effect, | |
652 see gnus-atomic-progn-assign. It is safe to use gnus-atomic-setq | |
653 with potentially long computations." | |
654 (let ((tpairs pairs) | |
655 syms) | |
656 (while tpairs | |
657 (push (car tpairs) syms) | |
658 (setq tpairs (cddr tpairs))) | |
659 `(gnus-atomic-progn-assign ,syms | |
660 (setq ,@pairs)))) | |
661 | |
662 ;(put 'gnus-atomic-setq 'edebug-form-spec '(body)) | |
663 | |
664 | |
665 ;;; Functions for saving to babyl/mail files. | |
666 | |
667 (defvar rmail-default-rmail-file) | |
668 (defun gnus-output-to-rmail (filename &optional ask) | |
669 "Append the current article to an Rmail file named FILENAME." | |
670 (require 'rmail) | |
671 ;; Most of these codes are borrowed from rmailout.el. | |
672 (setq filename (expand-file-name filename)) | |
673 (setq rmail-default-rmail-file filename) | |
674 (let ((artbuf (current-buffer)) | |
675 (tmpbuf (get-buffer-create " *Gnus-output*"))) | |
676 (save-excursion | |
677 (or (get-file-buffer filename) | |
678 (file-exists-p filename) | |
679 (if (or (not ask) | |
680 (gnus-yes-or-no-p | |
681 (concat "\"" filename "\" does not exist, create it? "))) | |
682 (let ((file-buffer (create-file-buffer filename))) | |
683 (save-excursion | |
684 (set-buffer file-buffer) | |
685 (rmail-insert-rmail-file-header) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
686 (let ((require-final-newline nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
687 (coding-system-for-write mm-text-coding-system)) |
17493 | 688 (gnus-write-buffer filename))) |
689 (kill-buffer file-buffer)) | |
690 (error "Output file does not exist"))) | |
691 (set-buffer tmpbuf) | |
692 (erase-buffer) | |
693 (insert-buffer-substring artbuf) | |
694 (gnus-convert-article-to-rmail) | |
695 ;; Decide whether to append to a file or to an Emacs buffer. | |
696 (let ((outbuf (get-file-buffer filename))) | |
697 (if (not outbuf) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
698 (mm-append-to-file (point-min) (point-max) filename) |
17493 | 699 ;; File has been visited, in buffer OUTBUF. |
700 (set-buffer outbuf) | |
701 (let ((buffer-read-only nil) | |
702 (msg (and (boundp 'rmail-current-message) | |
703 (symbol-value 'rmail-current-message)))) | |
704 ;; If MSG is non-nil, buffer is in RMAIL mode. | |
705 (when msg | |
706 (widen) | |
707 (narrow-to-region (point-max) (point-max))) | |
708 (insert-buffer-substring tmpbuf) | |
709 (when msg | |
710 (goto-char (point-min)) | |
711 (widen) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
712 (search-backward "\n\^_") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
713 (narrow-to-region (point) (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
714 (rmail-count-new-messages t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
715 (when (rmail-summary-exists) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
716 (rmail-select-summary |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
717 (rmail-update-summary))) |
17493 | 718 (rmail-count-new-messages t) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
719 (rmail-show-message msg)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
720 (save-buffer))))) |
17493 | 721 (kill-buffer tmpbuf))) |
722 | |
723 (defun gnus-output-to-mail (filename &optional ask) | |
724 "Append the current article to a mail file named FILENAME." | |
725 (setq filename (expand-file-name filename)) | |
726 (let ((artbuf (current-buffer)) | |
727 (tmpbuf (get-buffer-create " *Gnus-output*"))) | |
728 (save-excursion | |
729 ;; Create the file, if it doesn't exist. | |
730 (when (and (not (get-file-buffer filename)) | |
731 (not (file-exists-p filename))) | |
732 (if (or (not ask) | |
733 (gnus-y-or-n-p | |
734 (concat "\"" filename "\" does not exist, create it? "))) | |
735 (let ((file-buffer (create-file-buffer filename))) | |
736 (save-excursion | |
737 (set-buffer file-buffer) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
738 (let ((require-final-newline nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
739 (coding-system-for-write mm-text-coding-system)) |
17493 | 740 (gnus-write-buffer filename))) |
741 (kill-buffer file-buffer)) | |
742 (error "Output file does not exist"))) | |
743 (set-buffer tmpbuf) | |
744 (erase-buffer) | |
745 (insert-buffer-substring artbuf) | |
746 (goto-char (point-min)) | |
747 (if (looking-at "From ") | |
748 (forward-line 1) | |
749 (insert "From nobody " (current-time-string) "\n")) | |
750 (let (case-fold-search) | |
751 (while (re-search-forward "^From " nil t) | |
752 (beginning-of-line) | |
753 (insert ">"))) | |
754 ;; Decide whether to append to a file or to an Emacs buffer. | |
755 (let ((outbuf (get-file-buffer filename))) | |
756 (if (not outbuf) | |
757 (let ((buffer-read-only nil)) | |
758 (save-excursion | |
759 (goto-char (point-max)) | |
760 (forward-char -2) | |
761 (unless (looking-at "\n\n") | |
762 (goto-char (point-max)) | |
763 (unless (bolp) | |
764 (insert "\n")) | |
765 (insert "\n")) | |
766 (goto-char (point-max)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
767 (mm-append-to-file (point-min) (point-max) filename))) |
17493 | 768 ;; File has been visited, in buffer OUTBUF. |
769 (set-buffer outbuf) | |
770 (let ((buffer-read-only nil)) | |
771 (goto-char (point-max)) | |
772 (unless (eobp) | |
773 (insert "\n")) | |
774 (insert "\n") | |
775 (insert-buffer-substring tmpbuf))))) | |
776 (kill-buffer tmpbuf))) | |
777 | |
778 (defun gnus-convert-article-to-rmail () | |
779 "Convert article in current buffer to Rmail message format." | |
780 (let ((buffer-read-only nil)) | |
781 ;; Convert article directly into Babyl format. | |
782 (goto-char (point-min)) | |
783 (insert "\^L\n0, unseen,,\n*** EOOH ***\n") | |
784 (while (search-forward "\n\^_" nil t) ;single char | |
785 (replace-match "\n^_" t t)) ;2 chars: "^" and "_" | |
786 (goto-char (point-max)) | |
787 (insert "\^_"))) | |
788 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
789 (defun gnus-map-function (funs arg) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
790 "Applies the result of the first function in FUNS to the second, and so on. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
791 ARG is passed to the first function." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
792 (let ((myfuns funs)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
793 (while myfuns |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
794 (setq arg (funcall (pop myfuns) arg))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
795 arg)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
796 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
797 (defun gnus-run-hooks (&rest funcs) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
798 "Does the same as `run-hooks', but saves excursion." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
799 (let ((buf (current-buffer))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
800 (unwind-protect |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
801 (apply 'run-hooks funcs) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
802 (set-buffer buf)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
803 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
804 ;;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
805 ;;; .netrc and .authinforc parsing |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
806 ;;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
807 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
808 (defun gnus-parse-netrc (file) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
809 "Parse FILE and return an list of all entries in the file." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
810 (when (file-exists-p file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
811 (with-temp-buffer |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
812 (let ((tokens '("machine" "default" "login" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
813 "password" "account" "macdef" "force" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
814 "port")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
815 alist elem result pair) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
816 (insert-file-contents file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
817 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
818 ;; Go through the file, line by line. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
819 (while (not (eobp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
820 (narrow-to-region (point) (gnus-point-at-eol)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
821 ;; For each line, get the tokens and values. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
822 (while (not (eobp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
823 (skip-chars-forward "\t ") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
824 ;; Skip lines that begin with a "#". |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
825 (if (eq (char-after) ?#) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
826 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
827 (unless (eobp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
828 (setq elem |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
829 (if (= (following-char) ?\") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
830 (read (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
831 (buffer-substring |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
832 (point) (progn (skip-chars-forward "^\t ") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
833 (point))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
834 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
835 ((equal elem "macdef") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
836 ;; We skip past the macro definition. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
837 (widen) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
838 (while (and (zerop (forward-line 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
839 (looking-at "$"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
840 (narrow-to-region (point) (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
841 ((member elem tokens) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
842 ;; Tokens that don't have a following value are ignored, |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
843 ;; except "default". |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
844 (when (and pair (or (cdr pair) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
845 (equal (car pair) "default"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
846 (push pair alist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
847 (setq pair (list elem))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
848 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
849 ;; Values that haven't got a preceding token are ignored. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
850 (when pair |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
851 (setcdr pair elem) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
852 (push pair alist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
853 (setq pair nil))))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
854 (when alist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
855 (push (nreverse alist) result)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
856 (setq alist nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
857 pair nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
858 (widen) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
859 (forward-line 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
860 (nreverse result))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
861 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
862 (defun gnus-netrc-machine (list machine &optional port defaultport) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
863 "Return the netrc values from LIST for MACHINE or for the default entry. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
864 If PORT specified, only return entries with matching port tokens. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
865 Entries without port tokens default to DEFAULTPORT." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
866 (let ((rest list) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
867 result) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
868 (while list |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
869 (when (equal (cdr (assoc "machine" (car list))) machine) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
870 (push (car list) result)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
871 (pop list)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
872 (unless result |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
873 ;; No machine name matches, so we look for default entries. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
874 (while rest |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
875 (when (assoc "default" (car rest)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
876 (push (car rest) result)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
877 (pop rest))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
878 (when result |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
879 (setq result (nreverse result)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
880 (while (and result |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
881 (not (equal (or port defaultport "nntp") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
882 (or (gnus-netrc-get (car result) "port") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
883 defaultport "nntp")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
884 (pop result)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
885 (car result)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
886 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
887 (defun gnus-netrc-get (alist type) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
888 "Return the value of token TYPE from ALIST." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
889 (cdr (assoc type alist))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
890 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
891 ;;; Various |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
892 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
893 (defvar gnus-group-buffer) ; Compiler directive |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
894 (defun gnus-alive-p () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
895 "Say whether Gnus is running or not." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
896 (and (boundp 'gnus-group-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
897 (get-buffer gnus-group-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
898 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
899 (set-buffer gnus-group-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
900 (eq major-mode 'gnus-group-mode)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
901 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
902 (defun gnus-remove-duplicates (list) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
903 (let (new (tail list)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
904 (while tail |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
905 (or (member (car tail) new) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
906 (setq new (cons (car tail) new))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
907 (setq tail (cdr tail))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
908 (nreverse new))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
909 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
910 (defun gnus-delete-if (predicate list) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
911 "Delete elements from LIST that satisfy PREDICATE." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
912 (let (out) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
913 (while list |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
914 (unless (funcall predicate (car list)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
915 (push (car list) out)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
916 (pop list)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
917 (nreverse out))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
918 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
919 (defun gnus-delete-alist (key alist) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
920 "Delete all entries in ALIST that have a key eq to KEY." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
921 (let (entry) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
922 (while (setq entry (assq key alist)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
923 (setq alist (delq entry alist))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
924 alist)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
925 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
926 (defmacro gnus-pull (key alist &optional assoc-p) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
927 "Modify ALIST to be without KEY." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
928 (unless (symbolp alist) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
929 (error "Not a symbol: %s" alist)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
930 (let ((fun (if assoc-p 'assoc 'assq))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
931 `(setq ,alist (delq (,fun ,key ,alist) ,alist)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
932 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
933 (defun gnus-globalify-regexp (re) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
934 "Returns a regexp that matches a whole line, iff RE matches a part of it." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
935 (concat (unless (string-match "^\\^" re) "^.*") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
936 re |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
937 (unless (string-match "\\$$" re) ".*$"))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
938 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
939 (defun gnus-set-window-start (&optional point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
940 "Set the window start to POINT, or (point) if nil." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
941 (let ((win (get-buffer-window (current-buffer) t))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
942 (when win |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
943 (set-window-start win (or point (point)))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
944 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
945 (defun gnus-annotation-in-region-p (b e) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
946 (if (= b e) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
947 (eq (cadr (memq 'gnus-undeletable (text-properties-at b))) t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
948 (text-property-any b e 'gnus-undeletable t))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
949 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
950 (defun gnus-or (&rest elems) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
951 "Return non-nil if any of the elements are non-nil." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
952 (catch 'found |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
953 (while elems |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
954 (when (pop elems) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
955 (throw 'found t))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
956 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
957 (defun gnus-and (&rest elems) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
958 "Return non-nil if all of the elements are non-nil." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
959 (catch 'found |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
960 (while elems |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
961 (unless (pop elems) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
962 (throw 'found nil))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
963 t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
964 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
965 (defun gnus-write-active-file (file hashtb &optional full-names) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
966 (let ((coding-system-for-write nnmail-active-file-coding-system)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
967 (with-temp-file file |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
968 (mapatoms |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
969 (lambda (sym) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
970 (when (and sym |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
971 (boundp sym) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
972 (symbol-value sym)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
973 (insert (format "%S %d %d y\n" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
974 (if full-names |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
975 sym |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
976 (intern (gnus-group-real-name (symbol-name sym)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
977 (or (cdr (symbol-value sym)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
978 (car (symbol-value sym))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
979 (car (symbol-value sym)))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
980 hashtb) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
981 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
982 (while (search-backward "\\." nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
983 (delete-char 1))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
984 |
17493 | 985 (provide 'gnus-util) |
986 | |
987 ;;; gnus-util.el ends here |