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