From: yamaoka Date: Wed, 23 Jan 2002 04:53:26 +0000 (+0000) Subject: Synch with Oort Gnus. X-Git-Tag: t-gnus-6_15_6-01-quimby~113 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=d3201a7c747420c78d284c707ddaa2fae0b3195f;p=elisp%2Fgnus.git- Synch with Oort Gnus. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9066373..fc9718a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,39 @@ +2002-01-23 Lars Magne Ingebrigtsen + + * gnus-art.el (gnus-emphasis-alist): Include !? as sentence-ending + characters. + +2002-01-22 Lars Magne Ingebrigtsen + + * gnus-xmas.el (gnus-xmas-completing-read): New function. + (gnus-xmas-redefine): Redefine conditionally. + +2002-01-22 Josh Huber + + * mml.el (mml-parse-1): Fixed usage of recipients in the secure + tag. + +2002-01-22 Josh Huber + + * message.el (message-font-lock-keywords): Added the secure tag. + * mml-sec.el: Added functions to generate/modify/remove the secure + tag while in message mode. + * mml-sec.el (mml-secure-message): New. + * mml-sec.el (mml-unsecure-message): New. + * mml-sec.el (mml-secure-message-sign-smime): New. + * mml-sec.el (mml-secure-message-sign-pgp): New. + * mml-sec.el (mml-secure-message-sign-pgpmime): New. + * mml-sec.el (mml-secure-message-encrypt-smime): New. + * mml-sec.el (mml-secure-message-encrypt-pgp): New. + * mml-sec.el (mml-secure-message-encrypt-pgpmime): New. + * mml.el (mml-parse-1): Added code to recognise the secure tag and + convert it to either a part or multipart depending on if there are + other parts in the message. + * mml.el (mml-mode-map): Changed default sign/encrypt keybindings + to use the secure tag, rather than the part tag. + * mml.el (mml-preview): Added a save-excursion to keep cursor + position after doing an MML preview. + 2002-01-22 Lars Magne Ingebrigtsen * nnheader.el (nnheader-parse-overview-file): New function. diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 845b22b..a0d1e62 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -316,7 +316,7 @@ directly.") (defcustom gnus-emphasis-alist (let ((format - "\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\\(\\([-,.;:\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)") + "\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)") (types '(("\\*" "\\*" bold) ("_" "_" underline) diff --git a/lisp/gnus-xmas.el b/lisp/gnus-xmas.el index ba3e34a..0e05eb8 100644 --- a/lisp/gnus-xmas.el +++ b/lisp/gnus-xmas.el @@ -439,6 +439,11 @@ call it with the value of the `gnus-data' text property." (defalias 'gnus-create-image 'gnus-xmas-create-image) (defalias 'gnus-remove-image 'gnus-xmas-remove-image) + (when (or (< emacs-major-version 21) + (and (= emacs-major-version 21) + (< emacs-minor-version 3))) + (defalias gnus-completing-read gnus-xmas-completing-read)) + ;; These ones are not defcutom'ed, sometimes not even defvar'ed. They ;; probably should. If that is done, the code below should then be moved ;; where each variable is defined, in order not to mess with user settings. @@ -927,6 +932,21 @@ Warning: Don't insert text immediately after the image." nil) nil nil nil nil nil 'gnus-image)) +(defun gnus-xmas-completing-read (prompt table &optional + predicate require-match history) + (when (and history + (not (boundp history))) + (set history nil)) + (completing-read + (if (symbol-value history) + (concat prompt " (" (car (symbol-value history)) "): ") + (concat prompt ": ")) + table + predicate + require-match + nil + history)) + (provide 'gnus-xmas) ;;; gnus-xmas.el ends here diff --git a/lisp/mm-url.el b/lisp/mm-url.el index 6a1caa1..2ab90f1 100644 --- a/lisp/mm-url.el +++ b/lisp/mm-url.el @@ -32,20 +32,19 @@ (eval-when-compile (require 'cl)) (require 'mm-util) -;;(require 'url) -(require 'w3) (eval-and-compile (autoload 'exec-installed-p "path-util") - ;;(autoload 'url-insert-file-contents "url-handlers") - (autoload 'url-insert-file-contents "url") - ) + (autoload 'url-insert-file-contents "url-handlers")) (defgroup mm-url nil "A wrapper of url package and external url command for Gnus." :group 'gnus) -(defcustom mm-url-use-external nil +(defcustom mm-url-use-external (not + (condition-case nil + (require 'url-handlers) + (error nil))) "*If not-nil, use external grab program `mm-url-program'." :type 'boolean :group 'mm-url) @@ -252,7 +251,7 @@ This is taken from RFC 2396.") (if (string-match "^file:/+" url) (insert-file-contents (substring url (1- (match-end 0)))) (mm-url-insert-file-contents-external url)) - ;;(require 'url-handlers) + (require 'url-handlers) (let ((name buffer-file-name)) (prog1 (url-insert-file-contents url) @@ -345,7 +344,7 @@ spaces. Die Die Die." (defun mm-url-fetch-form (url pairs) "Fetch a form from URL with PAIRS as the data using the POST method." - ;;(require 'url-handlers) + (require 'url-handlers) (let ((url-request-data (mm-url-encode-www-form-urlencoded pairs)) (url-request-method "POST") (url-request-extra-headers @@ -355,7 +354,7 @@ spaces. Die Die Die." t) (defun mm-url-fetch-simple (url content) - ;;(require 'url-handlers) + (require 'url-handlers) (let ((url-request-data content) (url-request-method "POST") (url-request-extra-headers diff --git a/lisp/mml-sec.el b/lisp/mml-sec.el index 3d30602..0230e0f 100644 --- a/lisp/mml-sec.el +++ b/lisp/mml-sec.el @@ -127,6 +127,61 @@ (interactive) (mml-secure-part "smime")) +;; defuns that add the proper <#secure ...> tag to the top of the message body +(defun mml-secure-message (method &optional sign) + (let ((mode (if sign "sign" "encrypt")) + insert-loc) + (mml-unsecure-message) + (save-excursion + (goto-char (point-max)) + (cond ((re-search-backward + (concat "^" (regexp-quote mail-header-separator) "\n") nil t) + (goto-char (setq insert-loc (match-end 0))) + (unless (looking-at "<#secure") + (mml-insert-tag + 'secure 'method method 'mode mode))) + (t (error + "The message is corrupted. No mail header separator")))) + (when (eql insert-loc (point)) + (forward-line 1)))) + +(defun mml-unsecure-message () + (interactive) + (save-excursion + (goto-char (point-max)) + (when (re-search-backward "^<#secure.*>\n" nil t) + (kill-region (match-beginning 0) (match-end 0))))) + +(defun mml-secure-message-sign-smime () + "Add MML tag to encrypt/sign the entire message." + (interactive) + (mml-secure-message "smime" 'sign)) + +(defun mml-secure-message-sign-pgp () + "Add MML tag to encrypt/sign the entire message." + (interactive) + (mml-secure-message "pgp" 'sign)) + +(defun mml-secure-message-sign-pgpmime () + "Add MML tag to encrypt/sign the entire message." + (interactive) + (mml-secure-message "pgpmime" 'sign)) + +(defun mml-secure-message-encrypt-smime () + "Add MML tag to encrypt/sign the entire message." + (interactive) + (mml-secure-message "smime")) + +(defun mml-secure-message-encrypt-pgp () + "Add MML tag to encrypt/sign the entire message." + (interactive) + (mml-secure-message "pgp")) + +(defun mml-secure-message-encrypt-pgpmime () + "Add MML tag to encrypt/sign the entire message." + (interactive) + (mml-secure-message "pgpmime")) + (provide 'mml-sec) ;;; mml-sec.el ends here diff --git a/lisp/mml.el b/lisp/mml.el index 1a94898..3e40080 100644 --- a/lisp/mml.el +++ b/lisp/mml.el @@ -143,6 +143,32 @@ one charsets.") (while (and (not (eobp)) (not (looking-at "<#/multipart"))) (cond + ((looking-at "<#secure") + ;; The secure part is essentially a meta-meta tag, which + ;; expands to either a part tag if there are no other parts in + ;; the document or a multipart tag if there are other parts + ;; included in the message + (let* (secure-mode + (taginfo (mml-read-tag)) + (recipients (cdr (assq 'recipients taginfo))) + (location (cdr (assq 'tag-location taginfo)))) + (save-excursion + (if + (re-search-forward + "<#\\(/\\)?\\(multipart\\|part\\|external\\|mml\\)." nil t) + (setq secure-mode "multipart") + (setq secure-mode "part"))) + (save-excursion + (goto-char location) + (re-search-forward "<#secure[^\n]*>\n")) + (delete-region (match-beginning 0) (match-end 0)) + (mml-insert-tag secure-mode + (cdr (assq 'mode taginfo)) + (cdr (assq 'method taginfo)) + (and recipients 'recipients) + recipients) + ;; restart the parse + (goto-char location))) ((looking-at "<#multipart") (push (nconc (mml-read-tag) (mml-parse-1)) struct)) ((looking-at "<#external") @@ -750,12 +776,12 @@ If HANDLES is non-nil, use it instead reparsing the buffer." (encrypt (make-sparse-keymap)) (map (make-sparse-keymap)) (main (make-sparse-keymap))) - (define-key sign "p" 'mml-secure-sign-pgpmime) - (define-key sign "o" 'mml-secure-sign-pgp) - (define-key sign "s" 'mml-secure-sign-smime) - (define-key encrypt "p" 'mml-secure-encrypt-pgpmime) - (define-key encrypt "o" 'mml-secure-encrypt-pgp) - (define-key encrypt "s" 'mml-secure-encrypt-smime) + (define-key sign "p" 'mml-secure-message-sign-pgpmime) + (define-key sign "o" 'mml-secure-message-sign-pgp) + (define-key sign "s" 'mml-secure-message-sign-smime) + (define-key encrypt "p" 'mml-secure-message-encrypt-pgpmime) + (define-key encrypt "o" 'mml-secure-message-encrypt-pgp) + (define-key encrypt "s" 'mml-secure-message-encrypt-smime) (define-key map "f" 'mml-attach-file) (define-key map "b" 'mml-attach-buffer) (define-key map "e" 'mml-attach-external) @@ -782,12 +808,12 @@ If HANDLES is non-nil, use it instead reparsing the buffer." ["Attach External" mml-attach-external t] ["Insert Part" mml-insert-part t] ["Insert Multipart" mml-insert-multipart t] - ["PGP/MIME Sign" mml-secure-sign-pgpmime t] - ["PGP/MIME Encrypt" mml-secure-encrypt-pgpmime t] - ["PGP Sign" mml-secure-sign-pgp t] - ["PGP Encrypt" mml-secure-encrypt-pgp t] - ["S/MIME Sign" mml-secure-sign-smime t] - ["S/MIME Encrypt" mml-secure-encrypt-smime t] + ["PGP/MIME Sign" mml-secure-message-sign-pgpmime t] + ["PGP/MIME Encrypt" mml-secure-message-encrypt-pgpmime t] + ["PGP Sign" mml-secure-message-sign-pgp t] + ["PGP Encrypt" mml-secure-message-encrypt-pgp t] + ["S/MIME Sign" mml-secure-message-sign-smime t] + ["S/MIME Encrypt" mml-secure-message-encrypt-smime t] ;;["Narrow" mml-narrow-to-part t] ["Quote MML" mml-quote-region t] ["Validate MML" mml-validate t] @@ -947,42 +973,43 @@ TYPE is the MIME type to use." "Display current buffer with Gnus, in a new buffer. If RAW, don't highlight the article." (interactive "P") - (let* ((buf (current-buffer)) - (message-options message-options) - (message-this-is-news (message-news-p)) - (message-posting-charset (or (gnus-setup-posting-charset - (save-restriction - (message-narrow-to-headers-or-head) - (message-fetch-field "Newsgroups"))) - message-posting-charset))) - (message-options-set-recipient) - (switch-to-buffer (generate-new-buffer - (concat (if raw "*Raw MIME preview of " - "*MIME preview of ") (buffer-name)))) - (erase-buffer) - (insert-buffer buf) - (if (re-search-forward - (concat "^" (regexp-quote mail-header-separator) "\n") nil t) - (replace-match "\n")) - (let ((mail-header-separator "")) ;; mail-header-separator is removed. - (mml-to-mime)) - (if raw - (when (fboundp 'set-buffer-multibyte) - (let ((s (buffer-string))) - ;; Insert the content into unibyte buffer. - (erase-buffer) - (mm-disable-multibyte) - (insert s))) - (let ((gnus-newsgroup-charset (car message-posting-charset)) - gnus-article-prepare-hook gnus-original-article-buffer) - (run-hooks 'gnus-article-decode-hook) - (let ((gnus-newsgroup-name "dummy")) - (gnus-article-prepare-display)))) - ;; Disable article-mode-map. - (use-local-map nil) - (setq buffer-read-only t) - (local-set-key "q" (lambda () (interactive) (kill-buffer nil))) - (goto-char (point-min)))) + (save-excursion + (let* ((buf (current-buffer)) + (message-options message-options) + (message-this-is-news (message-news-p)) + (message-posting-charset (or (gnus-setup-posting-charset + (save-restriction + (message-narrow-to-headers-or-head) + (message-fetch-field "Newsgroups"))) + message-posting-charset))) + (message-options-set-recipient) + (switch-to-buffer (generate-new-buffer + (concat (if raw "*Raw MIME preview of " + "*MIME preview of ") (buffer-name)))) + (erase-buffer) + (insert-buffer buf) + (if (re-search-forward + (concat "^" (regexp-quote mail-header-separator) "\n") nil t) + (replace-match "\n")) + (let ((mail-header-separator ""));; mail-header-separator is removed. + (mml-to-mime)) + (if raw + (when (fboundp 'set-buffer-multibyte) + (let ((s (buffer-string))) + ;; Insert the content into unibyte buffer. + (erase-buffer) + (mm-disable-multibyte) + (insert s))) + (let ((gnus-newsgroup-charset (car message-posting-charset)) + gnus-article-prepare-hook gnus-original-article-buffer) + (run-hooks 'gnus-article-decode-hook) + (let ((gnus-newsgroup-name "dummy")) + (gnus-article-prepare-display)))) + ;; Disable article-mode-map. + (use-local-map nil) + (setq buffer-read-only t) + (local-set-key "q" (lambda () (interactive) (kill-buffer nil))) + (goto-char (point-min))))) (defun mml-validate () "Validate the current MML document." diff --git a/texi/ChangeLog b/texi/ChangeLog index af06cf2..363dcac 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,10 @@ +2002-01-22 Josh Huber + + * emacs-mime.texi (MML Definition): Added a few words about the + recipients option. + * message.texi (Security): Changed documentation to reflect use of + the new secure tag. + 2002-01-21 Lars Magne Ingebrigtsen * gnus.texi (Article Washing): Addition. diff --git a/texi/emacs-mime.texi b/texi/emacs-mime.texi index 12a4862..0c043ba 100644 --- a/texi/emacs-mime.texi +++ b/texi/emacs-mime.texi @@ -1216,6 +1216,10 @@ RFC822 date when the part was modified (@code{Content-Disposition}). @item read-date RFC822 date when the part was read (@code{Content-Disposition}). +@item recipients +Who to encrypt/sign the part to. This field is used to override any +auto-detection based on the To/CC headers. + @item size The size (in octets) of the part (@code{Content-Disposition}). diff --git a/texi/message-ja.texi b/texi/message-ja.texi index fe8f76b..990c381 100644 --- a/texi/message-ja.texi +++ b/texi/message-ja.texi @@ -641,6 +641,7 @@ Manual}). @cindex PGP/MIME @cindex sign @cindex encrypt +@cindex secure Using the MML language, Message is able to create digitally signed and digitally encrypted messages. Message (or rather MML) currently @@ -653,46 +654,52 @@ c} key map for encryption, as follows. @item C-c C-m s s @kindex C-c C-m s s -@findex mml-secure-sign-smime +@findex mml-secure-message-sign-smime -Digitally sign current MIME part using S/MIME. +Digitally sign current message using S/MIME. @item C-c C-m s o @kindex C-c C-m s o -@findex mml-secure-sign-pgp +@findex mml-secure-message-sign-pgp -Digitally sign current MIME part using PGP. +Digitally sign current message using PGP. @item C-c C-m s p @kindex C-c C-m s p -@findex mml-secure-sign-pgp +@findex mml-secure-message-sign-pgp -Digitally sign current MIME part using PGP/MIME. +Digitally sign current message using PGP/MIME. @item C-c C-m c s @kindex C-c C-m c s -@findex mml-secure-encrypt-smime +@findex mml-secure-message-encrypt-smime -Digitally encrypt current MIME part using S/MIME. +Digitally encrypt current message using S/MIME. @item C-c C-m c o @kindex C-c C-m c o -@findex mml-secure-encrypt-pgp +@findex mml-secure-message-encrypt-pgp -Digitally encrypt current MIME part using PGP. +Digitally encrypt current message using PGP. @item C-c C-m c p @kindex C-c C-m c p -@findex mml-secure-encrypt-pgpmime +@findex mml-secure-message-encrypt-pgpmime -Digitally encrypt current MIME part using PGP/MIME. +Digitally encrypt current message using PGP/MIME. @end table These commands do not immediately sign or encrypt the message, they -merely insert proper MML tags to instruct the MML engine to perform that -operation when the message is actually sent. They may perform other -operations too, such as locating and retrieving a S/MIME certificate of -the person you wish to send encrypted mail to. +merely insert the proper MML secure tag to instruct the MML engine to +perform that operation when the message is actually sent. They may +perform other operations too, such as locating and retrieving a S/MIME +certificate of the person you wish to send encrypted mail to. When the +mml parsing engine converts your MML into a properly encoded MIME +message, the secure tag will be replaced with either a part or a +multipart tag. If your message contains other mml parts, a multipart +tag will be used; if no other parts are present in your message a single +part tag will be used. This way, message mode will do the Right Thing +(TM) with signed/encrypted multipart messages. Since signing and especially encryption often is used when sensitive information is sent, you may want to have some way to ensure that your diff --git a/texi/message.texi b/texi/message.texi index fb59329..53ef50c 100644 --- a/texi/message.texi +++ b/texi/message.texi @@ -665,6 +665,7 @@ Manual}). @cindex PGP/MIME @cindex sign @cindex encrypt +@cindex secure Using the MML language, Message is able to create digitally signed and digitally encrypted messages. Message (or rather MML) currently @@ -677,47 +678,53 @@ c} key map for encryption, as follows. @item C-c C-m s s @kindex C-c C-m s s -@findex mml-secure-sign-smime +@findex mml-secure-message-sign-smime -Digitally sign current MIME part using S/MIME. +Digitally sign current message using S/MIME. @item C-c C-m s o @kindex C-c C-m s o -@findex mml-secure-sign-pgp +@findex mml-secure-message-sign-pgp -Digitally sign current MIME part using PGP. +Digitally sign current message using PGP. @item C-c C-m s p @kindex C-c C-m s p -@findex mml-secure-sign-pgp +@findex mml-secure-message-sign-pgp -Digitally sign current MIME part using PGP/MIME. +Digitally sign current message using PGP/MIME. @item C-c C-m c s @kindex C-c C-m c s -@findex mml-secure-encrypt-smime +@findex mml-secure-message-encrypt-smime -Digitally encrypt current MIME part using S/MIME. +Digitally encrypt current message using S/MIME. @item C-c C-m c o @kindex C-c C-m c o -@findex mml-secure-encrypt-pgp +@findex mml-secure-message-encrypt-pgp -Digitally encrypt current MIME part using PGP. +Digitally encrypt current message using PGP. @item C-c C-m c p @kindex C-c C-m c p -@findex mml-secure-encrypt-pgpmime +@findex mml-secure-message-encrypt-pgpmime -Digitally encrypt current MIME part using PGP/MIME. +Digitally encrypt current message using PGP/MIME. @end table These commands do not immediately sign or encrypt the message, they -merely insert proper MML tags to instruct the MML engine to perform that -operation when the message is actually sent. They may perform other -operations too, such as locating and retrieving a S/MIME certificate of -the person you wish to send encrypted mail to. +merely insert the proper MML secure tag to instruct the MML engine to +perform that operation when the message is actually sent. They may +perform other operations too, such as locating and retrieving a S/MIME +certificate of the person you wish to send encrypted mail to. When the +mml parsing engine converts your MML into a properly encoded MIME +message, the secure tag will be replaced with either a part or a +multipart tag. If your message contains other mml parts, a multipart +tag will be used; if no other parts are present in your message a single +part tag will be used. This way, message mode will do the Right Thing +(TM) with signed/encrypted multipart messages. Since signing and especially encryption often is used when sensitive information is sent, you may want to have some way to ensure that your