aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2006-02-17 00:24:04 +0000
committerMiles Bader2006-02-17 00:24:04 +0000
commitcf5a5c38c6d1263cbdcf4561b25f5e6988f4c419 (patch)
tree5c1508ea2fce2b511fe7733888ac4ad4d8e1e634
parent60b8fb50eefe34d56dbf42de2183ec6d21769379 (diff)
downloademacs-cf5a5c38c6d1263cbdcf4561b25f5e6988f4c419.tar.gz
emacs-cf5a5c38c6d1263cbdcf4561b25f5e6988f4c419.zip
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-93
Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 30-34) - Merge from emacs--devo--0 - Update from CVS
-rw-r--r--lisp/gnus/ChangeLog33
-rw-r--r--lisp/gnus/gnus-art.el6
-rw-r--r--lisp/gnus/gnus-draft.el35
-rw-r--r--lisp/gnus/mm-decode.el29
-rw-r--r--lisp/gnus/mm-util.el81
-rw-r--r--lisp/gnus/nnoo.el16
-rw-r--r--lisp/gnus/rfc2231.el48
7 files changed, 206 insertions, 42 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index adca02f5b95..4ac3982fb44 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -7,6 +7,39 @@
7 7
8 * gnus-cus.el: Revert 2005-10-17 change. 8 * gnus-cus.el: Revert 2005-10-17 change.
9 9
102006-02-16 Katsumi Yamaoka <yamaoka@jpl.org>
11
12 * gnus-art.el (article-strip-banner): Use
13 gnus-extract-address-components instead of
14 mail-header-parse-addresses to make it work with non-ASCII text.
15
16 * rfc2231.el (rfc2231-parse-string): Attempt to parse parameter
17 values which are surrounded with \"...\"; make it never cause a
18 Lisp error; give up parsing of parameters if it failed in
19 extracting type.
20
212006-02-15 Katsumi Yamaoka <yamaoka@jpl.org>
22
23 * mm-util.el (mm-make-temp-file): Import the Emacs 22 version of
24 make-temp-file; make it work with Emacs 20 and XEmacs as well.
25
26 * mm-decode.el (mm-display-external): Use the 3rd arg of
27 mm-make-temp-file.
28 (mm-create-image-xemacs): Ditto.
29
302006-02-14 Katsumi Yamaoka <yamaoka@jpl.org>
31
32 * gnus-draft.el (gnus-draft-send): Replace message-narrow-to-head
33 with message-narrow-to-headers.
34 (gnus-draft-setup): Narrow to header to run message-fetch-field.
35 (gnus-draft-check-draft-articles): New function.
36 (gnus-draft-edit-message, gnus-draft-send-message): Use it.
37
382006-02-13 Katsumi Yamaoka <yamaoka@jpl.org>
39
40 * nnoo.el (nnoo-declare): Don't generate duplicate entries when
41 re-loading nn* modules.
42
102006-02-10 Reiner Steib <Reiner.Steib@gmx.de> 432006-02-10 Reiner Steib <Reiner.Steib@gmx.de>
11 44
12 * gnus.el: Remove bogus comment. 45 * gnus.el: Remove bogus comment.
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index c15151729a0..0d9b5f4be5a 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -2608,6 +2608,9 @@ always hide."
2608 (article-really-strip-banner 2608 (article-really-strip-banner
2609 (gnus-parameter-banner gnus-newsgroup-name))) 2609 (gnus-parameter-banner gnus-newsgroup-name)))
2610 (when gnus-article-address-banner-alist 2610 (when gnus-article-address-banner-alist
2611 ;; Note that the From header is decoded here, so it is
2612 ;; required that the *-extract-address-components function
2613 ;; supports non-ASCII text.
2611 (article-really-strip-banner 2614 (article-really-strip-banner
2612 (let ((from (save-restriction 2615 (let ((from (save-restriction
2613 (widen) 2616 (widen)
@@ -2615,7 +2618,8 @@ always hide."
2615 (mail-fetch-field "from")))) 2618 (mail-fetch-field "from"))))
2616 (when (and from 2619 (when (and from
2617 (setq from 2620 (setq from
2618 (caar (mail-header-parse-addresses from)))) 2621 (cadr (funcall gnus-extract-address-components
2622 from))))
2619 (catch 'found 2623 (catch 'found
2620 (dolist (pair gnus-article-address-banner-alist) 2624 (dolist (pair gnus-article-address-banner-alist)
2621 (when (string-match (car pair) from) 2625 (when (string-match (car pair) from)
diff --git a/lisp/gnus/gnus-draft.el b/lisp/gnus/gnus-draft.el
index 0d250a3ad0b..f9ff9d7122e 100644
--- a/lisp/gnus/gnus-draft.el
+++ b/lisp/gnus/gnus-draft.el
@@ -98,6 +98,7 @@
98 (interactive) 98 (interactive)
99 (let ((article (gnus-summary-article-number)) 99 (let ((article (gnus-summary-article-number))
100 (group gnus-newsgroup-name)) 100 (group gnus-newsgroup-name))
101 (gnus-draft-check-draft-articles (list article))
101 (gnus-summary-mark-as-read article gnus-canceled-mark) 102 (gnus-summary-mark-as-read article gnus-canceled-mark)
102 (gnus-draft-setup article group t) 103 (gnus-draft-setup article group t)
103 (set-buffer-modified-p t) 104 (set-buffer-modified-p t)
@@ -122,6 +123,7 @@
122 (let* ((articles (gnus-summary-work-articles n)) 123 (let* ((articles (gnus-summary-work-articles n))
123 (total (length articles)) 124 (total (length articles))
124 article) 125 article)
126 (gnus-draft-check-draft-articles articles)
125 (while (setq article (pop articles)) 127 (while (setq article (pop articles))
126 (gnus-summary-remove-process-mark article) 128 (gnus-summary-remove-process-mark article)
127 (unless (memq article gnus-newsgroup-unsendable) 129 (unless (memq article gnus-newsgroup-unsendable)
@@ -152,7 +154,7 @@
152 ;; We read the meta-information that says how and where 154 ;; We read the meta-information that says how and where
153 ;; this message is to be sent. 155 ;; this message is to be sent.
154 (save-restriction 156 (save-restriction
155 (message-narrow-to-head) 157 (message-narrow-to-headers)
156 (when (re-search-forward 158 (when (re-search-forward
157 (concat "^" (regexp-quote gnus-agent-target-move-group-header) 159 (concat "^" (regexp-quote gnus-agent-target-move-group-header)
158 ":") nil t) 160 ":") nil t)
@@ -258,9 +260,12 @@
258 (goto-char (point-min)) 260 (goto-char (point-min))
259 (search-forward "\n\n") 261 (search-forward "\n\n")
260 (forward-char -1) 262 (forward-char -1)
263 (save-restriction
264 (narrow-to-region (point-min) (point))
265 (setq ga
266 (message-fetch-field gnus-draft-meta-information-header)))
261 (insert mail-header-separator) 267 (insert mail-header-separator)
262 (forward-line 1) 268 (forward-line 1)
263 (setq ga (message-fetch-field gnus-draft-meta-information-header))
264 (message-set-auto-save-file-name)))) 269 (message-set-auto-save-file-name))))
265 (gnus-backlog-remove-article group narticle) 270 (gnus-backlog-remove-article group narticle)
266 (when (and ga 271 (when (and ga
@@ -285,6 +290,32 @@
285 "Say whether ARTICLE is sendable." 290 "Say whether ARTICLE is sendable."
286 (not (memq article gnus-newsgroup-unsendable))) 291 (not (memq article gnus-newsgroup-unsendable)))
287 292
293(defun gnus-draft-check-draft-articles (articles)
294 "Check whether the draft articles ARTICLES are under edit."
295 (when (equal gnus-newsgroup-name "nndraft:drafts")
296 (let ((buffers (buffer-list))
297 file buffs buff)
298 (save-current-buffer
299 (while (and articles
300 (not buff))
301 (setq file (nndraft-article-filename (pop articles))
302 buffs buffers)
303 (while buffs
304 (set-buffer (setq buff (pop buffs)))
305 (if (and buffer-file-name
306 (string-equal (file-truename buffer-file-name)
307 (file-truename file))
308 (buffer-modified-p))
309 (setq buffs nil)
310 (setq buff nil)))))
311 (when buff
312 (let* ((window (get-buffer-window buff t))
313 (frame (and window (window-frame window))))
314 (if frame
315 (gnus-select-frame-set-input-focus frame)
316 (pop-to-buffer buff t)))
317 (error "The draft %s is under edit" file)))))
318
288(provide 'gnus-draft) 319(provide 'gnus-draft)
289 320
290;;; arch-tag: 3d92af58-8c97-4a5c-9db4-a98e85198022 321;;; arch-tag: 3d92af58-8c97-4a5c-9db4-a98e85198022
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 996c934191c..fa77b7776f0 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -769,19 +769,18 @@ external if displayed external."
769 (gnus-map-function mm-file-name-rewrite-functions 769 (gnus-map-function mm-file-name-rewrite-functions
770 (file-name-nondirectory filename)) 770 (file-name-nondirectory filename))
771 dir)) 771 dir))
772 (setq file (mm-make-temp-file (expand-file-name "mm." dir))) 772 ;; Use nametemplate (defined in RFC1524) if it is specified
773 (let ((newname 773 ;; in mailcap.
774 ;; Use nametemplate (defined in RFC1524) if it is 774 (let ((suffix (cdr (assoc "nametemplate" mime-info))))
775 ;; specified in mailcap. 775 (if (and suffix
776 (if (assoc "nametemplate" mime-info) 776 (string-match "\\`%s\\(\\..+\\)\\'" suffix))
777 (format (cdr (assoc "nametemplate" mime-info)) file) 777 (setq suffix (match-string 1 suffix))
778 ;; Add a suffix according to `mailcap-mime-extensions'. 778 ;; Otherwise, use a suffix according to
779 (concat file (car (rassoc (mm-handle-media-type handle) 779 ;; `mailcap-mime-extensions'.
780 mailcap-mime-extensions)))))) 780 (setq suffix (car (rassoc (mm-handle-media-type handle)
781 (unless (string-equal file newname) 781 mailcap-mime-extensions))))
782 (when (file-exists-p file) 782 (setq file (mm-make-temp-file (expand-file-name "mm." dir)
783 (rename-file file newname)) 783 nil suffix))))
784 (setq file newname))))
785 (let ((coding-system-for-write mm-binary-coding-system)) 784 (let ((coding-system-for-write mm-binary-coding-system))
786 (write-region (point-min) (point-max) file nil 'nomesg)) 785 (write-region (point-min) (point-max) file nil 'nomesg))
787 (message "Viewing with %s" method) 786 (message "Viewing with %s" method)
@@ -1312,8 +1311,8 @@ be determined."
1312 ;; out to a file, and then create a file 1311 ;; out to a file, and then create a file
1313 ;; specifier. 1312 ;; specifier.
1314 (let ((file (mm-make-temp-file 1313 (let ((file (mm-make-temp-file
1315 (expand-file-name "emm.xbm" 1314 (expand-file-name "emm" mm-tmp-directory)
1316 mm-tmp-directory)))) 1315 nil ".xbm")))
1317 (unwind-protect 1316 (unwind-protect
1318 (progn 1317 (progn
1319 (write-region (point-min) (point-max) file) 1318 (write-region (point-min) (point-max) file)
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el
index c8f59ec263f..9bdbc3c72b1 100644
--- a/lisp/gnus/mm-util.el
+++ b/lisp/gnus/mm-util.el
@@ -99,16 +99,6 @@
99 (lambda (ch) (mm-string-as-multibyte (char-to-string ch))) 99 (lambda (ch) (mm-string-as-multibyte (char-to-string ch)))
100 string ""))) 100 string "")))
101 (multibyte-string-p . ignore) 101 (multibyte-string-p . ignore)
102 ;; It is not a MIME function, but some MIME functions use it.
103 (make-temp-file . (lambda (prefix &optional dir-flag)
104 (let ((file (expand-file-name
105 (make-temp-name prefix)
106 (if (fboundp 'temp-directory)
107 (temp-directory)
108 temporary-file-directory))))
109 (if dir-flag
110 (make-directory file))
111 file)))
112 (insert-byte . insert-char) 102 (insert-byte . insert-char)
113 (multibyte-char-to-unibyte . identity)))) 103 (multibyte-char-to-unibyte . identity))))
114 104
@@ -971,6 +961,77 @@ If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'."
971 inhibit-file-name-handlers))) 961 inhibit-file-name-handlers)))
972 (write-region start end filename append visit lockname))) 962 (write-region start end filename append visit lockname)))
973 963
964;; It is not a MIME function, but some MIME functions use it.
965(if (and (fboundp 'make-temp-file)
966 (ignore-errors
967 (let ((def (symbol-function 'make-temp-file)))
968 (and (byte-code-function-p def)
969 (setq def (if (fboundp 'compiled-function-arglist)
970 ;; XEmacs
971 (eval (list 'compiled-function-arglist def))
972 (aref def 0)))
973 (>= (length def) 4)
974 (eq (nth 3 def) 'suffix)))))
975 (defalias 'mm-make-temp-file 'make-temp-file)
976 ;; Stolen (and modified for Emacs 20 and XEmacs) from Emacs 22.
977 (defun mm-make-temp-file (prefix &optional dir-flag suffix)
978 "Create a temporary file.
979The returned file name (created by appending some random characters at the end
980of PREFIX, and expanding against `temporary-file-directory' if necessary),
981is guaranteed to point to a newly created empty file.
982You can then use `write-region' to write new data into the file.
983
984If DIR-FLAG is non-nil, create a new empty directory instead of a file.
985
986If SUFFIX is non-nil, add that at the end of the file name."
987 (let ((umask (default-file-modes))
988 file)
989 (unwind-protect
990 (progn
991 ;; Create temp files with strict access rights. It's easy to
992 ;; loosen them later, whereas it's impossible to close the
993 ;; time-window of loose permissions otherwise.
994 (set-default-file-modes 448)
995 (while (condition-case err
996 (progn
997 (setq file
998 (make-temp-name
999 (expand-file-name
1000 prefix
1001 (if (fboundp 'temp-directory)
1002 ;; XEmacs
1003 (temp-directory)
1004 temporary-file-directory))))
1005 (if suffix
1006 (setq file (concat file suffix)))
1007 (if dir-flag
1008 (make-directory file)
1009 (if (or (featurep 'xemacs)
1010 (= emacs-major-version 20))
1011 ;; NOTE: This is unsafe if Emacs 20
1012 ;; users and XEmacs users don't use
1013 ;; a secure temp directory.
1014 (if (file-exists-p file)
1015 (signal 'file-already-exists
1016 (list "File exists" file))
1017 (write-region "" nil file nil 'silent))
1018 (write-region "" nil file nil 'silent
1019 nil 'excl)))
1020 nil)
1021 (file-already-exists t)
1022 ;; The Emacs 20 and XEmacs versions of
1023 ;; `make-directory' issue `file-error'.
1024 (file-error (or (and (or (featurep 'xemacs)
1025 (= emacs-major-version 20))
1026 (file-exists-p file))
1027 (signal (car err) (cdr err)))))
1028 ;; the file was somehow created by someone else between
1029 ;; `make-temp-name' and `write-region', let's try again.
1030 nil)
1031 file)
1032 ;; Reset the umask.
1033 (set-default-file-modes umask)))))
1034
974(defun mm-image-load-path (&optional package) 1035(defun mm-image-load-path (&optional package)
975 (let (dir result) 1036 (let (dir result)
976 (dolist (path load-path (nreverse result)) 1037 (dolist (path load-path (nreverse result))
diff --git a/lisp/gnus/nnoo.el b/lisp/gnus/nnoo.el
index 7a66b4c55aa..122183057b9 100644
--- a/lisp/gnus/nnoo.el
+++ b/lisp/gnus/nnoo.el
@@ -61,12 +61,16 @@
61 61
62(defmacro nnoo-declare (backend &rest parents) 62(defmacro nnoo-declare (backend &rest parents)
63 `(eval-and-compile 63 `(eval-and-compile
64 (push (list ',backend 64 (if (assq ',backend nnoo-definition-alist)
65 (mapcar (lambda (p) (list p)) ',parents) 65 (setcar (cdr (assq ',backend nnoo-definition-alist))
66 nil nil) 66 (mapcar 'list ',parents))
67 nnoo-definition-alist) 67 (push (list ',backend
68 (push (list ',backend "*internal-non-initialized-backend*") 68 (mapcar 'list ',parents)
69 nnoo-state-alist))) 69 nil nil)
70 nnoo-definition-alist))
71 (unless (assq ',backend nnoo-state-alist)
72 (push (list ',backend "*internal-non-initialized-backend*")
73 nnoo-state-alist))))
70(put 'nnoo-declare 'lisp-indent-function 1) 74(put 'nnoo-declare 'lisp-indent-function 1)
71 75
72(defun nnoo-parents (backend) 76(defun nnoo-parents (backend)
diff --git a/lisp/gnus/rfc2231.el b/lisp/gnus/rfc2231.el
index 7b4cf2447f4..2099b20195d 100644
--- a/lisp/gnus/rfc2231.el
+++ b/lisp/gnus/rfc2231.el
@@ -47,15 +47,45 @@ The list will be on the form
47 `(name (attribute . value) (attribute . value)...)'. 47 `(name (attribute . value) (attribute . value)...)'.
48 48
49If the optional SIGNAL-ERROR is non-nil, signal an error when this 49If the optional SIGNAL-ERROR is non-nil, signal an error when this
50function fails in parsing of parameters." 50function fails in parsing of parameters. Otherwise, this function
51must never cause a Lisp error."
51 (with-temp-buffer 52 (with-temp-buffer
52 (let ((ttoken (ietf-drums-token-to-list ietf-drums-text-token)) 53 (let ((ttoken (ietf-drums-token-to-list ietf-drums-text-token))
53 (stoken (ietf-drums-token-to-list ietf-drums-tspecials)) 54 (stoken (ietf-drums-token-to-list ietf-drums-tspecials))
54 (ntoken (ietf-drums-token-to-list "0-9")) 55 (ntoken (ietf-drums-token-to-list "0-9"))
55 c type attribute encoded number prev-attribute vals 56 c type attribute encoded number prev-attribute vals
56 prev-encoded parameters value) 57 prev-encoded parameters value)
57 (ietf-drums-init (mail-header-remove-whitespace 58 (ietf-drums-init
58 (mail-header-remove-comments string))) 59 (condition-case nil
60 (mail-header-remove-whitespace
61 (mail-header-remove-comments string))
62 ;; The most likely cause of an error is unbalanced parentheses
63 ;; or double-quotes. If all parentheses and double-quotes are
64 ;; quoted meaninglessly with backslashes, removing them might
65 ;; make it parseable. Let's try...
66 (error
67 (let (mod)
68 (when (and (string-match "\\\\\"" string)
69 (not (string-match "\\`\"\\|[^\\]\"" string)))
70 (setq string (mm-replace-in-string string "\\\\\"" "\"")
71 mod t))
72 (when (and (string-match "\\\\(" string)
73 (string-match "\\\\)" string)
74 (not (string-match "\\`(\\|[^\\][()]" string)))
75 (setq string (mm-replace-in-string string "\\\\\\([()]\\)" "\\1")
76 mod t))
77 (or (and mod
78 (ignore-errors
79 (mail-header-remove-whitespace
80 (mail-header-remove-comments string))))
81 ;; Finally, attempt to extract only type.
82 (if (string-match
83 (concat "\\`[\t\n ]*\\([^" ietf-drums-tspecials "\t\n ]+"
84 "\\(/[^" ietf-drums-tspecials
85 "\t\n ]+\\)?\\)\\([\t\n ;]\\|\\'\\)")
86 string)
87 (match-string 1 string)
88 ""))))))
59 (let ((table (copy-syntax-table ietf-drums-syntax-table))) 89 (let ((table (copy-syntax-table ietf-drums-syntax-table)))
60 (modify-syntax-entry ?\' "w" table) 90 (modify-syntax-entry ?\' "w" table)
61 (modify-syntax-entry ?* " " table) 91 (modify-syntax-entry ?* " " table)
@@ -67,9 +97,12 @@ function fails in parsing of parameters."
67 (set-syntax-table table)) 97 (set-syntax-table table))
68 (setq c (char-after)) 98 (setq c (char-after))
69 (when (and (memq c ttoken) 99 (when (and (memq c ttoken)
70 (not (memq c stoken))) 100 (not (memq c stoken))
71 (setq type (downcase (buffer-substring 101 (setq type (ignore-errors
72 (point) (progn (forward-sexp 1) (point))))) 102 (downcase
103 (buffer-substring (point) (progn
104 (forward-sexp 1)
105 (point)))))))
73 ;; Do the params 106 ;; Do the params
74 (condition-case err 107 (condition-case err
75 (progn 108 (progn
@@ -180,8 +213,7 @@ function fails in parsing of parameters."
180 ;;(message "%s" (error-message-string err)) 213 ;;(message "%s" (error-message-string err))
181 ))) 214 )))
182 215
183 (when type 216 (cons type (nreverse parameters))))))
184 `(,type ,@(nreverse parameters)))))))
185 217
186(defun rfc2231-decode-encoded-string (string) 218(defun rfc2231-decode-encoded-string (string)
187 "Decode an RFC2231-encoded string. 219 "Decode an RFC2231-encoded string.