X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fmm-uu.el;h=d91d2a41c8f95e01162c9e64e9045b07d603d0e5;hb=1c2ed0ce5abe2181e51f777171f8cd40a547e5a9;hp=c690713ef14899b99cacc3f1314a9a0d3d53201e;hpb=9a8731d6dea8021a10dec1b42f382609336a9aa9;p=gnus diff --git a/lisp/mm-uu.el b/lisp/mm-uu.el index c690713ef..d91d2a41c 100644 --- a/lisp/mm-uu.el +++ b/lisp/mm-uu.el @@ -1,7 +1,6 @@ ;;; mm-uu.el --- Return uu stuff as mm handles -;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1998-2014 Free Software Foundation, Inc. ;; Author: Shenghuo Zhu ;; Keywords: postscript uudecode binhex shar forward gnatsweb pgp @@ -159,13 +158,25 @@ This can be either \"inline\" or \"attachment\".") mm-uu-diff-extract nil mm-uu-diff-test) + (diff + "^=== modified file " + nil + mm-uu-diff-extract + nil + mm-uu-diff-test) + (git-format-patch + "^diff --git " + "^-- " + mm-uu-diff-extract + nil + mm-uu-diff-test) (message-marks ;; Text enclosed with tags similar to `message-mark-insert-begin' and ;; `message-mark-insert-end'. Don't use those variables to avoid ;; dependency on `message.el'. "^-+[8<>]*-\\{9,\\}[a-z ]+-\\{9,\\}[a-z ]+-\\{9,\\}[8<>]*-+$" "^-+[8<>]*-\\{9,\\}[a-z ]+-\\{9,\\}[a-z ]+-\\{9,\\}[8<>]*-+$" - (lambda () (mm-uu-verbatim-marks-extract -1 0 1 -1)) + (lambda () (mm-uu-verbatim-marks-extract 0 0 1 -1)) nil) ;; Omitting [a-z8<] leads to false positives (bogus signature separators ;; and mailing list banners). @@ -176,7 +187,7 @@ This can be either \"inline\" or \"attachment\".") nil) (verbatim-marks ;; slrn-style verbatim marks, see - ;; http://www.slrn.org/manual/slrn-manual-6.html#ss6.81 + ;; http://slrn.sourceforge.net/docs/slrn-manual-6.html#process_verbatim_marks "^#v\\+" "^#v\\-$" (lambda () (mm-uu-verbatim-marks-extract 0 0)) @@ -186,7 +197,15 @@ This can be either \"inline\" or \"attachment\".") "^\\\\end{document}" mm-uu-latex-extract nil - mm-uu-latex-test)) + mm-uu-latex-test) + (org-src-code-block + "^[ \t]*#\\+begin_" + "^[ \t]*#\\+end_" + mm-uu-org-src-code-block-extract) + (org-meta-line + "^[ \t]*#\\+[[:alpha:]]+: " + "$" + mm-uu-org-src-code-block-extract)) "A list of specifications for non-MIME attachments. Each element consist of the following entries: label, start-regexp, end-regexp, extract-function, test-function. @@ -383,6 +402,10 @@ apply the face `mm-uu-extract'." (list mm-dissect-disposition (cons 'filename file-name)))) +(defun mm-uu-org-src-code-block-extract () + (mm-make-handle (mm-uu-copy-to-buffer start-point end-point) + '("text/x-org"))) + (defvar gnus-newsgroup-name) (defun mm-uu-emacs-sources-test () @@ -407,7 +430,11 @@ apply the face `mm-uu-extract'." (defun mm-uu-forward-extract () (mm-make-handle (mm-uu-copy-to-buffer - (progn (goto-char start-point) (forward-line) (point)) + (progn + (goto-char start-point) + (forward-line) + (skip-chars-forward "\n") + (point)) (progn (goto-char end-point) (forward-line -1) (point))) '("message/rfc822" (charset . gnus-decoded)))) @@ -441,7 +468,7 @@ apply the face `mm-uu-extract'." (defun mm-uu-yenc-extract () ;; This might not be exactly correct, but we sure can't get the ;; binary data from the article buffer, since that's already in a - ;; non-binary charset. So get it from the original article buffer. + ;; non-binary charset. So get it from the original article buffer. (mm-make-handle (with-current-buffer gnus-original-article-buffer (mm-uu-copy-to-buffer start-point end-point)) (list (or (and file-name @@ -486,9 +513,11 @@ apply the face `mm-uu-extract'." (if (mm-uu-pgp-signed-test) (progn (mml2015-clean-buffer) - (let ((coding-system-for-write (or gnus-newsgroup-charset + (let ((coding-system-for-write (or buffer-file-coding-system + gnus-newsgroup-charset 'iso-8859-1)) - (coding-system-for-read (or gnus-newsgroup-charset + (coding-system-for-read (or buffer-file-coding-system + gnus-newsgroup-charset 'iso-8859-1))) (funcall (mml2015-clear-verify-function)))) (when (and mml2015-use (null (mml2015-clear-verify-function))) @@ -644,22 +673,34 @@ value of `mm-uu-text-plain-type'." (goto-char text-start) (re-search-forward "." start-point t))) (push - (mm-make-handle (mm-uu-copy-to-buffer text-start start-point) - mm-uu-text-plain-type) + (mm-make-handle + (mm-uu-copy-to-buffer + text-start + ;; A start-separator is likely accompanied by + ;; a leading newline. + (if (and (eq (char-before start-point) ?\n) + (eq (char-before (1- start-point)) ?\n)) + (1- start-point) + start-point)) + mm-uu-text-plain-type) result)) (push (funcall (mm-uu-function-extract entry)) result) (goto-char (setq text-start end-point)))) (when result - (if (and (> (point-max) (1+ text-start)) - (save-excursion - (goto-char text-start) - (re-search-forward "." nil t))) - (push - (mm-make-handle (mm-uu-copy-to-buffer text-start (point-max)) - mm-uu-text-plain-type) - result)) + (goto-char text-start) + (when (re-search-forward "." nil t) + (push (mm-make-handle + (mm-uu-copy-to-buffer + ;; An end-separator is likely accompanied by + ;; a trailing newline. + (if (eq (char-after text-start) ?\n) + (1+ text-start) + text-start) + (point-max)) + mm-uu-text-plain-type) + result)) (setq result (cons "multipart/mixed" (nreverse result)))) result))) @@ -680,6 +721,8 @@ Assume text has been decoded if DECODED is non-nil." ;; Mutt still uses application/pgp even though ;; it has already been withdrawn. (string-match "\\`text/\\|\\`application/pgp\\'" type) + (equal (car (mm-handle-disposition handle)) + "inline") (setq children (with-current-buffer buffer @@ -727,5 +770,4 @@ Assume text has been decoded if DECODED is non-nil." (provide 'mm-uu) -;; arch-tag: 7db076bf-53db-4320-aa19-ca76a1d2ab2c ;;; mm-uu.el ends here