From 0f298699ae83e75ef0eaf269f1c4e53e6576cef7 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 8 Nov 2001 00:11:03 +0000 Subject: [PATCH] Synch with Oort Gnus. --- lisp/ChangeLog | 23 +++++++++++++++++++ lisp/gnus-art.el | 6 +++-- lisp/gnus-sieve.el | 3 +-- lisp/mml.el | 2 ++ lisp/sieve-mode.el | 65 ++++++++++++++++++++++++++++++++++++++++++++++------ texi/ChangeLog | 12 ++++++++++ texi/gnus-ja.texi | 10 +++++++- texi/gnus.texi | 10 +++++++- texi/sieve.texi | 46 +++++++++++++++++++++++++++++++++++++ 9 files changed, 164 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed8b0cc..6165628 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,26 @@ +2001-11-07 Simon Josefsson + + * gnus-sieve.el (gnus-sieve-generate): Don't invoke sieve-mode. + + * sieve-mode.el (sieve-control-commands-face) + (sieve-control-commands-face, sieve-action-commands-face) + (sieve-test-commands-face, sieve-tagged-arguments-face): New + faces. + (sieve-font-lock-keywords): Use them. + (sieve-mode): Only set font-lock-defaults in emacs. + + * gnus-art.el (gnus-default-article-saver): Add + gnus-summary-save-body-in-file. + (gnus-summary-write-to-file): Fix doc. + +2001-11-07 Simon Josefsson + + * gnus-art.el (gnus-treat-highlight-signature): Add cross + reference to the correct chapter in the manual. + + * mml.el (mml-mode): Add cross reference to Emacs MIME manual. + Suggested by "Golubev I. N." . + 2001-11-07 06:00:00 ShengHuo ZHU * mml.el (mml-preview): Bind mail-header-separator. diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 2c37b71..f2d9b74 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -444,6 +444,7 @@ Gnus provides the following functions: * gnus-summary-save-in-mail (Unix mail format) * gnus-summary-save-in-folder (MH folder) * gnus-summary-save-in-file (article format) +* gnus-summary-save-body-in-file (article body) * gnus-summary-save-in-vm (use VM's folder format) * gnus-summary-write-to-file (article format -- overwrite)." :group 'gnus-article-saving @@ -451,6 +452,7 @@ Gnus provides the following functions: (function-item gnus-summary-save-in-mail) (function-item gnus-summary-save-in-folder) (function-item gnus-summary-save-in-file) + (function-item gnus-summary-save-body-in-file) (function-item gnus-summary-save-in-vm) (function-item gnus-summary-write-to-file))) @@ -842,7 +844,7 @@ used." (defcustom gnus-treat-highlight-signature '(or last (typep "text/x-vcard")) "Highlight the signature. Valid values are nil, t, `head', `last', an integer or a predicate. -See the manual for details." +See Info node `(gnus)Customizing Articles'." :group 'gnus-article-treat :type gnus-article-treat-custom) (put 'gnus-treat-highlight-signature 'highlight t) @@ -2919,7 +2921,7 @@ Directory to save to is default to `gnus-article-save-directory'." filename) (defun gnus-summary-write-to-file (&optional filename) - "Write this article to a file. + "Write this article to a file, overwriting it if the file exists. Optional argument FILENAME specifies file name. The directory to save in defaults to `gnus-article-save-directory'." (gnus-summary-save-in-file nil t)) diff --git a/lisp/gnus-sieve.el b/lisp/gnus-sieve.el index 0e52cac..209912c 100644 --- a/lisp/gnus-sieve.el +++ b/lisp/gnus-sieve.el @@ -112,8 +112,7 @@ See the documentation for these variables and functions for details." (insert sieve-template)) (insert gnus-sieve-region-start (gnus-sieve-script gnus-sieve-select-method gnus-sieve-crosspost) - gnus-sieve-region-end) - (sieve-mode)) + gnus-sieve-region-end)) (defun gnus-sieve-guess-rule-for-article () "Guess a sieve rule based on RFC822 article in buffer. diff --git a/lisp/mml.el b/lisp/mml.el index 194e632..71abcda 100644 --- a/lisp/mml.el +++ b/lisp/mml.el @@ -746,6 +746,8 @@ If HANDLES is non-nil, use it instead reparsing the buffer." (defun mml-mode (&optional arg) "Minor mode for editing MML. +MML is the MIME Meta Language, a minor mode for composing MIME articles. +See Info node `(emacs-mime)Composing'. \\{mml-mode-map}" (interactive "P") diff --git a/lisp/sieve-mode.el b/lisp/sieve-mode.el index eb32cf7..0445c02 100644 --- a/lisp/sieve-mode.el +++ b/lisp/sieve-mode.el @@ -45,7 +45,7 @@ ;; added keymap and menubar to hook into sieve-manage ;; 2001-10-31 version 1.2 committed to Oort Gnus ;; -;; $Id: sieve-mode.el,v 1.1.2.1 2001-11-01 08:25:40 yamaoka Exp $ +;; $Id: sieve-mode.el,v 1.1.2.2 2001-11-08 00:10:42 yamaoka Exp $ ;;; Code: @@ -66,20 +66,70 @@ ;; Font-lock +(defvar sieve-control-commands-face 'sieve-control-commands-face + "Face name used for Sieve Control Commands.") + +(defface sieve-control-commands-face + '((((type tty) (class color)) (:foreground "blue" :weight light)) + (((class grayscale) (background light)) (:foreground "LightGray" :bold t)) + (((class grayscale) (background dark)) (:foreground "DimGray" :bold t)) + (((class color) (background light)) (:foreground "Orchid")) + (((class color) (background dark)) (:foreground "LightSteelBlue")) + (t (:bold t))) + "Face used for Sieve Control Commands.") + +(defvar sieve-action-commands-face 'sieve-action-commands-face + "Face name used for Sieve Action Commands.") + +(defface sieve-action-commands-face + '((((type tty) (class color)) (:foreground "blue" :weight bold)) + (((class color) (background light)) (:foreground "Blue")) + (((class color) (background dark)) (:foreground "LightSkyBlue")) + (t (:inverse-video t :bold t))) + "Face used for Sieve Action Commands.") + +(defvar sieve-test-commands-face 'sieve-test-commands-face + "Face name used for Sieve Test Commands.") + +(defface sieve-test-commands-face + '((((type tty) (class color)) (:foreground "magenta")) + (((class grayscale) (background light)) + (:foreground "LightGray" :bold t :underline t)) + (((class grayscale) (background dark)) + (:foreground "Gray50" :bold t :underline t)) + (((class color) (background light)) (:foreground "CadetBlue")) + (((class color) (background dark)) (:foreground "Aquamarine")) + (t (:bold t :underline t))) + "Face used for Sieve Test Commands.") + +(defvar sieve-tagged-arguments-face 'sieve-tagged-arguments-face + "Face name used for Sieve Tagged Arguments.") + +(defface sieve-tagged-arguments-face + '((((type tty) (class color)) (:foreground "cyan" :weight bold)) + (((class grayscale) (background light)) (:foreground "LightGray" :bold t)) + (((class grayscale) (background dark)) (:foreground "DimGray" :bold t)) + (((class color) (background light)) (:foreground "Purple")) + (((class color) (background dark)) (:foreground "Cyan")) + (t (:bold t))) + "Face used for Sieve Tagged Arguments.") + + (defconst sieve-font-lock-keywords (eval-when-compile (list ;; control commands (cons (regexp-opt '("require" "if" "else" "elsif" "stop")) - 'font-lock-keyword-face) + 'sieve-control-commands-face) ;; action commands (cons (regexp-opt '("fileinto" "redirect" "reject" "keep" "discard")) - 'font-lock-keyword-face) + 'sieve-action-commands-face) ;; test commands (cons (regexp-opt '("address" "allof" "anyof" "exists" "false" "true" "header" "not" "size" "envelope")) - 'font-lock-builtin-face) - (cons "\\Sw+:\\sw+" 'font-lock-constant-face)))) + 'sieve-test-commands-face) + (cons "\\Sw+:\\sw+" + 'sieve-tagged-arguments-face)))) ;; Syntax table @@ -136,8 +186,9 @@ Turning on Sieve mode runs `sieve-mode-hook'." (set (make-local-variable 'comment-end) "") ;;(set (make-local-variable 'comment-start-skip) "\\(^\\|\\s-\\);?#+ *") (set (make-local-variable 'comment-start-skip) "#+ *") - (set (make-local-variable 'font-lock-defaults) - '(sieve-font-lock-keywords nil nil ((?_ . "w")))) + (unless (featurep 'xemacs) + (set (make-local-variable 'font-lock-defaults) + '(sieve-font-lock-keywords nil nil ((?_ . "w"))))) (easy-menu-add-item nil nil sieve-mode-menu)) ;; Menu diff --git a/texi/ChangeLog b/texi/ChangeLog index a8806e5..39593b7 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,15 @@ +2001-11-07 Simon Josefsson + + * sieve.texi (Examples): Add. + (Top): Add. + + * gnus.texi (Saving Articles): Add gnus-summary-write-to-file. + +2001-11-07 Simon Josefsson + + * gnus.texi (Misc Group Stuff): Add cross reference to Composing + Messages. Suggested by "Golubev I. N." . + 2001-11-04 09:00:00 ShengHuo ZHU * gnus.texi: Use C-M- instead of M-C-. diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index a640d28..fab2b69 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -3905,11 +3905,12 @@ Gnus @findex gnus-group-post-news あるグループに記事を投稿する (@code{gnus-group-post-news})。プレフィック スを与えると、現在のグループ名が初期値として使用されます。 +@xref{Composing Messages}。 @item m @kindex m (Group) @findex gnus-group-mail -メールをどこかに送る (@code{gnus-group-mail})。 +メールをどこかに送る (@code{gnus-group-mail})。@xref{Composing Messages}。 @end table 以下はグループバッファのための変数です: @@ -6822,6 +6823,13 @@ Unix メール (mbox) ファイルに保存します。変 入っている関数を、記事を保存するためのファイル名を取得するために使用しま す。ディフォルトは @code{gnus-numeric-save-name} です。 +@item gnus-summary-write-to-file +@findex gnus-summary-write-to-file +記事をストレートに通常のファイルに保存します。そのファイルが存在していた +ら上書きされます。変数 @code{gnus-file-save-name} に入っている関数を、記 +事を保存するためのファイル名を取得するために使用します。ディフォルト +は @code{gnus-numeric-save-name} です。 + @item gnus-summary-save-body-in-file @findex gnus-summary-save-body-in-file 記事の本体を通常のファイルの後に追加します。変 diff --git a/texi/gnus.texi b/texi/gnus.texi index 03190ca..c5f90a4 100644 --- a/texi/gnus.texi +++ b/texi/gnus.texi @@ -3852,11 +3852,12 @@ Enter the server buffer (@code{gnus-group-enter-server-mode}). @findex gnus-group-post-news Post an article to a group (@code{gnus-group-post-news}). If given a prefix, the current group name will be used as the default. +@xref{Composing Messages}. @item m @kindex m (Group) @findex gnus-group-mail -Mail a message somewhere (@code{gnus-group-mail}). +Mail a message somewhere (@code{gnus-group-mail}). @xref{Composing Messages}. @end table @@ -6930,6 +6931,13 @@ Append the article straight to an ordinary file. Uses the function in the @code{gnus-file-save-name} variable to get a file name to save the article in. The default is @code{gnus-numeric-save-name}. +@item gnus-summary-write-to-file +@findex gnus-summary-write-to-file +Write the article straight to an ordinary file. The file is +overwritten if it exists. Uses the function in the +@code{gnus-file-save-name} variable to get a file name to save the +article in. The default is @code{gnus-numeric-save-name}. + @item gnus-summary-save-body-in-file @findex gnus-summary-save-body-in-file Append the article body to an ordinary file. Uses the function in the diff --git a/texi/sieve.texi b/texi/sieve.texi index a2894f0..f069dbb 100644 --- a/texi/sieve.texi +++ b/texi/sieve.texi @@ -83,10 +83,13 @@ Sieve is a language for server-side filtering of mail. The language is documented in RFC 3028. This manual does not attempt to document the language, so keep RFC 3028 around. +A good online Sieve resources is @uref{http://www.cyrusoft.com/sieve/}. + @menu * Installation:: Getting ready to use the package. * Sieve Mode:: Editing Sieve scripts. * Managing Sieve:: Managing Sieve scripts on a remote server. +* Examples :: A few Sieve code snippets. * Manage Sieve API :: Interfacing to the Manage Sieve Protocol API. * Standards:: A summary of RFCs and working documents used. * Index:: Function and variable index. @@ -230,6 +233,49 @@ Displays help in the minibuffer. @end table +@node Examples +@chapter Examples + +If you are not familiar with Sieve, this chapter contains a few simple +code snippets that you can cut'n'paste and modify at will, until you +feel more comfortable with the Sieve language to write the rules from +scratch. + +The following complete Sieve script places all messages with a matching +@samp{Sender:} header into the given mailbox. Many mailing lists uses +this format. The first line makes sure your Sieve server understands +the @code{fileinto} command. + +@example +require "fileinto"; + +if address "sender" "owner-w3-beta@@xemacs.org" @{ + fileinto "INBOX.w3-beta"; +@} +@end example + +A few mailing lists do not use the @samp{Sender:} header, but does +contain some unique identifier in some other header. The following is +not a complete script, it assumes that @code{fileinto} has already been +required. + +@example +if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{ + fileinto "INBOX.auc-tex"; +@} +@end example + +At last, we have the hopeless mailing lists that does not have any +unique identifier and you are forced to match on the @samp{To:} and +@samp{Cc} headers. As before, this snippet assumes that @code{fileinto} +has been required. + +@example +if address ["to", "cc"] "kerberos@@mit.edu" @{ + fileinto "INBOX.kerberos"; +@} +@end example + @node Manage Sieve API @chapter Manage Sieve API -- 1.7.10.4