From f8a544490c951440c78113b3d5c827d167b35cdd Mon Sep 17 00:00:00 2001 From: yamaoka Date: Mon, 3 Mar 2003 22:41:47 +0000 Subject: [PATCH] Synch to Oort Gnus. --- lisp/ChangeLog | 33 +++++++++++++++++++++++++++++++ lisp/gnus-art.el | 4 ++-- lisp/gnus-kill.el | 2 +- lisp/gnus-msg.el | 2 +- lisp/gnus-uu.el | 4 ++-- lisp/mail-source.el | 55 ++++++++++++++++++++++++++++++++++++++++++++++++--- lisp/message.el | 4 ++-- lisp/mm-decode.el | 4 ++-- lisp/mm-url.el | 2 +- lisp/mml1991.el | 4 ++-- lisp/nndb.el | 4 ++-- lisp/nndoc.el | 2 +- lisp/nnrss.el | 2 +- texi/ChangeLog | 8 +++++++- texi/gnus-ja.texi | 26 ++++++++++++++++-------- texi/gnus.texi | 25 ++++++++++++++++------- 16 files changed, 145 insertions(+), 36 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aa543e8..52ae7a4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,36 @@ +2003-03-03 Reiner Steib + + * mail-source.el (mail-source-delete-old-incoming-confirm): Fixed + doc-string. + +2003-03-03 Jesper Harder + + * nnrss.el (nnrss-decode-entities-unibyte-string): Use `buffer-string'. + * nndoc.el (nndoc-dissect-mime-parts-sub): do. + * nndb.el (nndb-request-accept-article, nndb-status-message): do. + * mm-url.el (mm-url-decode-entities-string): do. + * mml1991.el (mml1991-mailcrypt-sign, mml1991-gpg-sign): do. + * mm-decode.el (mm-find-raw-part-by-type): do. + * message.el (message-send-mail-partially) + (message-send-mail-with-sendmail): do. + * gnus-uu.el (gnus-uu-save-article, gnus-uu-reginize-string): do. + * gnus-kill.el (gnus-pp-gnus-kill): do. + * gnus-art.el (gnus-article-treat-unfold-headers) + (gnus-article-encrypt-body): do. + +2003-02-24 Reiner Steib + + * mail-source.el (mail-source-delete-incoming): Allow integer value. + (mail-source-delete-old-incoming-confirm): New variable. + (mail-source-delete-old-incoming): Use it. New function. + (mail-source-callback): Call `mail-source-delete-old-incoming' if + `mail-source-delete-incoming' is a nonnegative integer. + +2003-03-03 Reiner Steib + + * gnus-msg.el (gnus-extended-version): Fix for 'emacs-gnus-config. + (gnus-user-agent): Fixed typo. + 2003-03-03 Kevin Greiner * gnus-agent.el (gnus-agent-enable-expiration): Fixed documentation. diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index b7e9051..64b3060 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -1942,7 +1942,7 @@ unfolded." (while (not (eobp)) (save-restriction (mail-header-narrow-to-field) - (let ((header (buffer-substring (point-min) (point-max)))) + (let ((header (buffer-string))) (with-temp-buffer (insert header) (goto-char (point-min)) @@ -7077,7 +7077,7 @@ For example: (search-forward field nil t)) (prog2 (message-narrow-to-field) - (buffer-substring (point-min) (point-max)) + (buffer-string) (delete-region (point-min) (point-max)) (widen)))) '("Content-Type:" "Content-Transfer-Encoding:" diff --git a/lisp/gnus-kill.el b/lisp/gnus-kill.el index dd6a774..41965a9 100644 --- a/lisp/gnus-kill.el +++ b/lisp/gnus-kill.el @@ -578,7 +578,7 @@ COMMAND must be a lisp expression or a string representing a key sequence." (insert "\n t")) (insert ")") (prog1 - (buffer-substring (point-min) (point-max)) + (buffer-string) (kill-buffer (current-buffer)))))) (defun gnus-execute-1 (function regexp form header) diff --git a/lisp/gnus-msg.el b/lisp/gnus-msg.el index b60fedf..f888be9 100644 --- a/lisp/gnus-msg.el +++ b/lisp/gnus-msg.el @@ -312,7 +312,7 @@ If nil, the address field will always be empty after invoking (defcustom gnus-user-agent 'emacs-gnus-type "Which information should be exposed in the User-Agent header. -It can be one of the symbols `gnus' \(show only Gnus version\) `emacs-gnus' +It can be one of the symbols `gnus' \(show only Gnus version\), `emacs-gnus' \(show only Emacs and Gnus versions\), `emacs-gnus-config' \(same as `emacs-gnus' plus system configuration\), `emacs-gnus-type' \(same as `emacs-gnus' plus system type\) or a custom string. If you set it to a diff --git a/lisp/gnus-uu.el b/lisp/gnus-uu.el index 0cdcc9a..3436670 100644 --- a/lisp/gnus-uu.el +++ b/lisp/gnus-uu.el @@ -861,7 +861,7 @@ When called interactively, prompt for REGEXP." (setq body (buffer-substring (1- (point)) (point-max))) (narrow-to-region (point-min) (point)) (if (not (setq headers gnus-uu-digest-headers)) - (setq sorthead (buffer-substring (point-min) (point-max))) + (setq sorthead (buffer-string)) (while headers (setq headline (car headers)) (setq headers (cdr headers)) @@ -1066,7 +1066,7 @@ When called interactively, prompt for REGEXP." (while (re-search-forward "[ \t]+" nil t) (replace-match "[ \t]+" t t)) - (buffer-substring (point-min) (point-max)))) + (buffer-string))) (defun gnus-uu-get-list-of-articles (n) ;; If N is non-nil, the article numbers of the N next articles diff --git a/lisp/mail-source.el b/lisp/mail-source.el index dfc2e5e..4896add 100644 --- a/lisp/mail-source.el +++ b/lisp/mail-source.el @@ -263,7 +263,23 @@ If non-nil, this maildrop will be checked periodically for new mail." :type 'integer) (defcustom mail-source-delete-incoming nil - "*If non-nil, delete incoming files after handling." + "*If non-nil, delete incoming files after handling. +If t, delete immediately, if nil, never delete. If a positive number, delete +files older than number of days." + ;; Note: The removing happens in `mail-source-callback', i.e. no old + ;; incoming files will be deleted, unless you receive new mail. + ;; + ;; You may also set this to `nil' and call `mail-source-delete-old-incoming' + ;; from a hook or interactively. + :group 'mail-source + :type '(choice (const :tag "immediately" t) + (const :tag "never" nil) + (integer :tag "days"))) + +(defcustom mail-source-delete-old-incoming-confirm t + "*If non-nil, ask for for confirmation before deleting old incoming files. +This variable only applies when `mail-source-delete-incoming' is a positive +number." :group 'mail-source :type 'boolean) @@ -508,6 +524,34 @@ Return the number of files that were found." (setq newname (make-temp-name newprefix))) newname)))) +(defun mail-source-delete-old-incoming (&optional age confirm) + "Remove incoming files older than AGE days. +If CONFIRM is non-nil, ask for confirmation before removing a file." + (interactive "P") + (let* ((high2days (/ 65536.0 60 60 24));; convert high bits to days + (low2days (/ 1.0 65536.0)) ;; convert low bits to days + (diff (if (natnump age) age 30));; fallback, if no valid AGE given + currday files) + (setq files (directory-files + mail-source-directory t + (concat mail-source-incoming-file-prefix "*")) + currday (* (car (current-time)) high2days) + currday (+ currday (* low2days (nth 1 (current-time))))) + (while files + (let* ((ffile (car files)) + (bfile (gnus-replace-in-string + ffile "\\`.*/\\([^/]+\\)\\'" "\\1")) + (filetime (nth 5 (file-attributes ffile))) + (fileday (* (car filetime) high2days)) + (fileday (+ fileday (* low2days (nth 1 filetime))))) + (setq files (cdr files)) + (when (and (> (- currday fileday) diff) + (gnus-message 8 "File `%s' is older than %s day(s)" + bfile diff) + (or (not confirm) + (y-or-n-p (concat "Remove file `" bfile "'? ")))) + (delete-file ffile)))))) + (defun mail-source-callback (callback info) "Call CALLBACK on the mail file, and then remove the mail file. Pass INFO on to CALLBACK." @@ -521,7 +565,7 @@ Pass INFO on to CALLBACK." (funcall callback mail-source-crash-box info) (when (file-exists-p mail-source-crash-box) ;; Delete or move the incoming mail out of the way. - (if mail-source-delete-incoming + (if (eq mail-source-delete-incoming t) (delete-file mail-source-crash-box) (let ((incoming (mail-source-make-complex-temp-name @@ -530,7 +574,12 @@ Pass INFO on to CALLBACK." mail-source-directory)))) (unless (file-exists-p (file-name-directory incoming)) (make-directory (file-name-directory incoming) t)) - (rename-file mail-source-crash-box incoming t))))))) + (rename-file mail-source-crash-box incoming t) + ;; remove old incoming files? + (when (natnump mail-source-delete-incoming) + (mail-source-delete-old-incoming + mail-source-delete-incoming + mail-source-delete-old-incoming-confirm)))))))) (defun mail-source-movemail (from to) "Move FROM to TO using movemail." diff --git a/lisp/message.el b/lisp/message.el index aad4d54..5134cae 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -3912,7 +3912,7 @@ This sub function is for exclusive use of `message-send-mail'." (message-remove-header "Lines") (goto-char (point-max)) (insert "Mime-Version: 1.0\n") - (setq header (buffer-substring (point-min) (point-max)))) + (setq header (buffer-string))) (goto-char (point-max)) (insert (format "Content-Type: message/partial; id=\"%s\"; number=%d; total=%d\n\n" id n total)) @@ -4072,7 +4072,7 @@ This sub function is for exclusive use of `message-send-mail'." (replace-match "; ")) (if (not (zerop (buffer-size))) (error "Sending...failed to %s" - (buffer-substring (point-min) (point-max))))))) + (buffer-string)))))) (when (bufferp errbuf) (kill-buffer errbuf))))) diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index 768fed6..8c47948 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -1266,7 +1266,7 @@ If RECURSIVE, search recursively." (if notp (not (equal (car ctl) type)) (equal (car ctl) type))) - (setq result (buffer-substring (point-min) (point-max))))))) + (setq result (buffer-string)))))) (forward-line 1) (setq start (point))) (when (and (not result) start) @@ -1279,7 +1279,7 @@ If RECURSIVE, search recursively." (if notp (not (equal (car ctl) type)) (equal (car ctl) type))) - (setq result (buffer-substring (point-min) (point-max))))))) + (setq result (buffer-string)))))) result)) (defvar mm-security-handle nil) diff --git a/lisp/mm-url.el b/lisp/mm-url.el index aa3cfda..401d500 100644 --- a/lisp/mm-url.el +++ b/lisp/mm-url.el @@ -359,7 +359,7 @@ If FOLLOW-REFRESH is non-nil, redirect refresh url in META." (with-temp-buffer (insert string) (mm-url-decode-entities) - (buffer-substring (point-min) (point-max)))) + (buffer-string))) (defun mm-url-form-encode-xwfu (chunk) "Escape characters in a string for application/x-www-form-urlencoded. diff --git a/lisp/mml1991.el b/lisp/mml1991.el index ff44132..78afa4f 100644 --- a/lisp/mml1991.el +++ b/lisp/mml1991.el @@ -55,7 +55,7 @@ (while (looking-at "^Content[^ ]+:") (forward-line)) (if (> (point) (point-min)) (progn - (setq headers (buffer-substring (point-min) (point))) + (setq headers (buffer-string)) (kill-region (point-min) (point)))) (goto-char (point-max)) (unless (bolp) @@ -140,7 +140,7 @@ (while (looking-at "^Content[^ ]+:") (forward-line)) (if (> (point) (point-min)) (progn - (setq headers (buffer-substring (point-min) (point))) + (setq headers (buffer-string)) (kill-region (point-min) (point)))) (goto-char (point-max)) (unless (bolp) diff --git a/lisp/nndb.el b/lisp/nndb.el index d8fb469..cfcc0c6 100644 --- a/lisp/nndb.el +++ b/lisp/nndb.el @@ -286,7 +286,7 @@ Optional LAST is ignored." (nntp-send-buffer "^[23].*\n")) (set-buffer nntp-server-buffer) - (setq msg (buffer-substring (point-min) (point-max))) + (setq msg (buffer-string)) (or (string-match "^\\([0-9]+\\)" msg) (error "nndb: %s" msg)) (setq art (substring msg (match-beginning 1) (match-end 1))) @@ -312,7 +312,7 @@ Optional LAST is ignored." (deffoo nndb-status-message (&optional server) "Return server status as a string." (set-buffer nntp-server-buffer) - (buffer-substring (point-min) (point-max))) + (buffer-string)) ;; Import stuff from nntp diff --git a/lisp/nndoc.el b/lisp/nndoc.el index b97e675..3599ff3 100644 --- a/lisp/nndoc.el +++ b/lisp/nndoc.el @@ -890,7 +890,7 @@ PARENT is the message-ID of the parent summary line, or nil for none." subtype "plain")) ;; Prepare the article and summary inserts. (unless article-insert - (setq article-insert (buffer-substring (point-min) (point-max)) + (setq article-insert (buffer-string) head-end head-begin)) ;; Fix MIME-Version (unless (string-match "MIME-Version:" article-insert) diff --git a/lisp/nnrss.el b/lisp/nnrss.el index 6bbfeb0..d86efe1 100644 --- a/lisp/nnrss.el +++ b/lisp/nnrss.el @@ -462,7 +462,7 @@ ARTICLE is the article number of the current headline.") (mm-with-unibyte-buffer (insert string) (mm-url-decode-entities-nbsp) - (buffer-substring (point-min) (point-max)))) + (buffer-string))) (defalias 'nnrss-insert 'nnrss-insert-w3) diff --git a/texi/ChangeLog b/texi/ChangeLog index 6943310..c1e66a1 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,9 @@ +2003-03-03 Reiner Steib + + * gnus.texi (Mail and Post): Updated `gnus-user-agent'. + (Mail Source Customization): Added `mail-source-delete-incoming' + and `mail-source-delete-old-incoming-confirm'. + 2003-03-01 Jesper Harder * gnus.texi (Troubleshooting): Fix typo. @@ -10,7 +16,7 @@ * gnus.texi: New values, 'to-list and 'cc-list, for gnus-boring-article-headers. - + 2003-02-28 Teodor Zlatanov * gnus.texi (Extending the spam elisp package): added mention of diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index ccb49b5..0093c57 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -10553,13 +10553,12 @@ ISP が POP-before-SMTP の認証を要求している場合に有用です。関 (訳注: T-gnus では現在この変数による制御は機能しません。) この変数は、ど の情報が User-Agent ヘッダーに陳列されるかを制御します。それは次のシンボ -ルまたは文字列のうちのどれかであることができます: @code{full} (全情報を -見せる、すなわち Emacs と Gnus のバージョンとシステム構成)、 -@code{emacs-gnus} (Emacs と Gnus のバージョンだけを見せる)、 -@code{emacs-gnus-type} (@code{emacs-gnus} と同じ+システムタイプ)、 -@code{gnus} (Gnus のバージョンだけを見せる)、または好みの文字列。これを -文字列にするときは、正しいフォーマットを使っていることを確認して下さ -い (RFC2616 参照)。 +ルまたは文字列のうちのどれかであることができます: @code{gnus} (Gnus のバー +ジョンのみ)、@code{emacs-gnus} (Emacs と Gnus のバージョンだけ)、 +@code{emacs-gnus-config} (@code{emacs-gnus} と同じ+システム構成)、 +@code{emacs-gnus-type} (@code{emacs-gnus}) と同じ+システムタイプ)、また +は好みの文字列。これを文字列にするときは、正しいフォーマットになっている +ことを確かめて下さい (RFC2616 参照)。 @end table あなたは自分が送るメッセージの綴りを調べたいと思うかも知れません。もしく @@ -12728,7 +12727,18 @@ UNDELETED} はおそらくたいていの人には最良の選択でしょうが、ときど @item mail-source-delete-incoming @vindex mail-source-delete-incoming @code{nil} でなければ、入って来たファイルは、それを処理した後に消去され -ます。 +ます。@code{t} ではファイルをただちに消去し、@code{nil} ではいかなるファ +イルも消しません。正の数だった場合は、その日数以上に古いファイルを消去し +ます (これは新着メールを取り込むときだけ行なわれます)。 +@code{mail-source-delete-incoming} を @code{nil} にしておいて、 +@code{mail-source-delete-old-incoming} をフックまたは手動で呼んでも良い +です。 + +@item mail-source-delete-old-incoming-confirm +@vindex mail-source-delete-old-incoming-confirm +非-@code{nil} だったら、古い incoming (メールの到着時に使われた) ファイ +ルを消去するときに確認を求めます。この変数 +は @code{mail-source-delete-incoming} が正の数である場合だけ使われます。 @item mail-source-ignore-errors @vindex mail-source-ignore-errors diff --git a/texi/gnus.texi b/texi/gnus.texi index 40d476e..97358b7 100644 --- a/texi/gnus.texi +++ b/texi/gnus.texi @@ -11102,12 +11102,12 @@ still a pain, though. @cindex User-Agent This variable controls which information should be exposed in the -User-Agent header. It can be one of the symbols @code{full} (show full -information, i.e. Emacs and Gnus version and system configuration), -@code{emacs-gnus} (show only Emacs and Gnus version), -@code{emacs-gnus-type} (same as @code{emacs-gnus} plus system type), -@code{gnus} (show only Gnus version) or a custom string. If you set it -to a string, be sure to use a valid format, see RFC 2616. +User-Agent header. It can be one of the symbols @code{gnus} (show only +Gnus version), @code{emacs-gnus} (show only Emacs and Gnus versions), +@code{emacs-gnus-config} (same as @code{emacs-gnus} plus system +configuration), @code{emacs-gnus-type} (same as @code{emacs-gnus} plus +system type) or a custom string. If you set it to a string, be sure to +use a valid format, see RFC 2616." @end table @@ -13348,7 +13348,18 @@ File where mail will be stored while processing it. The default is @item mail-source-delete-incoming @vindex mail-source-delete-incoming -If non-@code{nil}, delete incoming files after handling them. +If non-@code{nil}, delete incoming files after handling them. If +@code{t}, delete the files immediately, if @code{nil}, never delete any +files. If a positive number, delete files older than number of days +(This will only happen, when reveiving new mail). You may also set +@code{mail-source-delete-incoming} to @code{nil} and call +@code{mail-source-delete-old-incoming} from a hook or interactively. + +@item mail-source-delete-old-incoming-confirm +@vindex mail-source-delete-old-incoming-confirm +If @code{non-nil}, ask for for confirmation before deleting old incoming +files. This variable only applies when +@code{mail-source-delete-incoming} is a positive number. @item mail-source-ignore-errors @vindex mail-source-ignore-errors -- 1.7.10.4