Mercurial > emacs
annotate lisp/gnus/gnus-util.el @ 110951:85fe6b298326
* make-dist: Remove the unnecessary $shortversion.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 12 Oct 2010 01:01:11 -0700 |
parents | 236342431786 |
children | 2009890b5ebf |
rev | line source |
---|---|
17493 | 1 ;;; gnus-util.el --- utility functions for Gnus |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64631
diff
changeset
|
2 |
68633
1077b8039c32
Update copyright notices of all files in the gnus directory.
Romain Francoise <romain@orebokech.com>
parents:
68606
diff
changeset
|
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
106815 | 4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
17493 | 5 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 7 ;; Keywords: news |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
17493 | 12 ;; it under the terms of the GNU General Public License as published by |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; (at your option) any later version. |
17493 | 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 | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17493 | 19 ;; GNU General Public License for more details. |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
17493 | 23 |
24 ;;; Commentary: | |
25 | |
26 ;; Nothing in this file depends on any other parts of Gnus -- all | |
27 ;; functions and macros in this file are utility functions that are | |
28 ;; used by Gnus and may be used by any other package without loading | |
29 ;; Gnus first. | |
30 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
31 ;; [Unfortunately, it does depend on other parts of Gnus, e.g. the |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
32 ;; autoloads and defvars below...] |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
33 |
17493 | 34 ;;; Code: |
35 | |
110918
236342431786
nnimap.el (gnutls-negotiate): Silence the byte compiler.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110859
diff
changeset
|
36 ;; For Emacs <22.2 and XEmacs. |
87190
5e1044759e6c
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
37 (eval-and-compile |
5e1044759e6c
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
38 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) |
35051
d80c28ab0b86
(nnmail-pathname-coding-system): Defvar when
Dave Love <fx@gnu.org>
parents:
34833
diff
changeset
|
39 (eval-when-compile |
86154 | 40 (require 'cl)) |
104892
e86ba08d7eac
(with-no-warnings): Define it for old Emacsen.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104889
diff
changeset
|
41 |
e86ba08d7eac
(with-no-warnings): Define it for old Emacsen.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104889
diff
changeset
|
42 (eval-when-compile |
e86ba08d7eac
(with-no-warnings): Define it for old Emacsen.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104889
diff
changeset
|
43 (unless (fboundp 'with-no-warnings) |
e86ba08d7eac
(with-no-warnings): Define it for old Emacsen.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104889
diff
changeset
|
44 (defmacro with-no-warnings (&rest body) |
e86ba08d7eac
(with-no-warnings): Define it for old Emacsen.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104889
diff
changeset
|
45 `(progn ,@body)))) |
e86ba08d7eac
(with-no-warnings): Define it for old Emacsen.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104889
diff
changeset
|
46 |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
47 (defcustom gnus-completing-read-function 'gnus-emacs-completing-read |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
48 "Function use to do completing read." |
110674
8ce8af5eb5e3
Florian Ragwitz' stuff removed because of missing paperwork.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110671
diff
changeset
|
49 :version "24.1" |
110661
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
50 :group 'gnus-meta |
110772
cd2496a17cf2
Merge changes made ein Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110763
diff
changeset
|
51 :type `(radio (function-item |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
52 :doc "Use Emacs standard `completing-read' function." |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
53 gnus-emacs-completing-read) |
110772
cd2496a17cf2
Merge changes made ein Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110763
diff
changeset
|
54 ;; iswitchb.el is very old and ido.el is unavailable |
cd2496a17cf2
Merge changes made ein Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110763
diff
changeset
|
55 ;; in XEmacs, so we exclude those function items. |
cd2496a17cf2
Merge changes made ein Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110763
diff
changeset
|
56 ,@(unless (featurep 'xemacs) |
cd2496a17cf2
Merge changes made ein Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110763
diff
changeset
|
57 '((function-item |
cd2496a17cf2
Merge changes made ein Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110763
diff
changeset
|
58 :doc "Use `ido-completing-read' function." |
cd2496a17cf2
Merge changes made ein Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110763
diff
changeset
|
59 gnus-ido-completing-read) |
cd2496a17cf2
Merge changes made ein Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110763
diff
changeset
|
60 (function-item |
cd2496a17cf2
Merge changes made ein Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110763
diff
changeset
|
61 :doc "Use iswitchb based completing-read function." |
cd2496a17cf2
Merge changes made ein Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110763
diff
changeset
|
62 gnus-iswitchb-completing-read))))) |
110661
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
63 |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
64 (defcustom gnus-completion-styles |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
65 (if (and (boundp 'completion-styles-alist) |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
66 (boundp 'completion-styles)) |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
67 (append (when (and (assq 'substring completion-styles-alist) |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
68 (not (memq 'substring completion-styles))) |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
69 (list 'substring)) |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
70 completion-styles) |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
71 nil) |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
72 "Value of `completion-styles' to use when completing." |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
73 :version "24.1" |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
74 :group 'gnus-meta |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
75 :type 'list) |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
76 |
86154 | 77 ;; Fixme: this should be a gnus variable, not nnmail-. |
78 (defvar nnmail-pathname-coding-system) | |
79 (defvar nnmail-active-file-coding-system) | |
57617
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
80 |
86154 | 81 ;; Inappropriate references to other parts of Gnus. |
82 (defvar gnus-emphasize-whitespace-regexp) | |
83 (defvar gnus-original-article-buffer) | |
84 (defvar gnus-user-agent) | |
85 | |
95812 | 86 (autoload 'gnus-get-buffer-window "gnus-win") |
87 (autoload 'nnheader-narrow-to-headers "nnheader") | |
88 (autoload 'nnheader-replace-chars-in-string "nnheader") | |
98376
473a8358e3b6
(mail-header-remove-comments): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
98366
diff
changeset
|
89 (autoload 'mail-header-remove-comments "mail-parse") |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
90 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
91 (eval-and-compile |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
92 (cond |
70146
2cd7cafcba54
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-238
Miles Bader <miles@gnu.org>
parents:
69572
diff
changeset
|
93 ;; Prefer `replace-regexp-in-string' (present in Emacs, XEmacs 21.5, |
95588 | 94 ;; SXEmacs 22.1.4) over `replace-in-string'. The latter leads to inf-loops |
70146
2cd7cafcba54
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-238
Miles Bader <miles@gnu.org>
parents:
69572
diff
changeset
|
95 ;; on empty matches: |
2cd7cafcba54
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-238
Miles Bader <miles@gnu.org>
parents:
69572
diff
changeset
|
96 ;; (replace-in-string "foo" "/*$" "/") |
2cd7cafcba54
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-238
Miles Bader <miles@gnu.org>
parents:
69572
diff
changeset
|
97 ;; (replace-in-string "xe" "\\(x\\)?" "") |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
98 ((fboundp 'replace-regexp-in-string) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
99 (defun gnus-replace-in-string (string regexp newtext &optional literal) |
58835
9bdd97960431
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Miles Bader <miles@gnu.org>
parents:
57617
diff
changeset
|
100 "Replace all matches for REGEXP with NEWTEXT in STRING. |
9bdd97960431
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Miles Bader <miles@gnu.org>
parents:
57617
diff
changeset
|
101 If LITERAL is non-nil, insert NEWTEXT literally. Return a new |
9bdd97960431
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Miles Bader <miles@gnu.org>
parents:
57617
diff
changeset
|
102 string containing the replacements. |
9bdd97960431
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Miles Bader <miles@gnu.org>
parents:
57617
diff
changeset
|
103 |
9bdd97960431
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716
Miles Bader <miles@gnu.org>
parents:
57617
diff
changeset
|
104 This is a compatibility function for different Emacsen." |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
105 (replace-regexp-in-string regexp newtext string nil literal))) |
70146
2cd7cafcba54
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-238
Miles Bader <miles@gnu.org>
parents:
69572
diff
changeset
|
106 ((fboundp 'replace-in-string) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
107 (defalias 'gnus-replace-in-string 'replace-in-string)))) |
17493 | 108 |
109 (defun gnus-boundp (variable) | |
110 "Return non-nil if VARIABLE is bound and non-nil." | |
111 (and (boundp variable) | |
112 (symbol-value variable))) | |
113 | |
114 (defmacro gnus-eval-in-buffer-window (buffer &rest forms) | |
115 "Pop to BUFFER, evaluate FORMS, and then return to the original window." | |
116 (let ((tempvar (make-symbol "GnusStartBufferWindow")) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
117 (w (make-symbol "w")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
118 (buf (make-symbol "buf"))) |
17493 | 119 `(let* ((,tempvar (selected-window)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
120 (,buf ,buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
121 (,w (gnus-get-buffer-window ,buf 'visible))) |
17493 | 122 (unwind-protect |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
123 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
124 (if ,w |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
125 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
126 (select-window ,w) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
127 (set-buffer (window-buffer ,w))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
128 (pop-to-buffer ,buf)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
129 ,@forms) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
130 (select-window ,tempvar))))) |
17493 | 131 |
132 (put 'gnus-eval-in-buffer-window 'lisp-indent-function 1) | |
133 (put 'gnus-eval-in-buffer-window 'edebug-form-spec '(form body)) | |
134 | |
135 (defmacro gnus-intern-safe (string hashtable) | |
76650 | 136 "Get hash value. Arguments are STRING and HASHTABLE." |
17493 | 137 `(let ((symbol (intern ,string ,hashtable))) |
138 (or (boundp symbol) | |
139 (set symbol nil)) | |
140 symbol)) | |
141 | |
142 (defsubst gnus-goto-char (point) | |
143 (and point (goto-char point))) | |
144 | |
145 (defmacro gnus-buffer-exists-p (buffer) | |
146 `(let ((buffer ,buffer)) | |
147 (when buffer | |
148 (funcall (if (stringp buffer) 'get-buffer 'buffer-name) | |
149 buffer)))) | |
150 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
151 ;; The LOCAL arg to `add-hook' is interpreted differently in Emacs and |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
152 ;; XEmacs. In Emacs we don't need to call `make-local-hook' first. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
153 ;; It's harmless, though, so the main purpose of this alias is to shut |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
154 ;; up the byte compiler. |
110713
06aa6ebe38fa
* lisp/subr.el (make-local-hook): Remove function obsolete since 21.1.
Glenn Morris <rgm@gnu.org>
parents:
110708
diff
changeset
|
155 (defalias 'gnus-make-local-hook (if (featurep 'xemacs) |
06aa6ebe38fa
* lisp/subr.el (make-local-hook): Remove function obsolete since 21.1.
Glenn Morris <rgm@gnu.org>
parents:
110708
diff
changeset
|
156 'make-local-hook |
110716 | 157 'ignore)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
158 |
17493 | 159 (defun gnus-delete-first (elt list) |
160 "Delete by side effect the first occurrence of ELT as a member of LIST." | |
161 (if (equal (car list) elt) | |
162 (cdr list) | |
163 (let ((total list)) | |
164 (while (and (cdr list) | |
165 (not (equal (cadr list) elt))) | |
166 (setq list (cdr list))) | |
167 (when (cdr list) | |
168 (setcdr list (cddr list))) | |
169 total))) | |
170 | |
171 ;; Delete the current line (and the next N lines). | |
172 (defmacro gnus-delete-line (&optional n) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
173 `(delete-region (point-at-bol) |
17493 | 174 (progn (forward-line ,(or n 1)) (point)))) |
175 | |
176 (defun gnus-byte-code (func) | |
177 "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
|
178 (let ((fval (indirect-function func))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
179 (if (byte-code-function-p fval) |
17493 | 180 (let ((flist (append fval nil))) |
181 (setcar flist 'byte-code) | |
182 flist) | |
183 (cons 'progn (cddr fval))))) | |
184 | |
185 (defun gnus-extract-address-components (from) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
186 "Extract address components from a From header. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
187 Given an RFC-822 address FROM, extract full name and canonical address. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
188 Returns a list of the form (FULL-NAME CANONICAL-ADDRESS). Much more simple |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
189 solution than `mail-extract-address-components', which works much better, but |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
190 is slower." |
17493 | 191 (let (name address) |
192 ;; First find the address - the thing with the @ in it. This may | |
193 ;; not be accurate in mail addresses, but does the trick most of | |
194 ;; the time in news messages. | |
74021 | 195 (cond (;; Check ``<foo@bar>'' first in order to handle the quite common |
196 ;; form ``"abc@xyz" <foo@bar>'' (i.e. ``@'' as part of a comment) | |
197 ;; correctly. | |
198 (string-match "<\\([^@ \t<>]+[!@][^@ \t<>]+\\)>" from) | |
199 (setq address (substring from (match-beginning 1) (match-end 1)))) | |
200 ((string-match "\\b[^@ \t<>]+[!@][^@ \t<>]+\\b" from) | |
201 (setq address (substring from (match-beginning 0) (match-end 0))))) | |
17493 | 202 ;; Then we check whether the "name <address>" format is used. |
203 (and address | |
204 ;; Linear white space is not required. | |
205 (string-match (concat "[ \t]*<" (regexp-quote address) ">") from) | |
206 (and (setq name (substring from 0 (match-beginning 0))) | |
207 ;; Strip any quotes from the name. | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
208 (string-match "^\".*\"$" name) |
17493 | 209 (setq name (substring name 1 (1- (match-end 0)))))) |
210 ;; If not, then "address (name)" is used. | |
211 (or name | |
212 (and (string-match "(.+)" from) | |
213 (setq name (substring from (1+ (match-beginning 0)) | |
214 (1- (match-end 0))))) | |
215 (and (string-match "()" from) | |
216 (setq name address)) | |
217 ;; XOVER might not support folded From headers. | |
218 (and (string-match "(.*" from) | |
219 (setq name (substring from (1+ (match-beginning 0)) | |
220 (match-end 0))))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
221 (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
|
222 |
94748 | 223 (defun gnus-extract-address-component-name (from) |
224 "Extract name from a From header. | |
225 Uses `gnus-extract-address-components'." | |
226 (nth 0 (gnus-extract-address-components from))) | |
227 | |
228 (defun gnus-extract-address-component-email (from) | |
229 "Extract e-mail address from a From header. | |
230 Uses `gnus-extract-address-components'." | |
231 (nth 1 (gnus-extract-address-components from))) | |
17493 | 232 |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
233 (declare-function message-fetch-field "message" (header &optional not-all)) |
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
234 |
17493 | 235 (defun gnus-fetch-field (field) |
236 "Return the value of the header FIELD of current article." | |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
237 (require 'message) |
17493 | 238 (save-excursion |
239 (save-restriction | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
240 (let ((inhibit-point-motion-hooks t)) |
17493 | 241 (nnheader-narrow-to-headers) |
242 (message-fetch-field field))))) | |
243 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
244 (defun gnus-fetch-original-field (field) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
245 "Fetch FIELD from the original version of the current article." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
246 (with-current-buffer gnus-original-article-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
247 (gnus-fetch-field field))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
248 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
249 |
17493 | 250 (defun gnus-goto-colon () |
251 (beginning-of-line) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
252 (let ((eol (point-at-eol))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
253 (goto-char (or (text-property-any (point) eol 'gnus-position t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
254 (search-forward ":" eol t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
255 (point))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
256 |
87263
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
257 (declare-function gnus-find-method-for-group "gnus" (group &optional info)) |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
258 (declare-function gnus-group-name-decode "gnus-group" (string charset)) |
87263
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
259 (declare-function gnus-group-name-charset "gnus-group" (method group)) |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
260 ;; gnus-group requires gnus-int which requires message. |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
261 (declare-function message-tokenize-header "message" |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
262 (header &optional separator)) |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
263 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
264 (defun gnus-decode-newsgroups (newsgroups group &optional method) |
107427
ecbe0edc4f69
Stop message.el from loading about 40 libraries it doesn't always need.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
265 (require 'gnus-group) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
266 (let ((method (or method (gnus-find-method-for-group group)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
267 (mapconcat (lambda (group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
268 (gnus-group-name-decode group (gnus-group-name-charset |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
269 method group))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
270 (message-tokenize-header newsgroups) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
271 ","))) |
17493 | 272 |
273 (defun gnus-remove-text-with-property (prop) | |
274 "Delete all text in the current buffer with text property PROP." | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
275 (let ((start (point-min)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
276 end) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
277 (unless (get-text-property start prop) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
278 (setq start (next-single-property-change start prop))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
279 (while start |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
280 (setq end (text-property-any start (point-max) prop nil)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
281 (delete-region start (or end (point-max))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
282 (setq start (when end |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
283 (next-single-property-change start prop)))))) |
17493 | 284 |
285 (defun gnus-newsgroup-directory-form (newsgroup) | |
286 "Make hierarchical directory name from NEWSGROUP name." | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
287 (let* ((newsgroup (gnus-newsgroup-savable-name newsgroup)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
288 (idx (string-match ":" newsgroup))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
289 (concat |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
290 (if idx (substring newsgroup 0 idx)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
291 (if idx "/") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
292 (nnheader-replace-chars-in-string |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
293 (if idx (substring newsgroup (1+ idx)) newsgroup) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
294 ?. ?/)))) |
17493 | 295 |
296 (defun gnus-newsgroup-savable-name (group) | |
297 ;; Replace any slashes in a group name (eg. an ange-ftp nndoc group) | |
298 ;; with dots. | |
299 (nnheader-replace-chars-in-string group ?/ ?.)) | |
300 | |
301 (defun gnus-string> (s1 s2) | |
302 (not (or (string< s1 s2) | |
303 (string= s1 s2)))) | |
304 | |
79143 | 305 (defun gnus-string< (s1 s2) |
306 "Return t if first arg string is less than second in lexicographic order. | |
307 Case is significant if and only if `case-fold-search' is nil. | |
308 Symbols are also allowed; their print names are used instead." | |
309 (if case-fold-search | |
310 (string-lessp (downcase (if (symbolp s1) (symbol-name s1) s1)) | |
311 (downcase (if (symbolp s2) (symbol-name s2) s2))) | |
312 (string-lessp s1 s2))) | |
313 | |
17493 | 314 ;;; Time functions. |
315 | |
316 (defun gnus-file-newer-than (file date) | |
317 (let ((fdate (nth 5 (file-attributes file)))) | |
318 (or (> (car fdate) (car date)) | |
319 (and (= (car fdate) (car date)) | |
320 (> (nth 1 fdate) (nth 1 date)))))) | |
321 | |
104889
18c2aea5083c
2009-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104806
diff
changeset
|
322 (eval-and-compile |
18c2aea5083c
2009-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104806
diff
changeset
|
323 (if (and (fboundp 'float-time) |
18c2aea5083c
2009-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104806
diff
changeset
|
324 (subrp (symbol-function 'float-time))) |
18c2aea5083c
2009-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104806
diff
changeset
|
325 (defalias 'gnus-float-time 'float-time) |
18c2aea5083c
2009-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104806
diff
changeset
|
326 (defun gnus-float-time (&optional time) |
18c2aea5083c
2009-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104806
diff
changeset
|
327 "Convert time value TIME to a floating point number. |
104804
6a1f7b318ddf
(gnus-float-time): Make TIME optional, defaulting to current-time.
Glenn Morris <rgm@gnu.org>
parents:
104802
diff
changeset
|
328 TIME defaults to the current time." |
104889
18c2aea5083c
2009-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
104806
diff
changeset
|
329 (with-no-warnings (time-to-seconds (or time (current-time))))))) |
104802
0b94fa0fdedb
(gnus-float-time): New function.
Glenn Morris <rgm@gnu.org>
parents:
102044
diff
changeset
|
330 |
17493 | 331 ;;; Keymap macros. |
332 | |
333 (defmacro gnus-local-set-keys (&rest plist) | |
334 "Set the keys in PLIST in the current keymap." | |
335 `(gnus-define-keys-1 (current-local-map) ',plist)) | |
336 | |
337 (defmacro gnus-define-keys (keymap &rest plist) | |
338 "Define all keys in PLIST in KEYMAP." | |
339 `(gnus-define-keys-1 (quote ,keymap) (quote ,plist))) | |
340 | |
341 (defmacro gnus-define-keys-safe (keymap &rest plist) | |
342 "Define all keys in PLIST in KEYMAP without overwriting previous definitions." | |
343 `(gnus-define-keys-1 (quote ,keymap) (quote ,plist) t)) | |
344 | |
345 (put 'gnus-define-keys 'lisp-indent-function 1) | |
346 (put 'gnus-define-keys-safe 'lisp-indent-function 1) | |
347 (put 'gnus-local-set-keys 'lisp-indent-function 1) | |
348 | |
349 (defmacro gnus-define-keymap (keymap &rest plist) | |
350 "Define all keys in PLIST in KEYMAP." | |
351 `(gnus-define-keys-1 ,keymap (quote ,plist))) | |
352 | |
353 (put 'gnus-define-keymap 'lisp-indent-function 1) | |
354 | |
355 (defun gnus-define-keys-1 (keymap plist &optional safe) | |
356 (when (null keymap) | |
357 (error "Can't set keys in a null keymap")) | |
358 (cond ((symbolp keymap) | |
359 (setq keymap (symbol-value keymap))) | |
360 ((keymapp keymap)) | |
361 ((listp keymap) | |
362 (set (car keymap) nil) | |
363 (define-prefix-command (car keymap)) | |
364 (define-key (symbol-value (caddr keymap)) (cadr keymap) (car keymap)) | |
365 (setq keymap (symbol-value (car keymap))))) | |
366 (let (key) | |
367 (while plist | |
368 (when (symbolp (setq key (pop plist))) | |
369 (setq key (symbol-value key))) | |
370 (if (or (not safe) | |
371 (eq (lookup-key keymap key) 'undefined)) | |
372 (define-key keymap key (pop plist)) | |
373 (pop plist))))) | |
374 | |
375 ;; Two silly functions to ensure that all `y-or-n-p' questions clear | |
376 ;; the echo area. | |
87300 | 377 ;; |
92147 | 378 ;; Do we really need these functions? Workarounds for bugs in the corresponding |
379 ;; Emacs functions? Maybe these bugs are no longer present in any supported | |
87300 | 380 ;; (X)Emacs version? Alias them to the original functions and see if anyone |
92147 | 381 ;; reports a problem. If not, replace with original functions. --rsteib, |
382 ;; 2007-12-14 | |
383 ;; | |
384 ;; All supported Emacsen clear the echo area after `yes-or-no-p', so we can | |
385 ;; remove `yes-or-no-p'. RMS says that not clearing after `y-or-n-p' is | |
386 ;; intentional (see below), so we could remove `gnus-y-or-n-p' too. | |
387 ;; Objections? --rsteib, 2008-02-16 | |
87300 | 388 ;; |
92147 | 389 ;; ,----[ http://thread.gmane.org/gmane.emacs.gnus.general/65099/focus=66070 ] |
390 ;; | From: Richard Stallman | |
391 ;; | Subject: Re: Do we need gnus-yes-or-no-p and gnus-y-or-n-p? | |
392 ;; | To: Katsumi Yamaoka [...] | |
393 ;; | Cc: emacs-devel@[...], xemacs-beta@[...], ding@[...] | |
394 ;; | Date: Mon, 07 Jan 2008 12:16:05 -0500 | |
395 ;; | Message-ID: <E1JBva1-000528-VY@fencepost.gnu.org> | |
396 ;; | | |
397 ;; | The behavior of `y-or-n-p' that it doesn't clear the question | |
398 ;; | and the answer is not serious of course, but I feel it is not | |
399 ;; | cool. | |
400 ;; | | |
401 ;; | It is intentional. | |
402 ;; | | |
403 ;; | Currently, it is commented out in the trunk by Reiner Steib. He | |
404 ;; | also wrote the benefit of leaving the question and the answer in | |
405 ;; | the echo area as follows: | |
406 ;; | | |
407 ;; | (http://article.gmane.org/gmane.emacs.gnus.general/66061) | |
408 ;; | > In contrast to yes-or-no-p it is much easier to type y, n, | |
409 ;; | > SPC, DEL, etc accidentally, so it might be useful for the user | |
410 ;; | > to see what he has typed. | |
411 ;; | | |
412 ;; | Yes, that is the reason. | |
413 ;; `---- | |
414 | |
87300 | 415 ;; (defun gnus-y-or-n-p (prompt) |
416 ;; (prog1 | |
417 ;; (y-or-n-p prompt) | |
418 ;; (message ""))) | |
419 ;; (defun gnus-yes-or-no-p (prompt) | |
420 ;; (prog1 | |
421 ;; (yes-or-no-p prompt) | |
422 ;; (message ""))) | |
17493 | 423 |
87300 | 424 (defalias 'gnus-y-or-n-p 'y-or-n-p) |
425 (defalias 'gnus-yes-or-no-p 'yes-or-no-p) | |
17493 | 426 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
427 ;; By Frank Schmitt <ich@Frank-Schmitt.net>. Allows to have |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
428 ;; age-depending date representations. (e.g. just the time if it's |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
429 ;; from today, the day of the week if it's within the last 7 days and |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
430 ;; the full date if it's older) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
431 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
432 (defun gnus-seconds-today () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
433 "Return the number of seconds passed today." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
434 (let ((now (decode-time (current-time)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
435 (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
436 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
437 (defun gnus-seconds-month () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
438 "Return the number of seconds passed this month." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
439 (let ((now (decode-time (current-time)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
440 (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
441 (* (- (car (nthcdr 3 now)) 1) 3600 24)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
442 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
443 (defun gnus-seconds-year () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
444 "Return the number of seconds passed this year." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
445 (let ((now (decode-time (current-time))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
446 (days (format-time-string "%j" (current-time)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
447 (+ (car now) (* (car (cdr now)) 60) (* (car (nthcdr 2 now)) 3600) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
448 (* (- (string-to-number days) 1) 3600 24)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
449 |
108981
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
450 (defmacro gnus-date-get-time (date) |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
451 "Convert DATE string to Emacs time. |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
452 Cache the result as a text property stored in DATE." |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
453 ;; Either return the cached value... |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
454 `(let ((d ,date)) |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
455 (if (equal "" d) |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
456 '(0 0) |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
457 (or (get-text-property 0 'gnus-time d) |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
458 ;; or compute the value... |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
459 (let ((time (safe-date-to-time d))) |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
460 ;; and store it back in the string. |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
461 (put-text-property 0 1 'gnus-time time d) |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
462 time))))) |
b7963ca9e06e
Synch with Gnus trunk.
Romain Francoise <romain@orebokech.com>
parents:
108949
diff
changeset
|
463 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
464 (defvar gnus-user-date-format-alist |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
465 '(((gnus-seconds-today) . "%k:%M") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
466 (604800 . "%a %k:%M") ;;that's one week |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
467 ((gnus-seconds-month) . "%a %d") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
468 ((gnus-seconds-year) . "%b %d") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
469 (t . "%b %d '%y")) ;;this one is used when no |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
470 ;;other does match |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
471 "Specifies date format depending on age of article. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
472 This is an alist of items (AGE . FORMAT). AGE can be a number (of |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
473 seconds) or a Lisp expression evaluating to a number. When the age of |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
474 the article is less than this number, then use `format-time-string' |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
475 with the corresponding FORMAT for displaying the date of the article. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
476 If AGE is not a number or a Lisp expression evaluating to a |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
477 non-number, then the corresponding FORMAT is used as a default value. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
478 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
479 Note that the list is processed from the beginning, so it should be |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
480 sorted by ascending AGE. Also note that items following the first |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
481 non-number AGE will be ignored. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
482 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
483 You can use the functions `gnus-seconds-today', `gnus-seconds-month' |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
484 and `gnus-seconds-year' in the AGE spec. They return the number of |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
485 seconds passed since the start of today, of this month, of this year, |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
486 respectively.") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
487 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
488 (defun gnus-user-date (messy-date) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
489 "Format the messy-date according to gnus-user-date-format-alist. |
108949
234c5347118d
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108131
diff
changeset
|
490 Returns \" ? \" if there's bad input or if another error occurs. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
491 Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
492 (condition-case () |
108949
234c5347118d
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108131
diff
changeset
|
493 (let* ((messy-date (gnus-float-time (gnus-date-get-time messy-date))) |
104806
409fc58fd03d
Pass no argument to gnus-float-time rather than current-time.
Glenn Morris <rgm@gnu.org>
parents:
104804
diff
changeset
|
494 (now (gnus-float-time)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
495 ;;If we don't find something suitable we'll use this one |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
496 (my-format "%b %d '%y")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
497 (let* ((difference (- now messy-date)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
498 (templist gnus-user-date-format-alist) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
499 (top (eval (caar templist)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
500 (while (if (numberp top) (< top difference) (not top)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
501 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
502 (setq templist (cdr templist)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
503 (setq top (eval (caar templist))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
504 (if (stringp (cdr (car templist))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
505 (setq my-format (cdr (car templist))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
506 (format-time-string (eval my-format) (seconds-to-time messy-date))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
507 (error " ? "))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
508 |
17493 | 509 (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
|
510 "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
|
511 (condition-case () |
108949
234c5347118d
Synch with Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108131
diff
changeset
|
512 (format-time-string "%d-%b" (gnus-date-get-time messy-date)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
513 (error " - "))) |
17493 | 514 |
515 (defsubst gnus-time-iso8601 (time) | |
31785 | 516 "Return a string of TIME in YYYYMMDDTHHMMSS format." |
17493 | 517 (format-time-string "%Y%m%dT%H%M%S" time)) |
518 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
519 (defun gnus-date-iso8601 (date) |
31785 | 520 "Convert the DATE to YYYYMMDDTHHMMSS." |
17493 | 521 (condition-case () |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
522 (gnus-time-iso8601 (gnus-date-get-time date)) |
17493 | 523 (error ""))) |
524 | |
525 (defun gnus-mode-string-quote (string) | |
526 "Quote all \"%\"'s in STRING." | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
527 (gnus-replace-in-string string "%" "%%")) |
17493 | 528 |
529 ;; Make a hash table (default and minimum size is 256). | |
530 ;; Optional argument HASHSIZE specifies the table size. | |
531 (defun gnus-make-hashtable (&optional hashsize) | |
532 (make-vector (if hashsize (max (gnus-create-hash-size hashsize) 256) 256) 0)) | |
533 | |
534 ;; Make a number that is suitable for hashing; bigger than MIN and | |
535 ;; equal to some 2^x. Many machines (such as sparcs) do not have a | |
536 ;; hardware modulo operation, so they implement it in software. On | |
537 ;; many sparcs over 50% of the time to intern is spent in the modulo. | |
538 ;; Yes, it's slower than actually computing the hash from the string! | |
539 ;; So we use powers of 2 so people can optimize the modulo to a mask. | |
540 (defun gnus-create-hash-size (min) | |
541 (let ((i 1)) | |
542 (while (< i min) | |
543 (setq i (* 2 i))) | |
544 i)) | |
545 | |
546 (defcustom gnus-verbose 7 | |
547 "*Integer that says how verbose Gnus should be. | |
548 The higher the number, the more messages Gnus will flash to say what | |
549 it's doing. At zero, Gnus will be totally mute; at five, Gnus will | |
550 display most important messages; and at ten, Gnus will keep on | |
551 jabbering all the time." | |
552 :group 'gnus-start | |
553 :type 'integer) | |
554 | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
555 (defcustom gnus-add-timestamp-to-message nil |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
556 "Non-nil means add timestamps to messages that Gnus issues. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
557 If it is `log', add timestamps to only the messages that go into the |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
558 \"*Messages*\" buffer (in XEmacs, it is the \" *Message-Log*\" buffer). |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
559 If it is neither nil nor `log', add timestamps not only to log messages |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
560 but also to the ones displayed in the echo area." |
92336
5f827896103e
Change defcustom :version from 23.0 to 23.1.
Glenn Morris <rgm@gnu.org>
parents:
92147
diff
changeset
|
561 :version "23.1" ;; No Gnus |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
562 :group 'gnus-various |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
563 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v" |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
564 (const :tag "Logged messages only" log) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
565 (sexp :tag "All messages" |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
566 :match (lambda (widget value) value) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
567 :value t) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
568 (const :tag "No timestamp" nil))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
569 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
570 (eval-when-compile |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
571 (defmacro gnus-message-with-timestamp-1 (format-string args) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
572 (let ((timestamp '((format-time-string "%Y%m%dT%H%M%S" time) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
573 "." (format "%03d" (/ (nth 2 time) 1000)) "> "))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
574 (if (featurep 'xemacs) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
575 `(let (str time) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
576 (if (or (and (null ,format-string) (null ,args)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
577 (progn |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
578 (setq str (apply 'format ,format-string ,args)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
579 (zerop (length str)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
580 (prog1 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
581 (and ,format-string str) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
582 (clear-message nil)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
583 (cond ((eq gnus-add-timestamp-to-message 'log) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
584 (setq time (current-time)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
585 (display-message 'no-log str) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
586 (log-message 'message (concat ,@timestamp str))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
587 (gnus-add-timestamp-to-message |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
588 (setq time (current-time)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
589 (display-message 'message (concat ,@timestamp str))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
590 (t |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
591 (display-message 'message str)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
592 str) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
593 `(let (str time) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
594 (cond ((eq gnus-add-timestamp-to-message 'log) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
595 (setq str (let (message-log-max) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
596 (apply 'message ,format-string ,args))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
597 (when (and message-log-max |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
598 (> message-log-max 0) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
599 (/= (length str) 0)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
600 (setq time (current-time)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
601 (with-current-buffer (get-buffer-create "*Messages*") |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
602 (goto-char (point-max)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
603 (insert ,@timestamp str "\n") |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
604 (forward-line (- message-log-max)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
605 (delete-region (point-min) (point)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
606 (goto-char (point-max)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
607 str) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
608 (gnus-add-timestamp-to-message |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
609 (if (or (and (null ,format-string) (null ,args)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
610 (progn |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
611 (setq str (apply 'format ,format-string ,args)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
612 (zerop (length str)))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
613 (prog1 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
614 (and ,format-string str) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
615 (message nil)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
616 (setq time (current-time)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
617 (message "%s" (concat ,@timestamp str)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
618 str)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
619 (t |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
620 (apply 'message ,format-string ,args)))))))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
621 |
110596
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
622 (defvar gnus-action-message-log nil) |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
623 |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
624 (defun gnus-message-with-timestamp (format-string &rest args) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
625 "Display message with timestamp. Arguments are the same as `message'. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
626 The `gnus-add-timestamp-to-message' variable controls how to add |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
627 timestamp to message." |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
628 (gnus-message-with-timestamp-1 format-string args)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
629 |
17493 | 630 (defun gnus-message (level &rest args) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
631 "If LEVEL is lower than `gnus-verbose' print ARGS using `message'. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
632 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
633 Guideline for numbers: |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
634 1 - error messages, 3 - non-serious error messages, 5 - messages for things |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
635 that take a long time, 7 - not very important messages on stuff, 9 - messages |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
636 inside loops." |
17493 | 637 (if (<= level gnus-verbose) |
110596
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
638 (let ((message |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
639 (if gnus-add-timestamp-to-message |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
640 (apply 'gnus-message-with-timestamp args) |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
641 (apply 'message args)))) |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
642 (when (and (consp gnus-action-message-log) |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
643 (<= level 3)) |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
644 (push message gnus-action-message-log)) |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
645 message) |
17493 | 646 ;; We have to do this format thingy here even if the result isn't |
647 ;; shown - the return value has to be the same as the return value | |
648 ;; from `message'. | |
649 (apply 'format args))) | |
650 | |
110596
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
651 (defun gnus-final-warning () |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
652 (when (and (consp gnus-action-message-log) |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
653 (setq gnus-action-message-log |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
654 (delete nil gnus-action-message-log))) |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
655 (message "Warning: %s" |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
656 (mapconcat #'identity gnus-action-message-log "; ")))) |
415e87a42437
mail-source.el (mail-source-value): Revert previous patch.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110542
diff
changeset
|
657 |
17493 | 658 (defun gnus-error (level &rest args) |
68606
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
65846
diff
changeset
|
659 "Beep an error if LEVEL is equal to or less than `gnus-verbose'. |
5ea0e0a7dd38
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-42
Miles Bader <miles@gnu.org>
parents:
65846
diff
changeset
|
660 ARGS are passed to `message'." |
17493 | 661 (when (<= (floor level) gnus-verbose) |
662 (apply 'message args) | |
663 (ding) | |
664 (let (duration) | |
665 (when (and (floatp level) | |
666 (not (zerop (setq duration (* 10 (- level (floor level))))))) | |
667 (sit-for duration)))) | |
668 nil) | |
669 | |
670 (defun gnus-split-references (references) | |
671 "Return a list of Message-IDs in REFERENCES." | |
672 (let ((beg 0) | |
98366
ef06f769799e
(gnus-split-references): Strip comments.
Andreas Schwab <schwab@suse.de>
parents:
96867
diff
changeset
|
673 (references (mail-header-remove-comments (or references ""))) |
17493 | 674 ids) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
675 (while (string-match "<[^<]+[^< \t]" references beg) |
17493 | 676 (push (substring references (match-beginning 0) (setq beg (match-end 0))) |
677 ids)) | |
678 (nreverse ids))) | |
679 | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
680 (defun gnus-extract-references (references) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
681 "Return a list of Message-IDs in REFERENCES (in In-Reply-To |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
682 format), trimmed to only contain the Message-IDs." |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
683 (let ((ids (gnus-split-references references)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
684 refs) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
685 (dolist (id ids) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
686 (when (string-match "<[^<>]+>" id) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
687 (push (match-string 0 id) refs))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
688 refs)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
689 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
690 (defsubst gnus-parent-id (references &optional n) |
17493 | 691 "Return the last Message-ID in REFERENCES. |
692 If N, return the Nth ancestor instead." | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
693 (when (and references |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
694 (not (zerop (length references)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
695 (if n |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
696 (let ((ids (inline (gnus-split-references references)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
697 (while (nthcdr n ids) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
698 (setq ids (cdr ids))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
699 (car ids)) |
98366
ef06f769799e
(gnus-split-references): Strip comments.
Andreas Schwab <schwab@suse.de>
parents:
96867
diff
changeset
|
700 (let ((references (mail-header-remove-comments references))) |
ef06f769799e
(gnus-split-references): Strip comments.
Andreas Schwab <schwab@suse.de>
parents:
96867
diff
changeset
|
701 (when (string-match "\\(<[^<]+>\\)[ \t]*\\'" references) |
ef06f769799e
(gnus-split-references): Strip comments.
Andreas Schwab <schwab@suse.de>
parents:
96867
diff
changeset
|
702 (match-string 1 references)))))) |
17493 | 703 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
704 (defun gnus-buffer-live-p (buffer) |
17493 | 705 "Say whether BUFFER is alive or not." |
706 (and buffer | |
707 (get-buffer buffer) | |
708 (buffer-name (get-buffer buffer)))) | |
709 | |
710 (defun gnus-horizontal-recenter () | |
711 "Recenter the current buffer horizontally." | |
712 (if (< (current-column) (/ (window-width) 2)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
713 (set-window-hscroll (gnus-get-buffer-window (current-buffer) t) 0) |
17493 | 714 (let* ((orig (point)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
715 (end (window-end (gnus-get-buffer-window (current-buffer) t))) |
17493 | 716 (max 0)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
717 (when end |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
718 ;; 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
|
719 (goto-char (window-start)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
720 (while (and (not (eobp)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
721 (< (point) end)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
722 (end-of-line) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
723 (setq max (max max (current-column))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
724 (forward-line 1)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
725 (goto-char orig) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
726 ;; 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
|
727 (if (> max (window-width)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
728 (set-window-hscroll |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
729 (gnus-get-buffer-window (current-buffer) t) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
730 (min (- (current-column) (/ (window-width) 3)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
731 (+ 2 (- max (window-width))))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
732 (set-window-hscroll (gnus-get-buffer-window (current-buffer) t) 0)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
733 max)))) |
17493 | 734 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
735 (defun gnus-read-event-char (&optional prompt) |
17493 | 736 "Get the next event." |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
737 (let ((event (read-event prompt))) |
17493 | 738 ;; should be gnus-characterp, but this can't be called in XEmacs anyway |
739 (cons (and (numberp event) event) event))) | |
740 | |
741 (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
|
742 "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
|
743 (gnus-time-iso8601 (date-to-time date))) |
17493 | 744 |
745 (defun gnus-copy-file (file &optional to) | |
746 "Copy FILE to TO." | |
747 (interactive | |
748 (list (read-file-name "Copy file: " default-directory) | |
749 (read-file-name "Copy file to: " default-directory))) | |
750 (unless to | |
751 (setq to (read-file-name "Copy file to: " default-directory))) | |
752 (when (file-directory-p to) | |
753 (setq to (concat (file-name-as-directory to) | |
754 (file-name-nondirectory file)))) | |
755 (copy-file file to)) | |
756 | |
757 (defvar gnus-work-buffer " *gnus work*") | |
758 | |
87263
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
759 (declare-function gnus-get-buffer-create "gnus" (name)) |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
760 ;; gnus.el requires mm-util. |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
761 (declare-function mm-enable-multibyte "mm-util") |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
762 |
17493 | 763 (defun gnus-set-work-buffer () |
764 "Put point in the empty Gnus work buffer." | |
765 (if (get-buffer gnus-work-buffer) | |
766 (progn | |
767 (set-buffer gnus-work-buffer) | |
768 (erase-buffer)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
769 (set-buffer (gnus-get-buffer-create gnus-work-buffer)) |
17493 | 770 (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
|
771 (mm-enable-multibyte))) |
17493 | 772 |
773 (defmacro gnus-group-real-name (group) | |
774 "Find the real name of a foreign newsgroup." | |
775 `(let ((gname ,group)) | |
776 (if (string-match "^[^:]+:" gname) | |
777 (substring gname (match-end 0)) | |
778 gname))) | |
779 | |
72509 | 780 (defmacro gnus-group-server (group) |
781 "Find the server name of a foreign newsgroup. | |
782 For example, (gnus-group-server \"nnimap+yxa:INBOX.foo\") would | |
783 yield \"nnimap:yxa\"." | |
784 `(let ((gname ,group)) | |
785 (if (string-match "^\\([^:+]+\\)\\(?:\\+\\([^:]*\\)\\)?:" gname) | |
786 (format "%s:%s" (match-string 1 gname) (or | |
787 (match-string 2 gname) | |
788 "")) | |
789 (format "%s:%s" (car gnus-select-method) (cadr gnus-select-method))))) | |
790 | |
17493 | 791 (defun gnus-make-sort-function (funs) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
792 "Return a composite sort condition based on the functions in FUNS." |
17493 | 793 (cond |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
794 ;; Just a simple function. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
795 ((functionp funs) funs) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
796 ;; No functions at all. |
17493 | 797 ((null funs) funs) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
798 ;; A list of functions. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
799 ((or (cdr funs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
800 (listp (car funs))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
801 (gnus-byte-compile |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
802 `(lambda (t1 t2) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
803 ,(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
|
804 ;; A list containing just one function. |
17493 | 805 (t |
806 (car funs)))) | |
807 | |
808 (defun gnus-make-sort-function-1 (funs) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
809 "Return a composite sort condition based on the functions in FUNS." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
810 (let ((function (car funs)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
811 (first 't1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
812 (last 't2)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
813 (when (consp function) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
814 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
815 ;; Reversed spec. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
816 ((eq (car function) 'not) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
817 (setq function (cadr function) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
818 first 't2 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
819 last 't1)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
820 ((functionp function) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
821 ;; Do nothing. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
822 ) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
823 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
824 (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
|
825 (if (cdr funs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
826 `(or (,function ,first ,last) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
827 (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
|
828 ,(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
|
829 `(,function ,first ,last)))) |
17493 | 830 |
831 (defun gnus-turn-off-edit-menu (type) | |
832 "Turn off edit menu in `gnus-TYPE-mode-map'." | |
833 (define-key (symbol-value (intern (format "gnus-%s-mode-map" type))) | |
834 [menu-bar edit] 'undefined)) | |
835 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
836 (defmacro gnus-bind-print-variables (&rest forms) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
837 "Bind print-* variables and evaluate FORMS. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
838 This macro is used with `prin1', `pp', etc. in order to ensure printed |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
839 Lisp objects are loadable. Bind `print-quoted' and `print-readably' |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
840 to t, and `print-escape-multibyte', `print-escape-newlines', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
841 `print-escape-nonascii', `print-length', `print-level' and |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
842 `print-string-length' to nil." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
843 `(let ((print-quoted t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
844 (print-readably t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
845 ;;print-circle |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
846 ;;print-continuous-numbering |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
847 print-escape-multibyte |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
848 print-escape-newlines |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
849 print-escape-nonascii |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
850 ;;print-gensym |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
851 print-length |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
852 print-level |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
853 print-string-length) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
854 ,@forms)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
855 |
17493 | 856 (defun gnus-prin1 (form) |
857 "Use `prin1' on FORM in the current buffer. | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
858 Bind `print-quoted' and `print-readably' to t, and `print-length' and |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
859 `print-level' to nil. See also `gnus-bind-print-variables'." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
860 (gnus-bind-print-variables (prin1 form (current-buffer)))) |
17493 | 861 |
862 (defun gnus-prin1-to-string (form) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
863 "The same as `prin1'. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
864 Bind `print-quoted' and `print-readably' to t, and `print-length' and |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
865 `print-level' to nil. See also `gnus-bind-print-variables'." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
866 (gnus-bind-print-variables (prin1-to-string form))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
867 |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
868 (defun gnus-pp (form &optional stream) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
869 "Use `pp' on FORM in the current buffer. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
870 Bind `print-quoted' and `print-readably' to t, and `print-length' and |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
871 `print-level' to nil. See also `gnus-bind-print-variables'." |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
872 (gnus-bind-print-variables (pp form (or stream (current-buffer))))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
873 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
874 (defun gnus-pp-to-string (form) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
875 "The same as `pp-to-string'. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
876 Bind `print-quoted' and `print-readably' to t, and `print-length' and |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
877 `print-level' to nil. See also `gnus-bind-print-variables'." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
878 (gnus-bind-print-variables (pp-to-string form))) |
17493 | 879 |
880 (defun gnus-make-directory (directory) | |
881 "Make DIRECTORY (and all its parents) if it doesn't exist." | |
35051
d80c28ab0b86
(nnmail-pathname-coding-system): Defvar when
Dave Love <fx@gnu.org>
parents:
34833
diff
changeset
|
882 (require 'nnmail) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
883 (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
|
884 (when (and directory |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
885 (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
|
886 (make-directory directory t))) |
17493 | 887 t) |
888 | |
889 (defun gnus-write-buffer (file) | |
890 "Write the current buffer's contents to FILE." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
891 (let ((file-name-coding-system nnmail-pathname-coding-system)) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
892 ;; Make sure the directory exists. |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
893 (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
|
894 ;; Write the buffer. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
895 (write-region (point-min) (point-max) file nil 'quietly))) |
17493 | 896 |
897 (defun gnus-delete-file (file) | |
898 "Delete FILE if it exists." | |
899 (when (file-exists-p file) | |
900 (delete-file file))) | |
901 | |
59089
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
902 (defun gnus-delete-directory (directory) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
903 "Delete files in DIRECTORY. Subdirectories remain. |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
904 If there's no subdirectory, delete DIRECTORY as well." |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
905 (when (file-directory-p directory) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
906 (let ((files (directory-files |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
907 directory t "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
908 file dir) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
909 (while files |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
910 (setq file (pop files)) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
911 (if (eq t (car (file-attributes file))) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
912 ;; `file' is a subdirectory. |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
913 (setq dir t) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
914 ;; `file' is a file or a symlink. |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
915 (delete-file file))) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
916 (unless dir |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
917 (delete-directory directory))))) |
22da0004ae3c
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-750
Miles Bader <miles@gnu.org>
parents:
58835
diff
changeset
|
918 |
73269 | 919 ;; The following two functions are used in gnus-registry. |
920 ;; They were contributed by Andreas Fuchs <asf@void.at>. | |
921 (defun gnus-alist-to-hashtable (alist) | |
922 "Build a hashtable from the values in ALIST." | |
923 (let ((ht (make-hash-table | |
924 :size 4096 | |
925 :test 'equal))) | |
926 (mapc | |
927 (lambda (kv-pair) | |
928 (puthash (car kv-pair) (cdr kv-pair) ht)) | |
929 alist) | |
930 ht)) | |
931 | |
932 (defun gnus-hashtable-to-alist (hash) | |
933 "Build an alist from the values in HASH." | |
934 (let ((list nil)) | |
935 (maphash | |
936 (lambda (key value) | |
937 (setq list (cons (cons key value) list))) | |
938 hash) | |
939 list)) | |
940 | |
17493 | 941 (defun gnus-strip-whitespace (string) |
942 "Return STRING stripped of all whitespace." | |
943 (while (string-match "[\r\n\t ]+" string) | |
944 (setq string (replace-match "" t t string))) | |
945 string) | |
946 | |
87263
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
947 (declare-function gnus-put-text-property "gnus" |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
948 (start end property value &optional object)) |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
949 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
950 (defsubst gnus-put-text-property-excluding-newlines (beg end prop val) |
17493 | 951 "The same as `put-text-property', but don't put this prop on any newlines in the region." |
952 (save-match-data | |
953 (save-excursion | |
954 (save-restriction | |
955 (goto-char beg) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
956 (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
|
957 (gnus-put-text-property beg (match-beginning 0) prop val) |
17493 | 958 (setq beg (point))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
959 (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
|
960 |
87263
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
961 (declare-function gnus-overlay-put "gnus" (overlay prop value)) |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
962 (declare-function gnus-make-overlay "gnus" |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
963 (beg end &optional buffer front-advance rear-advance)) |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
964 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
965 (defsubst gnus-put-overlay-excluding-newlines (beg end prop val) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
966 "The same as `put-text-property', but don't put this prop on any newlines in the region." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
967 (save-match-data |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
968 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
969 (save-restriction |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
970 (goto-char beg) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
971 (while (re-search-forward gnus-emphasize-whitespace-regexp end 'move) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
972 (gnus-overlay-put |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
973 (gnus-make-overlay beg (match-beginning 0)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
974 prop val) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
975 (setq beg (point))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
976 (gnus-overlay-put (gnus-make-overlay beg (point)) prop val))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
977 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
978 (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
|
979 prop val) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
980 "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
|
981 (let ((b beg)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
982 (while (/= b end) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
983 (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
|
984 (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
|
985 (when (/= b end) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
986 (inline |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
987 (gnus-put-text-property |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
988 b (setq b (next-single-property-change b 'gnus-face nil end)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
989 prop val)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
990 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
991 (defmacro gnus-faces-at (position) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
992 "Return a list of faces at POSITION." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
993 (if (featurep 'xemacs) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
994 `(let ((pos ,position)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
995 (mapcar-extents 'extent-face |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
996 nil (current-buffer) pos pos nil 'face)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
997 `(let ((pos ,position)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
998 (delq nil (cons (get-text-property pos 'face) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
999 (mapcar |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1000 (lambda (overlay) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1001 (overlay-get overlay 'face)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1002 (overlays-at pos))))))) |
17493 | 1003 |
106744 | 1004 (if (fboundp 'invisible-p) |
1005 (defalias 'gnus-invisible-p 'invisible-p) | |
1006 ;; for Emacs < 22.2, and XEmacs. | |
1007 (defun gnus-invisible-p (pos) | |
1008 "Return non-nil if the character after POS is currently invisible." | |
1009 (let ((prop (get-char-property pos 'invisible))) | |
1010 (if (eq buffer-invisibility-spec t) | |
1011 prop | |
1012 (or (memq prop buffer-invisibility-spec) | |
1013 (assq prop buffer-invisibility-spec)))))) | |
1014 | |
1015 ;; Note: the optional 2nd argument has a different meaning between | |
1016 ;; Emacs and XEmacs. | |
1017 ;; (next-char-property-change POSITION &optional LIMIT) | |
1018 ;; (next-extent-change POS &optional OBJECT) | |
1019 (defalias 'gnus-next-char-property-change | |
1020 (if (fboundp 'next-extent-change) | |
1021 'next-extent-change 'next-char-property-change)) | |
1022 | |
1023 (defalias 'gnus-previous-char-property-change | |
1024 (if (fboundp 'previous-extent-change) | |
1025 'previous-extent-change 'previous-char-property-change)) | |
1026 | |
17493 | 1027 ;;; Protected and atomic operations. dmoore@ucsd.edu 21.11.1996 |
95586
64da3838a9aa
* gnus-util.el (gnus-read-shell-command): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94748
diff
changeset
|
1028 ;; The primary idea here is to try to protect internal datastructures |
64da3838a9aa
* gnus-util.el (gnus-read-shell-command): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94748
diff
changeset
|
1029 ;; from becoming corrupted when the user hits C-g, or if a hook or |
64da3838a9aa
* gnus-util.el (gnus-read-shell-command): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94748
diff
changeset
|
1030 ;; similar blows up. Often in Gnus multiple tables/lists need to be |
64da3838a9aa
* gnus-util.el (gnus-read-shell-command): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94748
diff
changeset
|
1031 ;; updated at the same time, or information can be lost. |
17493 | 1032 |
1033 (defvar gnus-atomic-be-safe t | |
1034 "If t, certain operations will be protected from interruption by C-g.") | |
1035 | |
1036 (defmacro gnus-atomic-progn (&rest forms) | |
1037 "Evaluate FORMS atomically, which means to protect the evaluation | |
1038 from being interrupted by the user. An error from the forms themselves | |
1039 will return without finishing the operation. Since interrupts from | |
1040 the user are disabled, it is recommended that only the most minimal | |
1041 operations are performed by FORMS. If you wish to assign many | |
1042 complicated values atomically, compute the results into temporary | |
1043 variables and then do only the assignment atomically." | |
1044 `(let ((inhibit-quit gnus-atomic-be-safe)) | |
1045 ,@forms)) | |
1046 | |
1047 (put 'gnus-atomic-progn 'lisp-indent-function 0) | |
1048 | |
1049 (defmacro gnus-atomic-progn-assign (protect &rest forms) | |
95586
64da3838a9aa
* gnus-util.el (gnus-read-shell-command): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94748
diff
changeset
|
1050 "Evaluate FORMS, but ensure that the variables listed in PROTECT |
17493 | 1051 are not changed if anything in FORMS signals an error or otherwise |
1052 non-locally exits. The variables listed in PROTECT are updated atomically. | |
1053 It is safe to use gnus-atomic-progn-assign with long computations. | |
1054 | |
1055 Note that if any of the symbols in PROTECT were unbound, they will be | |
48588 | 1056 set to nil on a successful assignment. In case of an error or other |
17493 | 1057 non-local exit, it will still be unbound." |
1058 (let* ((temp-sym-map (mapcar (lambda (x) (list (make-symbol | |
1059 (concat (symbol-name x) | |
1060 "-tmp")) | |
1061 x)) | |
1062 protect)) | |
1063 (sym-temp-map (mapcar (lambda (x) (list (cadr x) (car x))) | |
1064 temp-sym-map)) | |
1065 (temp-sym-let (mapcar (lambda (x) (list (car x) | |
1066 `(and (boundp ',(cadr x)) | |
1067 ,(cadr x)))) | |
1068 temp-sym-map)) | |
1069 (sym-temp-let sym-temp-map) | |
1070 (temp-sym-assign (apply 'append temp-sym-map)) | |
1071 (sym-temp-assign (apply 'append sym-temp-map)) | |
1072 (result (make-symbol "result-tmp"))) | |
1073 `(let (,@temp-sym-let | |
1074 ,result) | |
1075 (let ,sym-temp-let | |
1076 (setq ,result (progn ,@forms)) | |
1077 (setq ,@temp-sym-assign)) | |
1078 (let ((inhibit-quit gnus-atomic-be-safe)) | |
1079 (setq ,@sym-temp-assign)) | |
1080 ,result))) | |
1081 | |
1082 (put 'gnus-atomic-progn-assign 'lisp-indent-function 1) | |
1083 ;(put 'gnus-atomic-progn-assign 'edebug-form-spec '(sexp body)) | |
1084 | |
1085 (defmacro gnus-atomic-setq (&rest pairs) | |
1086 "Similar to setq, except that the real symbols are only assigned when | |
1087 there are no errors. And when the real symbols are assigned, they are | |
1088 done so atomically. If other variables might be changed via side-effect, | |
1089 see gnus-atomic-progn-assign. It is safe to use gnus-atomic-setq | |
1090 with potentially long computations." | |
1091 (let ((tpairs pairs) | |
1092 syms) | |
1093 (while tpairs | |
1094 (push (car tpairs) syms) | |
1095 (setq tpairs (cddr tpairs))) | |
1096 `(gnus-atomic-progn-assign ,syms | |
1097 (setq ,@pairs)))) | |
1098 | |
1099 ;(put 'gnus-atomic-setq 'edebug-form-spec '(body)) | |
1100 | |
1101 | |
1102 ;;; Functions for saving to babyl/mail files. | |
1103 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1104 (eval-when-compile |
108131
aacd4ee6c3af
Don't load tm and apel XEmacs packages when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
107427
diff
changeset
|
1105 (if (featurep 'xemacs) |
aacd4ee6c3af
Don't load tm and apel XEmacs packages when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
107427
diff
changeset
|
1106 ;; Don't load tm and apel XEmacs packages that provide some |
aacd4ee6c3af
Don't load tm and apel XEmacs packages when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
107427
diff
changeset
|
1107 ;; Emacs emulating functions and variables. |
aacd4ee6c3af
Don't load tm and apel XEmacs packages when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
107427
diff
changeset
|
1108 (let ((features features)) |
aacd4ee6c3af
Don't load tm and apel XEmacs packages when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
107427
diff
changeset
|
1109 (provide 'tm-view) |
aacd4ee6c3af
Don't load tm and apel XEmacs packages when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
107427
diff
changeset
|
1110 (unless (fboundp 'set-alist) (defalias 'set-alist 'ignore)) |
aacd4ee6c3af
Don't load tm and apel XEmacs packages when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
107427
diff
changeset
|
1111 (require 'rmail)) ;; It requires tm-view that loads apel. |
aacd4ee6c3af
Don't load tm and apel XEmacs packages when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
107427
diff
changeset
|
1112 (require 'rmail)) |
aacd4ee6c3af
Don't load tm and apel XEmacs packages when compiling.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
107427
diff
changeset
|
1113 (autoload 'rmail-update-summary "rmailsum")) |
86154 | 1114 |
1115 (defvar mm-text-coding-system) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1116 |
87190
5e1044759e6c
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
1117 (declare-function mm-append-to-file "mm-util" |
5e1044759e6c
(declare-function): Add compatibility declaration.
Glenn Morris <rgm@gnu.org>
parents:
86154
diff
changeset
|
1118 (start end filename &optional codesys inhibit)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1119 |
17493 | 1120 (defun gnus-output-to-rmail (filename &optional ask) |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1121 "Append the current article to an Rmail file named FILENAME. |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1122 In Emacs 22 this writes Babyl format; in Emacs 23 it writes mbox unless |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1123 FILENAME exists and is Babyl format." |
17493 | 1124 (require 'rmail) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1125 (require 'mm-util) |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1126 ;; Some of this codes is borrowed from rmailout.el. |
17493 | 1127 (setq filename (expand-file-name filename)) |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1128 ;; FIXME should we really be messing with this defcustom? |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1129 ;; It is not needed for the operation of this function. |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1130 (if (boundp 'rmail-default-rmail-file) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1131 (setq rmail-default-rmail-file filename) ; 22 |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1132 (setq rmail-default-file filename)) ; 23 |
17493 | 1133 (let ((artbuf (current-buffer)) |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1134 (tmpbuf (get-buffer-create " *Gnus-output*")) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1135 ;; Babyl rmail.el defines this, mbox does not. |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1136 (babyl (fboundp 'rmail-insert-rmail-file-header))) |
17493 | 1137 (save-excursion |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1138 ;; Note that we ignore the possibility of visiting a Babyl |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1139 ;; format buffer in Emacs 23, since Rmail no longer supports that. |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1140 (or (get-file-buffer filename) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1141 (progn |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1142 ;; In case someone wants to write to a Babyl file from Emacs 23. |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1143 (when (file-exists-p filename) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1144 (setq babyl (mail-file-babyl-p filename)) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1145 t)) |
17493 | 1146 (if (or (not ask) |
1147 (gnus-yes-or-no-p | |
1148 (concat "\"" filename "\" does not exist, create it? "))) | |
1149 (let ((file-buffer (create-file-buffer filename))) | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110158
diff
changeset
|
1150 (with-current-buffer file-buffer |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1151 (if (fboundp 'rmail-insert-rmail-file-header) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1152 (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
|
1153 (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
|
1154 (coding-system-for-write mm-text-coding-system)) |
17493 | 1155 (gnus-write-buffer filename))) |
1156 (kill-buffer file-buffer)) | |
1157 (error "Output file does not exist"))) | |
1158 (set-buffer tmpbuf) | |
1159 (erase-buffer) | |
1160 (insert-buffer-substring artbuf) | |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1161 (if babyl |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1162 (gnus-convert-article-to-rmail) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1163 ;; Non-Babyl case copied from gnus-output-to-mail. |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1164 (goto-char (point-min)) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1165 (if (looking-at "From ") |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1166 (forward-line 1) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1167 (insert "From nobody " (current-time-string) "\n")) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1168 (let (case-fold-search) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1169 (while (re-search-forward "^From " nil t) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1170 (beginning-of-line) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1171 (insert ">")))) |
17493 | 1172 ;; Decide whether to append to a file or to an Emacs buffer. |
1173 (let ((outbuf (get-file-buffer filename))) | |
1174 (if (not outbuf) | |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1175 (progn |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1176 (unless babyl ; from gnus-output-to-mail |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1177 (let ((buffer-read-only nil)) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1178 (goto-char (point-max)) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1179 (forward-char -2) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1180 (unless (looking-at "\n\n") |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1181 (goto-char (point-max)) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1182 (unless (bolp) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1183 (insert "\n")) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1184 (insert "\n")))) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1185 (let ((file-name-coding-system nnmail-pathname-coding-system)) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1186 (mm-append-to-file (point-min) (point-max) filename))) |
17493 | 1187 ;; File has been visited, in buffer OUTBUF. |
1188 (set-buffer outbuf) | |
1189 (let ((buffer-read-only nil) | |
1190 (msg (and (boundp 'rmail-current-message) | |
1191 (symbol-value 'rmail-current-message)))) | |
1192 ;; If MSG is non-nil, buffer is in RMAIL mode. | |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1193 ;; Compare this with rmail-output-to-rmail-buffer in Emacs 23. |
17493 | 1194 (when msg |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1195 (unless babyl |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1196 (rmail-swap-buffers-maybe) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1197 (rmail-maybe-set-message-counters)) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1198 (widen) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1199 (narrow-to-region (point-max) (point-max))) |
17493 | 1200 (insert-buffer-substring tmpbuf) |
1201 (when msg | |
102044
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1202 (when babyl |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1203 (goto-char (point-min)) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1204 (widen) |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1205 (search-backward "\n\^_") |
8cc6c7d847fe
(rmail-insert-rmail-file-header, rmail-count-new-messages)
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
1206 (narrow-to-region (point) (point-max))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1207 (rmail-count-new-messages t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1208 (when (rmail-summary-exists) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1209 (rmail-select-summary |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1210 (rmail-update-summary))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1211 (rmail-show-message msg)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1212 (save-buffer))))) |
17493 | 1213 (kill-buffer tmpbuf))) |
1214 | |
1215 (defun gnus-output-to-mail (filename &optional ask) | |
1216 "Append the current article to a mail file named FILENAME." | |
1217 (setq filename (expand-file-name filename)) | |
1218 (let ((artbuf (current-buffer)) | |
1219 (tmpbuf (get-buffer-create " *Gnus-output*"))) | |
1220 (save-excursion | |
1221 ;; Create the file, if it doesn't exist. | |
1222 (when (and (not (get-file-buffer filename)) | |
1223 (not (file-exists-p filename))) | |
1224 (if (or (not ask) | |
1225 (gnus-y-or-n-p | |
1226 (concat "\"" filename "\" does not exist, create it? "))) | |
1227 (let ((file-buffer (create-file-buffer filename))) | |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110158
diff
changeset
|
1228 (with-current-buffer file-buffer |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1229 (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
|
1230 (coding-system-for-write mm-text-coding-system)) |
17493 | 1231 (gnus-write-buffer filename))) |
1232 (kill-buffer file-buffer)) | |
1233 (error "Output file does not exist"))) | |
1234 (set-buffer tmpbuf) | |
1235 (erase-buffer) | |
1236 (insert-buffer-substring artbuf) | |
1237 (goto-char (point-min)) | |
1238 (if (looking-at "From ") | |
1239 (forward-line 1) | |
1240 (insert "From nobody " (current-time-string) "\n")) | |
1241 (let (case-fold-search) | |
1242 (while (re-search-forward "^From " nil t) | |
1243 (beginning-of-line) | |
1244 (insert ">"))) | |
1245 ;; Decide whether to append to a file or to an Emacs buffer. | |
1246 (let ((outbuf (get-file-buffer filename))) | |
1247 (if (not outbuf) | |
1248 (let ((buffer-read-only nil)) | |
1249 (save-excursion | |
1250 (goto-char (point-max)) | |
1251 (forward-char -2) | |
1252 (unless (looking-at "\n\n") | |
1253 (goto-char (point-max)) | |
1254 (unless (bolp) | |
1255 (insert "\n")) | |
1256 (insert "\n")) | |
1257 (goto-char (point-max)) | |
38861
f8833aa83b5e
* gnus-art.el (gnus-output-to-file): Bind file-name-coding-system.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35051
diff
changeset
|
1258 (let ((file-name-coding-system nnmail-pathname-coding-system)) |
f8833aa83b5e
* gnus-art.el (gnus-output-to-file): Bind file-name-coding-system.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35051
diff
changeset
|
1259 (mm-append-to-file (point-min) (point-max) filename)))) |
17493 | 1260 ;; File has been visited, in buffer OUTBUF. |
1261 (set-buffer outbuf) | |
1262 (let ((buffer-read-only nil)) | |
1263 (goto-char (point-max)) | |
1264 (unless (eobp) | |
1265 (insert "\n")) | |
1266 (insert "\n") | |
1267 (insert-buffer-substring tmpbuf))))) | |
1268 (kill-buffer tmpbuf))) | |
1269 | |
1270 (defun gnus-convert-article-to-rmail () | |
1271 "Convert article in current buffer to Rmail message format." | |
1272 (let ((buffer-read-only nil)) | |
1273 ;; Convert article directly into Babyl format. | |
1274 (goto-char (point-min)) | |
1275 (insert "\^L\n0, unseen,,\n*** EOOH ***\n") | |
1276 (while (search-forward "\n\^_" nil t) ;single char | |
1277 (replace-match "\n^_" t t)) ;2 chars: "^" and "_" | |
1278 (goto-char (point-max)) | |
1279 (insert "\^_"))) | |
1280 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1281 (defun gnus-map-function (funs arg) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1282 "Apply the result of the first function in FUNS to the second, and so on. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1283 ARG is passed to the first function." |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1284 (while funs |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1285 (setq arg (funcall (pop funs) arg))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1286 arg) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1287 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1288 (defun gnus-run-hooks (&rest funcs) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1289 "Does the same as `run-hooks', but saves the current buffer." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1290 (save-current-buffer |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1291 (apply 'run-hooks funcs))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1292 |
110799
d2b45bb936b6
gnus-int.el, gnus-util.el: Gnus hooks for the mark get/set operations.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110779
diff
changeset
|
1293 (defun gnus-run-hook-with-args (hook &rest args) |
d2b45bb936b6
gnus-int.el, gnus-util.el: Gnus hooks for the mark get/set operations.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110779
diff
changeset
|
1294 "Does the same as `run-hook-with-args', but saves the current buffer." |
d2b45bb936b6
gnus-int.el, gnus-util.el: Gnus hooks for the mark get/set operations.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110779
diff
changeset
|
1295 (save-current-buffer |
d2b45bb936b6
gnus-int.el, gnus-util.el: Gnus hooks for the mark get/set operations.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110779
diff
changeset
|
1296 (apply 'run-hook-with-args hook args))) |
d2b45bb936b6
gnus-int.el, gnus-util.el: Gnus hooks for the mark get/set operations.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110779
diff
changeset
|
1297 |
62791
a03b1bd1f66c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-330
Miles Bader <miles@gnu.org>
parents:
59996
diff
changeset
|
1298 (defun gnus-run-mode-hooks (&rest funcs) |
62890
4b7fa3ee8e9e
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-336
Miles Bader <miles@gnu.org>
parents:
62791
diff
changeset
|
1299 "Run `run-mode-hooks' if it is available, otherwise `run-hooks'. |
4b7fa3ee8e9e
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-336
Miles Bader <miles@gnu.org>
parents:
62791
diff
changeset
|
1300 This function saves the current buffer." |
62791
a03b1bd1f66c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-330
Miles Bader <miles@gnu.org>
parents:
59996
diff
changeset
|
1301 (if (fboundp 'run-mode-hooks) |
62890
4b7fa3ee8e9e
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-336
Miles Bader <miles@gnu.org>
parents:
62791
diff
changeset
|
1302 (save-current-buffer (apply 'run-mode-hooks funcs)) |
4b7fa3ee8e9e
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-336
Miles Bader <miles@gnu.org>
parents:
62791
diff
changeset
|
1303 (save-current-buffer (apply 'run-hooks funcs)))) |
62791
a03b1bd1f66c
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-330
Miles Bader <miles@gnu.org>
parents:
59996
diff
changeset
|
1304 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1305 ;;; Various |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1306 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1307 (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
|
1308 (defun gnus-alive-p () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1309 "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
|
1310 (and (boundp 'gnus-group-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1311 (get-buffer gnus-group-buffer) |
110410
f2e111723c3a
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110158
diff
changeset
|
1312 (with-current-buffer gnus-group-buffer |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1313 (eq major-mode 'gnus-group-mode)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1314 |
110779
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1315 (defun gnus-remove-if (predicate sequence &optional hash-table-p) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1316 "Return a copy of SEQUENCE with all items satisfying PREDICATE removed. |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1317 SEQUENCE should be a list, a vector, or a string. Returns always a list. |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1318 If HASH-TABLE-P is non-nil, regards SEQUENCE as a hash table." |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1319 (let (out) |
110779
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1320 (if hash-table-p |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1321 (mapatoms (lambda (symbol) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1322 (unless (funcall predicate symbol) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1323 (push symbol out))) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1324 sequence) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1325 (unless (listp sequence) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1326 (setq sequence (append sequence nil))) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1327 (while sequence |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1328 (unless (funcall predicate (car sequence)) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1329 (push (car sequence) out)) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1330 (setq sequence (cdr sequence)))) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1331 (nreverse out))) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1332 |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1333 (defun gnus-remove-if-not (predicate sequence &optional hash-table-p) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1334 "Return a copy of SEQUENCE with all items not satisfying PREDICATE removed. |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1335 SEQUENCE should be a list, a vector, or a string. Returns always a list. |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1336 If HASH-TABLE-P is non-nil, regards SEQUENCE as a hash table." |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1337 (let (out) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1338 (if hash-table-p |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1339 (mapatoms (lambda (symbol) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1340 (when (funcall predicate symbol) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1341 (push symbol out))) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1342 sequence) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1343 (unless (listp sequence) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1344 (setq sequence (append sequence nil))) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1345 (while sequence |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1346 (when (funcall predicate (car sequence)) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1347 (push (car sequence) out)) |
9d935b7bf464
Eliminate `remove-if-not' that is a cl function.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110773
diff
changeset
|
1348 (setq sequence (cdr sequence)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1349 (nreverse out))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1350 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1351 (if (fboundp 'assq-delete-all) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1352 (defalias 'gnus-delete-alist 'assq-delete-all) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1353 (defun gnus-delete-alist (key alist) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1354 "Delete from ALIST all elements whose car is KEY. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1355 Return the modified alist." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1356 (let (entry) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1357 (while (setq entry (assq key alist)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1358 (setq alist (delq entry alist))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1359 alist))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1360 |
109764
f5fa348fd8eb
Add new gnus-sync.el library.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108981
diff
changeset
|
1361 (defun gnus-grep-in-list (word list) |
f5fa348fd8eb
Add new gnus-sync.el library.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108981
diff
changeset
|
1362 "Find if a WORD matches any regular expression in the given LIST." |
f5fa348fd8eb
Add new gnus-sync.el library.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108981
diff
changeset
|
1363 (when (and word list) |
f5fa348fd8eb
Add new gnus-sync.el library.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108981
diff
changeset
|
1364 (catch 'found |
f5fa348fd8eb
Add new gnus-sync.el library.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108981
diff
changeset
|
1365 (dolist (r list) |
f5fa348fd8eb
Add new gnus-sync.el library.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108981
diff
changeset
|
1366 (when (string-match r word) |
f5fa348fd8eb
Add new gnus-sync.el library.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108981
diff
changeset
|
1367 (throw 'found r)))))) |
f5fa348fd8eb
Add new gnus-sync.el library.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
108981
diff
changeset
|
1368 |
110859
7aa4fdb60d57
shr.el (shr-insert): Don't insert double spaces.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110810
diff
changeset
|
1369 (defmacro gnus-alist-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
|
1370 "Modify ALIST to be without KEY." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1371 (unless (symbolp alist) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1372 (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
|
1373 (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
|
1374 `(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
|
1375 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1376 (defun gnus-globalify-regexp (re) |
78486
f0a07da7dd45
Replace `iff' in doc-strings and comments.
Glenn Morris <rgm@gnu.org>
parents:
78224
diff
changeset
|
1377 "Return a regexp that matches a whole line, if RE matches a part of it." |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1378 (concat (unless (string-match "^\\^" re) "^.*") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1379 re |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1380 (unless (string-match "\\$$" re) ".*$"))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23319
diff
changeset
|
1381 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1382 (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
|
1383 "Set the window start to POINT, or (point) if nil." |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1384 (let ((win (gnus-get-buffer-window (current-buffer) t))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1385 (when win |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1386 (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
|
1387 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1388 (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
|
1389 (if (= b e) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1390 (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
|
1391 (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
|
1392 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1393 (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
|
1394 "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
|
1395 (catch 'found |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1396 (while elems |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1397 (when (pop elems) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1398 (throw 'found t))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1399 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1400 (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
|
1401 "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
|
1402 (catch 'found |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1403 (while elems |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1404 (unless (pop elems) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1405 (throw 'found nil))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1406 t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1407 |
87263
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
1408 ;; gnus.el requires mm-util. |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
1409 (declare-function mm-disable-multibyte "mm-util") |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
1410 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1411 (defun gnus-write-active-file (file hashtb &optional full-names) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1412 ;; `coding-system-for-write' should be `raw-text' or equivalent. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1413 (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
|
1414 (with-temp-file file |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1415 ;; The buffer should be in the unibyte mode because group names |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1416 ;; are ASCII text or encoded non-ASCII text (i.e., unibyte). |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1417 (mm-disable-multibyte) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1418 (mapatoms |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1419 (lambda (sym) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1420 (when (and sym |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1421 (boundp sym) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1422 (symbol-value sym)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1423 (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
|
1424 (if full-names |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1425 sym |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1426 (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
|
1427 (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
|
1428 (car (symbol-value sym))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1429 (car (symbol-value sym)))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1430 hashtb) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1431 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1432 (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
|
1433 (delete-char 1))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1434 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1435 ;; Fixme: Why not use `with-output-to-temp-buffer'? |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1436 (defmacro gnus-with-output-to-file (file &rest body) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1437 (let ((buffer (make-symbol "output-buffer")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1438 (size (make-symbol "output-buffer-size")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1439 (leng (make-symbol "output-buffer-length")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1440 (append (make-symbol "output-buffer-append"))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1441 `(let* ((,size 131072) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1442 (,buffer (make-string ,size 0)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1443 (,leng 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1444 (,append nil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1445 (standard-output |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1446 (lambda (c) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1447 (aset ,buffer ,leng c) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59089
diff
changeset
|
1448 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1449 (if (= ,size (setq ,leng (1+ ,leng))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1450 (progn (write-region ,buffer nil ,file ,append 'no-msg) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1451 (setq ,leng 0 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1452 ,append t)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1453 ,@body |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1454 (when (> ,leng 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1455 (let ((coding-system-for-write 'no-conversion)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1456 (write-region (substring ,buffer 0 ,leng) nil ,file |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1457 ,append 'no-msg)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1458 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1459 (put 'gnus-with-output-to-file 'lisp-indent-function 1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1460 (put 'gnus-with-output-to-file 'edebug-form-spec '(form body)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1461 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1462 (if (fboundp 'union) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1463 (defalias 'gnus-union 'union) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1464 (defun gnus-union (l1 l2) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1465 "Set union of lists L1 and L2." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1466 (cond ((null l1) l2) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1467 ((null l2) l1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1468 ((equal l1 l2) l1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1469 (t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1470 (or (>= (length l1) (length l2)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1471 (setq l1 (prog1 l2 (setq l2 l1)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1472 (while l2 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1473 (or (member (car l2) l1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1474 (push (car l2) l1)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1475 (pop l2)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1476 l1)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1477 |
87263
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
1478 (declare-function gnus-add-text-properties "gnus" |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
1479 (start end properties &optional object)) |
4f3a531fad0a
(gnus-group-name-decode): Autoload.
Glenn Morris <rgm@gnu.org>
parents:
87190
diff
changeset
|
1480 |
34727
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1481 (defun gnus-add-text-properties-when |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1482 (property value start end properties &optional object) |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1483 "Like `gnus-add-text-properties', only applied on where PROPERTY is VALUE." |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1484 (let (point) |
47938
65eaf21a0a44
(gnus-parse-netrc): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
41494
diff
changeset
|
1485 (while (and start |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1486 (< start end) ;; XEmacs will loop for every when start=end. |
34727
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1487 (setq point (text-property-not-all start end property value))) |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1488 (gnus-add-text-properties start point properties object) |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1489 (setq start (text-property-any point end property value))) |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1490 (if start |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1491 (gnus-add-text-properties start end properties object)))) |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1492 |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1493 (defun gnus-remove-text-properties-when |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1494 (property value start end properties &optional object) |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1495 "Like `remove-text-properties', only applied on where PROPERTY is VALUE." |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1496 (let (point) |
47938
65eaf21a0a44
(gnus-parse-netrc): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
41494
diff
changeset
|
1497 (while (and start |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1498 (< start end) |
34727
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1499 (setq point (text-property-not-all start end property value))) |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1500 (remove-text-properties start point properties object) |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1501 (setq start (text-property-any point end property value))) |
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1502 (if start |
34833
aaf69bc74739
* gnus-art.el (gnus-article-check-hidden-text): Return t.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34727
diff
changeset
|
1503 (remove-text-properties start end properties object)) |
aaf69bc74739
* gnus-art.el (gnus-article-check-hidden-text): Return t.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34727
diff
changeset
|
1504 t)) |
34727
4b9a7a10deaa
* gnus-util.el (gnus-add-text-properties-when): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33342
diff
changeset
|
1505 |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1506 (defun gnus-string-remove-all-properties (string) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1507 (condition-case () |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1508 (let ((s string)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1509 (set-text-properties 0 (length string) nil string) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1510 s) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1511 (error string))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1512 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1513 ;; This might use `compare-strings' to reduce consing in the |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1514 ;; case-insensitive case, but it has to cope with null args. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1515 ;; (`string-equal' uses symbol print names.) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1516 (defun gnus-string-equal (x y) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1517 "Like `string-equal', except it compares case-insensitively." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1518 (and (= (length x) (length y)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1519 (or (string-equal x y) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1520 (string-equal (downcase x) (downcase y))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1521 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1522 (defcustom gnus-use-byte-compile t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1523 "If non-nil, byte-compile crucial run-time code. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1524 Setting it to nil has no effect after the first time `gnus-byte-compile' |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1525 is run." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1526 :type 'boolean |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59089
diff
changeset
|
1527 :version "22.1" |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1528 :group 'gnus-various) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1529 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1530 (defun gnus-byte-compile (form) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1531 "Byte-compile FORM if `gnus-use-byte-compile' is non-nil." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1532 (if gnus-use-byte-compile |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1533 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1534 (condition-case nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1535 ;; Work around a bug in XEmacs 21.4 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1536 (require 'byte-optimize) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1537 (error)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1538 (require 'bytecomp) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1539 (defalias 'gnus-byte-compile |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1540 (lambda (form) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1541 (let ((byte-compile-warnings '(unresolved callargs redefine))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1542 (byte-compile form)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1543 (gnus-byte-compile form)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1544 form)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1545 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1546 (defun gnus-remassoc (key alist) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1547 "Delete by side effect any elements of LIST whose car is `equal' to KEY. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1548 The modified LIST is returned. If the first member |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1549 of LIST has a car that is `equal' to KEY, there is no way to remove it |
57617
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1550 by side effect; therefore, write `(setq foo (gnus-remassoc key foo))' to be |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1551 sure of changing the value of `foo'." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1552 (when alist |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1553 (if (equal key (caar alist)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1554 (cdr alist) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1555 (setcdr alist (gnus-remassoc key (cdr alist))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1556 alist))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1557 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1558 (defun gnus-update-alist-soft (key value alist) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1559 (if value |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1560 (cons (cons key value) (gnus-remassoc key alist)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1561 (gnus-remassoc key alist))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1562 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1563 (defun gnus-create-info-command (node) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1564 "Create a command that will go to info NODE." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1565 `(lambda () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1566 (interactive) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1567 ,(concat "Enter the info system at node " node) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1568 (Info-goto-node ,node) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1569 (setq gnus-info-buffer (current-buffer)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1570 (gnus-configure-windows 'info))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1571 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1572 (defun gnus-not-ignore (&rest args) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1573 t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1574 |
41494
933ab100fb4a
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38861
diff
changeset
|
1575 (defvar gnus-directory-sep-char-regexp "/" |
933ab100fb4a
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38861
diff
changeset
|
1576 "The regexp of directory separator character. |
933ab100fb4a
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38861
diff
changeset
|
1577 If you find some problem with the directory separator character, try |
933ab100fb4a
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38861
diff
changeset
|
1578 \"[/\\\\\]\" for some systems.") |
933ab100fb4a
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
38861
diff
changeset
|
1579 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1580 (defun gnus-url-unhex (x) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1581 (if (> x ?9) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1582 (if (>= x ?a) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1583 (+ 10 (- x ?a)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1584 (+ 10 (- x ?A))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1585 (- x ?0))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1586 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1587 ;; Fixme: Do it like QP. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1588 (defun gnus-url-unhex-string (str &optional allow-newlines) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1589 "Remove %XX, embedded spaces, etc in a url. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1590 If optional second argument ALLOW-NEWLINES is non-nil, then allow the |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1591 decoding of carriage returns and line feeds in the string, which is normally |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1592 forbidden in URL encoding." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1593 (let ((tmp "") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1594 (case-fold-search t)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1595 (while (string-match "%[0-9a-f][0-9a-f]" str) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1596 (let* ((start (match-beginning 0)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1597 (ch1 (gnus-url-unhex (elt str (+ start 1)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1598 (code (+ (* 16 ch1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1599 (gnus-url-unhex (elt str (+ start 2)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1600 (setq tmp (concat |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1601 tmp (substring str 0 start) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1602 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1603 (allow-newlines |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1604 (char-to-string code)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1605 ((or (= code ?\n) (= code ?\r)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1606 " ") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1607 (t (char-to-string code)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1608 str (substring str (match-end 0))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1609 (setq tmp (concat tmp str)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1610 tmp)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1611 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1612 (defun gnus-make-predicate (spec) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1613 "Transform SPEC into a function that can be called. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1614 SPEC is a predicate specifier that contains stuff like `or', `and', |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1615 `not', lists and functions. The functions all take one parameter." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1616 `(lambda (elem) ,(gnus-make-predicate-1 spec))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1617 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1618 (defun gnus-make-predicate-1 (spec) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1619 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1620 ((symbolp spec) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1621 `(,spec elem)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1622 ((listp spec) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1623 (if (memq (car spec) '(or and not)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1624 `(,(car spec) ,@(mapcar 'gnus-make-predicate-1 (cdr spec))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1625 (error "Invalid predicate specifier: %s" spec))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1626 |
110661
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
1627 (defun gnus-completing-read (prompt collection &optional require-match |
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
1628 initial-input history def) |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1629 "Call `gnus-completing-read-function'." |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1630 (funcall gnus-completing-read-function |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1631 (concat prompt (when def |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1632 (concat " (default " def ")")) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1633 ": ") |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1634 collection require-match initial-input history def)) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1635 |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1636 (defun gnus-emacs-completing-read (prompt collection &optional require-match |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1637 initial-input history def) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1638 "Call standard `completing-read-function'." |
110661
2b8ece636433
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110596
diff
changeset
|
1639 (let ((completion-styles gnus-completion-styles)) |
110763
0fe64d68a522
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110747
diff
changeset
|
1640 (completing-read prompt |
0fe64d68a522
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110747
diff
changeset
|
1641 ;; Old XEmacs (at least 21.4) expect an alist for |
0fe64d68a522
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110747
diff
changeset
|
1642 ;; collection. |
0fe64d68a522
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110747
diff
changeset
|
1643 (mapcar 'list collection) |
0fe64d68a522
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110747
diff
changeset
|
1644 nil require-match initial-input history def))) |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1645 |
110773
22b487462b5a
gnus-util.el (gnus-emacs-completing-read, gnus-iswitchb-completing-read): Use autoload rather than require.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110772
diff
changeset
|
1646 (autoload 'ido-completing-read "ido") |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1647 (defun gnus-ido-completing-read (prompt collection &optional require-match |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1648 initial-input history def) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1649 "Call `ido-completing-read-function'." |
110810
07053df95af6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110799
diff
changeset
|
1650 (ido-completing-read prompt collection nil require-match |
07053df95af6
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110799
diff
changeset
|
1651 initial-input history def)) |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1652 |
110773
22b487462b5a
gnus-util.el (gnus-emacs-completing-read, gnus-iswitchb-completing-read): Use autoload rather than require.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110772
diff
changeset
|
1653 |
22b487462b5a
gnus-util.el (gnus-emacs-completing-read, gnus-iswitchb-completing-read): Use autoload rather than require.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110772
diff
changeset
|
1654 (autoload 'iswitchb-read-buffer "iswitchb") |
110708
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1655 (defun gnus-iswitchb-completing-read (prompt collection &optional require-match |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1656 initial-input history def) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1657 "`iswitchb' based completing-read function." |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1658 (let ((iswitchb-make-buflist-hook |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1659 (lambda () |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1660 (setq iswitchb-temp-buflist |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1661 (let ((choices (append |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1662 (when initial-input (list initial-input)) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1663 (symbol-value history) collection)) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1664 filtered-choices) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1665 (dolist (x choices) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1666 (setq filtered-choices (adjoin x filtered-choices))) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1667 (nreverse filtered-choices)))))) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1668 (unwind-protect |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1669 (progn |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1670 (when (not iswitchb-mode) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1671 (add-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup)) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1672 (iswitchb-read-buffer prompt def require-match)) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1673 (when (not iswitchb-mode) |
4c31586ca1ca
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110674
diff
changeset
|
1674 (remove-hook 'minibuffer-setup-hook 'iswitchb-minibuffer-setup))))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1675 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1676 (defun gnus-graphic-display-p () |
110158
64b3982570b5
Make gnus-html work for XEmacs.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
1677 (if (featurep 'xemacs) |
64b3982570b5
Make gnus-html work for XEmacs.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
1678 (device-on-window-system-p) |
64b3982570b5
Make gnus-html work for XEmacs.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110102
diff
changeset
|
1679 (display-graphic-p))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1680 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1681 (put 'gnus-parse-without-error 'lisp-indent-function 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1682 (put 'gnus-parse-without-error 'edebug-form-spec '(body)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1683 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1684 (defmacro gnus-parse-without-error (&rest body) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1685 "Allow continuing onto the next line even if an error occurs." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1686 `(while (not (eobp)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1687 (condition-case () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1688 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1689 ,@body |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1690 (goto-char (point-max))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1691 (error |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1692 (gnus-error 4 "Invalid data on line %d" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1693 (count-lines (point-min) (point))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1694 (forward-line 1))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1695 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1696 (defun gnus-cache-file-contents (file variable function) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1697 "Cache the contents of FILE in VARIABLE. The contents come from FUNCTION." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1698 (let ((time (nth 5 (file-attributes file))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1699 contents value) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1700 (if (or (null (setq value (symbol-value variable))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1701 (not (equal (car value) file)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1702 (not (equal (nth 1 value) time))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1703 (progn |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1704 (setq contents (funcall function file)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1705 (set variable (list file time contents)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1706 contents) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1707 (nth 2 value)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1708 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1709 (defun gnus-multiple-choice (prompt choice &optional idx) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1710 "Ask user a multiple choice question. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1711 CHOICE is a list of the choice char and help message at IDX." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1712 (let (tchar buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1713 (save-window-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1714 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1715 (while (not tchar) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1716 (message "%s (%s): " |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1717 prompt |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1718 (concat |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1719 (mapconcat (lambda (s) (char-to-string (car s))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1720 choice ", ") ", ?")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1721 (setq tchar (read-char)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1722 (when (not (assq tchar choice)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1723 (setq tchar nil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1724 (setq buf (get-buffer-create "*Gnus Help*")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1725 (pop-to-buffer buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1726 (fundamental-mode) ; for Emacs 20.4+ |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1727 (buffer-disable-undo) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1728 (erase-buffer) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1729 (insert prompt ":\n\n") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1730 (let ((max -1) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1731 (list choice) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1732 (alist choice) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1733 (idx (or idx 1)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1734 (i 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1735 n width pad format) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1736 ;; find the longest string to display |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1737 (while list |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1738 (setq n (length (nth idx (car list)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1739 (unless (> max n) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1740 (setq max n)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1741 (setq list (cdr list))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1742 (setq max (+ max 4)) ; %c, `:', SPACE, a SPACE at end |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1743 (setq n (/ (1- (window-width)) max)) ; items per line |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1744 (setq width (/ (1- (window-width)) n)) ; width of each item |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1745 ;; insert `n' items, each in a field of width `width' |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1746 (while alist |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1747 (if (< i n) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1748 () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1749 (setq i 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1750 (delete-char -1) ; the `\n' takes a char |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1751 (insert "\n")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1752 (setq pad (- width 3)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1753 (setq format (concat "%c: %-" (int-to-string pad) "s")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1754 (insert (format format (caar alist) (nth idx (car alist)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1755 (setq alist (cdr alist)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1756 (setq i (1+ i)))))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1757 (if (buffer-live-p buf) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1758 (kill-buffer buf)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1759 tchar)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1760 |
110542
93f2c2c37f24
Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110410
diff
changeset
|
1761 (if (fboundp 'select-frame-set-input-focus) |
93f2c2c37f24
Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110410
diff
changeset
|
1762 (defalias 'gnus-select-frame-set-input-focus 'select-frame-set-input-focus) |
93f2c2c37f24
Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110410
diff
changeset
|
1763 ;; XEmacs 21.4, SXEmacs |
93f2c2c37f24
Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110410
diff
changeset
|
1764 (defun gnus-select-frame-set-input-focus (frame) |
93f2c2c37f24
Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110410
diff
changeset
|
1765 "Select FRAME, raise it, and set input focus, if possible." |
93f2c2c37f24
Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110410
diff
changeset
|
1766 (raise-frame frame) |
93f2c2c37f24
Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110410
diff
changeset
|
1767 (select-frame frame) |
93f2c2c37f24
Remove Emacs 21 stuff.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110410
diff
changeset
|
1768 (focus-frame frame))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1769 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1770 (defun gnus-frame-or-window-display-name (object) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1771 "Given a frame or window, return the associated display name. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1772 Return nil otherwise." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1773 (if (featurep 'xemacs) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1774 (device-connection (dfw-device object)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1775 (if (or (framep object) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1776 (and (windowp object) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1777 (setq object (window-frame object)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1778 (let ((display (frame-parameter object 'display))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1779 (if (and (stringp display) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1780 ;; Exclude invalid display names. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1781 (string-match "\\`[^:]*:[0-9]+\\(\\.[0-9]+\\)?\\'" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1782 display)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1783 display))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1784 |
86154 | 1785 (defvar tool-bar-mode) |
69572
b4faac2800dd
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-163
Miles Bader <miles@gnu.org>
parents:
69337
diff
changeset
|
1786 |
69337
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1787 (defun gnus-tool-bar-update (&rest ignore) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1788 "Update the tool bar." |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1789 (when (and (boundp 'tool-bar-mode) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1790 tool-bar-mode) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1791 (let* ((args nil) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1792 (func (cond ((featurep 'xemacs) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1793 'ignore) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1794 ((fboundp 'tool-bar-update) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1795 'tool-bar-update) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1796 ((fboundp 'force-window-update) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1797 'force-window-update) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1798 ((fboundp 'redraw-frame) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1799 (setq args (list (selected-frame))) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1800 'redraw-frame) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1801 (t 'ignore)))) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1802 (apply func args)))) |
55665aaac72b
* gnus-util.el (gnus-tool-bar-update): New function.
Reiner Steib <Reiner.Steib@gmx.de>
parents:
68633
diff
changeset
|
1803 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1804 ;; Fixme: This has only one use (in gnus-agent), which isn't worthwhile. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1805 (defmacro gnus-mapcar (function seq1 &rest seqs2_n) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1806 "Apply FUNCTION to each element of the sequences, and make a list of the results. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1807 If there are several sequences, FUNCTION is called with that many arguments, |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1808 and mapping stops as soon as the shortest sequence runs out. With just one |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1809 sequence, this is like `mapcar'. With several, it is like the Common Lisp |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1810 `mapcar' function extended to arbitrary sequence types." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1811 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1812 (if seqs2_n |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1813 (let* ((seqs (cons seq1 seqs2_n)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1814 (cnt 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1815 (heads (mapcar (lambda (seq) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1816 (make-symbol (concat "head" |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1817 (int-to-string |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1818 (setq cnt (1+ cnt)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1819 seqs)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1820 (result (make-symbol "result")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1821 (result-tail (make-symbol "result-tail"))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1822 `(let* ,(let* ((bindings (cons nil nil)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1823 (heads heads)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1824 (nconc bindings (list (list result '(cons nil nil)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1825 (nconc bindings (list (list result-tail result))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1826 (while heads |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1827 (nconc bindings (list (list (pop heads) (pop seqs))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1828 (cdr bindings)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1829 (while (and ,@heads) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1830 (setcdr ,result-tail (cons (funcall ,function |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1831 ,@(mapcar (lambda (h) (list 'car h)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1832 heads)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1833 nil)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1834 (setq ,result-tail (cdr ,result-tail) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1835 ,@(apply 'nconc (mapcar (lambda (h) (list h (list 'cdr h))) heads)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1836 (cdr ,result))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1837 `(mapcar ,function ,seq1))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1838 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1839 (if (fboundp 'merge) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1840 (defalias 'gnus-merge 'merge) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1841 ;; Adapted from cl-seq.el |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1842 (defun gnus-merge (type list1 list2 pred) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1843 "Destructively merge lists LIST1 and LIST2 to produce a new list. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1844 Argument TYPE is for compatibility and ignored. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1845 Ordering of the elements is preserved according to PRED, a `less-than' |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1846 predicate on the elements." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1847 (let ((res nil)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1848 (while (and list1 list2) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1849 (if (funcall pred (car list2) (car list1)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1850 (push (pop list2) res) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1851 (push (pop list1) res))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1852 (nconc (nreverse res) list1 list2)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1853 |
86154 | 1854 (defvar xemacs-codename) |
1855 (defvar sxemacs-codename) | |
1856 (defvar emacs-program-version) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1857 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1858 (defun gnus-emacs-version () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1859 "Stringified Emacs version." |
65342
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1860 (let* ((lst (if (listp gnus-user-agent) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1861 gnus-user-agent |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1862 '(gnus emacs type))) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1863 (system-v (cond ((memq 'config lst) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1864 system-configuration) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1865 ((memq 'type lst) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1866 (symbol-name system-type)) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1867 (t nil))) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1868 codename emacsname) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1869 (cond ((featurep 'sxemacs) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1870 (setq emacsname "SXEmacs" |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1871 codename sxemacs-codename)) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1872 ((featurep 'xemacs) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1873 (setq emacsname "XEmacs" |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1874 codename xemacs-codename)) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1875 (t |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1876 (setq emacsname "Emacs"))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1877 (cond |
65342
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1878 ((not (memq 'emacs lst)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1879 nil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1880 ((string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" emacs-version) |
65342
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1881 ;; Emacs: |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1882 (concat "Emacs/" (match-string 1 emacs-version) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1883 (if system-v |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1884 (concat " (" system-v ")") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1885 ""))) |
65342
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1886 ((or (featurep 'sxemacs) (featurep 'xemacs)) |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1887 ;; XEmacs or SXEmacs: |
c71b1b2d2d04
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-530
Miles Bader <miles@gnu.org>
parents:
65273
diff
changeset
|
1888 (concat emacsname "/" emacs-program-version |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1889 (let (plst) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1890 (when (memq 'codename lst) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1891 (push codename plst)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1892 (when system-v |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1893 (push system-v plst)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1894 (unless (featurep 'mule) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1895 (push "no MULE" plst)) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1896 (when (> (length plst) 0) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1897 (concat |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1898 " (" (mapconcat 'identity (reverse plst) ", ") ")"))))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1899 (t emacs-version)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1900 |
57617
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1901 (defun gnus-rename-file (old-path new-path &optional trim) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1902 "Rename OLD-PATH as NEW-PATH. If TRIM, recursively delete |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1903 empty directories from OLD-PATH." |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1904 (when (file-exists-p old-path) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1905 (let* ((old-dir (file-name-directory old-path)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1906 (old-name (file-name-nondirectory old-path)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1907 (new-dir (file-name-directory new-path)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1908 (new-name (file-name-nondirectory new-path)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1909 temp) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1910 (gnus-make-directory new-dir) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1911 (rename-file old-path new-path t) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1912 (when trim |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1913 (while (progn (setq temp (directory-files old-dir)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1914 (while (member (car temp) '("." "..")) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1915 (setq temp (cdr temp))) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1916 (= (length temp) 0)) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1917 (delete-directory old-dir) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59089
diff
changeset
|
1918 (setq old-dir (file-name-as-directory |
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59089
diff
changeset
|
1919 (file-truename |
57617
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1920 (concat old-dir ".."))))))))) |
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1921 |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1922 (defun gnus-set-file-modes (filename mode) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1923 "Wrapper for set-file-modes." |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1924 (ignore-errors |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1925 (set-file-modes filename mode))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
1926 |
62943
11d53dd5abd9
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-345
Miles Bader <miles@gnu.org>
parents:
62890
diff
changeset
|
1927 (if (fboundp 'set-process-query-on-exit-flag) |
11d53dd5abd9
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-345
Miles Bader <miles@gnu.org>
parents:
62890
diff
changeset
|
1928 (defalias 'gnus-set-process-query-on-exit-flag |
11d53dd5abd9
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-345
Miles Bader <miles@gnu.org>
parents:
62890
diff
changeset
|
1929 'set-process-query-on-exit-flag) |
11d53dd5abd9
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-345
Miles Bader <miles@gnu.org>
parents:
62890
diff
changeset
|
1930 (defalias 'gnus-set-process-query-on-exit-flag |
11d53dd5abd9
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-345
Miles Bader <miles@gnu.org>
parents:
62890
diff
changeset
|
1931 'process-kill-without-query)) |
57617
7fdc1df35f39
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-628
Miles Bader <miles@gnu.org>
parents:
57153
diff
changeset
|
1932 |
73269 | 1933 (if (fboundp 'with-local-quit) |
1934 (defalias 'gnus-with-local-quit 'with-local-quit) | |
1935 (defmacro gnus-with-local-quit (&rest body) | |
1936 "Execute BODY, allowing quits to terminate BODY but not escape further. | |
1937 When a quit terminates BODY, `gnus-with-local-quit' returns nil but | |
1938 requests another quit. That quit will be processed as soon as quitting | |
1939 is allowed once again. (Immediately, if `inhibit-quit' is nil.)" | |
1940 ;;(declare (debug t) (indent 0)) | |
1941 `(condition-case nil | |
1942 (let ((inhibit-quit nil)) | |
1943 ,@body) | |
1944 (quit (setq quit-flag t) | |
1945 ;; This call is to give a chance to handle quit-flag | |
1946 ;; in case inhibit-quit is nil. | |
1947 ;; Without this, it will not be handled until the next function | |
1948 ;; call, and that might allow it to exit thru a condition-case | |
1949 ;; that intends to handle the quit signal next time. | |
1950 (eval '(ignore nil)))))) | |
1951 | |
95586
64da3838a9aa
* gnus-util.el (gnus-read-shell-command): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94748
diff
changeset
|
1952 (defalias 'gnus-read-shell-command |
64da3838a9aa
* gnus-util.el (gnus-read-shell-command): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94748
diff
changeset
|
1953 (if (fboundp 'read-shell-command) 'read-shell-command 'read-string)) |
64da3838a9aa
* gnus-util.el (gnus-read-shell-command): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94748
diff
changeset
|
1954 |
96024 | 1955 (defmacro gnus-put-display-table (range value display-table) |
1956 "Set the value for char RANGE to VALUE in DISPLAY-TABLE. " | |
1957 (if (featurep 'xemacs) | |
1958 (progn | |
1959 `(if (fboundp 'put-display-table) | |
1960 (put-display-table ,range ,value ,display-table) | |
1961 (if (sequencep ,display-table) | |
1962 (aset ,display-table ,range ,value) | |
1963 (put-char-table ,range ,value ,display-table)))) | |
1964 `(aset ,display-table ,range ,value))) | |
1965 | |
1966 (defmacro gnus-get-display-table (character display-table) | |
1967 "Find value for CHARACTER in DISPLAY-TABLE. " | |
1968 (if (featurep 'xemacs) | |
1969 `(if (fboundp 'get-display-table) | |
1970 (get-display-table ,character ,display-table) | |
1971 (if (sequencep ,display-table) | |
1972 (aref ,display-table ,character) | |
1973 (get-char-table ,character ,display-table))) | |
1974 `(aref ,display-table ,character))) | |
1975 | |
110747
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1976 (defun gnus-rescale-image (image size) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1977 "Rescale IMAGE to SIZE if possible. |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1978 SIZE is in format (WIDTH . HEIGHT). Return a new image. |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1979 Sizes are in pixels." |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1980 (if (or (not (fboundp 'imagemagick-types)) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1981 (not (get-buffer-window (current-buffer)))) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1982 image |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1983 (let ((new-width (car size)) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1984 (new-height (cdr size))) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1985 (when (> (cdr (image-size image t)) new-height) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1986 (setq image (or (create-image (plist-get (cdr image) :data) 'imagemagick t |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1987 :height new-height) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1988 image))) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1989 (when (> (car (image-size image t)) new-width) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1990 (setq image (or |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1991 (create-image (plist-get (cdr image) :data) 'imagemagick t |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1992 :width new-width) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1993 image))) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1994 image))) |
0defef1647a5
Merge changes made in Gnus trunk.
Katsumi Yamaoka <yamaoka@jpl.org>
parents:
110716
diff
changeset
|
1995 |
17493 | 1996 (provide 'gnus-util) |
1997 | |
1998 ;;; gnus-util.el ends here |