From 3bdabd34a52726a0d840842fd2330baafedf3e48 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sat, 11 Jan 2003 21:47:00 +0000 Subject: [PATCH] * deuglify.el (gnus-outlook-deuglify-attrib-verb-regexp): Added castellano. (gnus-outlook-display-hook): New variable. (gnus-outlook-display-article-buffer): New function. (gnus-outlook-unwrap-lines, gnus-outlook-repair-attribution) (gnus-outlook-deuglify-article): Made them interactive and added optional arg. Use `g-o-d-a-b'. (gnus-article-outlook-deuglify-article): Use `g-o-d-a-b'. * gnus-sum.el: Added autoloads. (gnus-summary-mode-map): Added gnus-summary-wash-deuglify-map. (gnus-summary-make-menu-bar): Added "(Outlook) Deuglify" menu. * gnus-art.el (gnus-display-mime): Use the mime emulation variable. * gnus-sum.el (gnus-article-emulate-mime): New variable. * gnus-start.el (gnus-read-newsrc-el-file): Make sure that the newsrc-alist is initialized properly. * mail-source.el (mail-sources): Autoload. * gnus-sum.el (gnus-summary-make-false-root-always): Default to nil. --- lisp/ChangeLog | 25 +++++++++++++ lisp/deuglify.el | 88 +++++++++++++++++++++++++++------------------ lisp/gnus-art.el | 7 ++-- lisp/gnus-start.el | 16 ++++----- lisp/gnus-sum.el | 30 ++++++++++++++-- lisp/mail-source.el | 1 + 6 files changed, 119 insertions(+), 48 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bd46a4b0b..6533ac609 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,30 @@ +2003-01-10 Reiner Steib + + * deuglify.el (gnus-outlook-deuglify-attrib-verb-regexp): Added + castellano. + (gnus-outlook-display-hook): New variable. + (gnus-outlook-display-article-buffer): New function. + (gnus-outlook-unwrap-lines, gnus-outlook-repair-attribution) + (gnus-outlook-deuglify-article): Made them interactive and added + optional arg. Use `g-o-d-a-b'. + (gnus-article-outlook-deuglify-article): Use `g-o-d-a-b'. + + * gnus-sum.el: Added autoloads. + (gnus-summary-mode-map): Added gnus-summary-wash-deuglify-map. + (gnus-summary-make-menu-bar): Added "(Outlook) Deuglify" menu. + 2003-01-11 Lars Magne Ingebrigtsen + * gnus-art.el (gnus-display-mime): Use the mime emulation + variable. + + * gnus-sum.el (gnus-article-emulate-mime): New variable. + + * gnus-start.el (gnus-read-newsrc-el-file): Make sure that the + newsrc-alist is initialized properly. + + * mail-source.el (mail-sources): Autoload. + * gnus-sum.el (gnus-summary-make-false-root-always): Default to nil. diff --git a/lisp/deuglify.el b/lisp/deuglify.el index 81ba9e9b7..915a6256d 100644 --- a/lisp/deuglify.el +++ b/lisp/deuglify.el @@ -266,7 +266,7 @@ :group 'gnus-outlook-deuglify) (defcustom gnus-outlook-deuglify-attrib-verb-regexp - "wrote\\|writes\\|says\\|schrieb\\|schreibt\\|meinte\\|skrev\\|a écrit\\|schreef" + "wrote\\|writes\\|says\\|schrieb\\|schreibt\\|meinte\\|skrev\\|a écrit\\|schreef\\|escribió" "Regular expression matching the verb used in an attribution line." :type 'string :group 'gnus-outlook-deuglify) @@ -277,17 +277,35 @@ :type 'string :group 'gnus-outlook-deuglify) +;;;###autoload +(defcustom gnus-outlook-display-hook nil + "A hook called after an deuglified article has been prepared. +It is run after `gnus-article-prepare-hook'." + :type 'hook + :group 'gnus-outlook-deuglify) ;; Functions +(defun gnus-outlook-display-article-buffer () + "Redisplay current buffer or article buffer." + (with-current-buffer (or gnus-article-buffer (current-buffer)) + ;; "Emulate" `gnus-article-prepare-display' without calling + ;; it. Calling `gnus-article-prepare-display' on an already + ;; prepared article removes all MIME parts. I'm unsure whether + ;; this is a bug or not. + (gnus-article-highlight t) + (gnus-treat-article nil) + (gnus-run-hooks 'gnus-article-prepare-hook + 'gnus-outlook-display-hook))) + ;;;###autoload -(defun gnus-outlook-unwrap-lines () - "Unwrap lines that appear to be wrapped citation lines. +(defun gnus-outlook-unwrap-lines (&optional nodisplay) + "Unwrap lines that appear to be wrapped citation lines. You can control what lines will be unwrapped by frobbing -`gnus-outlook-deuglify-unwrap-min' and -`gnus-outlook-deuglify-unwrap-max', indicating the miminum and maximum -length of an unwrapped citation line." - (interactive) +`gnus-outlook-deuglify-unwrap-min' and `gnus-outlook-deuglify-unwrap-max', +indicating the miminum and maximum length of an unwrapped citation line. If +NODISPLAY is non-nil, don't redisplay the article buffer." + (interactive "P") (save-excursion (let ((case-fold-search nil) (inhibit-read-only t) @@ -308,7 +326,8 @@ length of an unwrapped citation line." (< (+ len12 len3) gnus-outlook-deuglify-unwrap-max)) (progn (replace-match "\\1\\2 \\3") - (goto-char (match-beginning 0)))))))))) + (goto-char (match-beginning 0))))))))) + (unless nodisplay (gnus-outlook-display-article-buffer))) (defun gnus-outlook-rearrange-article (attr-start) "Put the text from `attr-start' to the end of buffer at the top of the article buffer." @@ -400,45 +419,46 @@ length of an unwrapped citation line." (match-beginning 0))))))) ;;;###autoload -(defun gnus-outlook-repair-attribution () - "Repair a broken attribution line." - (interactive) - (or - (gnus-outlook-repair-attribution-other) - (gnus-outlook-repair-attribution-block) - (gnus-outlook-repair-attribution-outlook))) - -(defun gnus-outlook-rearrange-citation () - "Repair broken citations." - (let ((attrib-start (gnus-outlook-repair-attribution))) +(defun gnus-outlook-repair-attribution (&optional nodisplay) + "Repair a broken attribution line. +If NODISPLAY is non-nil, don't redisplay the article buffer." + (interactive "P") + (let ((attrib-start + (or + (gnus-outlook-repair-attribution-other) + (gnus-outlook-repair-attribution-block) + (gnus-outlook-repair-attribution-outlook)))) + (unless nodisplay (gnus-outlook-display-article-buffer)) + attrib-start)) + +(defun gnus-outlook-rearrange-citation (&optional nodisplay) + "Repair broken citations. +If NODISPLAY is non-nil, don't redisplay the article buffer." + (interactive "P") + (let ((attrib-start (gnus-outlook-repair-attribution 'nodisplay))) ;; rearrange citations if an attribution line has been recognized (if attrib-start - (gnus-outlook-rearrange-article attrib-start)))) + (gnus-outlook-rearrange-article attrib-start))) + (unless nodisplay (gnus-outlook-display-article-buffer))) ;;;###autoload -(defun gnus-outlook-deuglify-article () - "Deuglify broken Outlook (Express) articles." - (interactive) +(defun gnus-outlook-deuglify-article (&optional nodisplay) + "Deuglify broken Outlook (Express) articles. +If NODISPLAY is non-nil, don't redisplay the article buffer." + (interactive "P") ;; apply treatment of dumb quotes (gnus-article-treat-dumbquotes) ;; repair wrapped cited lines - (gnus-outlook-unwrap-lines) + (gnus-outlook-unwrap-lines 'nodisplay) ;; repair attribution line - (gnus-outlook-rearrange-citation)) + (gnus-outlook-rearrange-citation 'nodisplay) + (unless nodisplay (gnus-outlook-display-article-buffer))) ;;;###autoload (defun gnus-article-outlook-deuglify-article () "Deuglify broken Outlook (Express) articles and redisplay." (interactive) - (gnus-outlook-deuglify-article) - (with-current-buffer (or gnus-article-buffer (current-buffer)) - ;; "Emulate" `gnus-article-prepare-display' without calling - ;; it. Calling `gnus-article-prepare-display' on an already - ;; prepared article removes all MIME parts. I'm unsure whether - ;; this is a bug or not. - (gnus-article-highlight t) - (gnus-treat-article nil) - (gnus-run-hooks 'gnus-article-prepare-hook))) + (gnus-outlook-deuglify-article nil)) (provide 'deuglify) diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index 94278b070..c71dfe0d2 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -4343,9 +4343,10 @@ If no internal viewer is available, use an external viewer." ;; We have to do this since selecting the window ;; may change the point. So we set the window point. (set-window-point window point))) - (let* ((handles (or ihandles (mm-dissect-buffer - nil gnus-article-loose-mime) - (mm-uu-dissect))) + (let* ((handles (or ihandles + (mm-dissect-buffer nil gnus-article-loose-mime) + (and gnus-article-emulate-mime + (mm-uu-dissect)))) buffer-read-only handle name type b e display) (when (and (not ihandles) (not gnus-displaying-mime)) diff --git a/lisp/gnus-start.el b/lisp/gnus-start.el index 9425dea3c..124ac582e 100644 --- a/lisp/gnus-start.el +++ b/lisp/gnus-start.el @@ -2196,14 +2196,14 @@ If FORCE is non-nil, the .newsrc file is read." (< version 5.090009)) (setq gnus-format-specs gnus-default-format-specs))) (when gnus-newsrc-assoc - (setq gnus-newsrc-alist gnus-newsrc-assoc))) - (gnus-make-hashtable-from-newsrc-alist) - (when (file-newer-than-file-p file ding-file) - ;; Old format quick file - (gnus-message 5 "Reading %s..." file) - ;; The .el file is newer than the .eld file, so we read that one - ;; as well. - (gnus-read-old-newsrc-el-file file))))) + (setq gnus-newsrc-alist gnus-newsrc-assoc)))) + (gnus-make-hashtable-from-newsrc-alist) + (when (file-newer-than-file-p file ding-file) + ;; Old format quick file + (gnus-message 5 "Reading %s..." file) + ;; The .el file is newer than the .eld file, so we read that one + ;; as well. + (gnus-read-old-newsrc-el-file file)))) ;; Parse the old-style quick startup file (defun gnus-read-old-newsrc-el-file (file) diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index 0aa82ee13..0c37ba2e2 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -46,6 +46,9 @@ (autoload 'gnus-article-outlook-deuglify-article "deuglify" "Deuglify broken Outlook (Express) articles and redisplay." t) +(autoload 'gnus-outlook-unwrap-lines "deuglify" nil t) +(autoload 'gnus-outlook-repair-attribution "deuglify" nil t) +(autoload 'gnus-outlook-rearrange-citation "deuglify" nil t) (defcustom gnus-kill-summary-on-exit t "*If non-nil, kill the summary buffer when you exit from it. @@ -1040,6 +1043,14 @@ the MIME-Version header is missed." :type 'boolean :group 'gnus-article) +(defcustom gnus-article-emulate-mime t + "If non-nil, use MIME emulation for uuencode and the like. +This means that Gnus will search message bodies for text that look +like uuencoded bits, yEncoded bits, and so on, and present that using +the normal Gnus MIME machinery." + :type 'boolean + :group 'gnus-article) + ;;; Internal variables (defvar gnus-summary-display-cache nil) @@ -1785,7 +1796,14 @@ increase the score of each group you read." "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive "p" gnus-article-verify-x-pgp-sig "d" gnus-article-treat-dumbquotes - "k" gnus-article-outlook-deuglify-article) + "k" gnus-article-outlook-deuglify-article) ;; mnemonic: outloo*k* + + (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map) + ;; mnemonic: deuglif*Y* + "u" gnus-outlook-unwrap-lines + "a" gnus-outlook-repair-attribution + "c" gnus-outlook-rearrange-citation + "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map) "a" gnus-article-hide @@ -2099,7 +2117,12 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs)))) ["URLs" gnus-article-unsplit-urls t] ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t] ["HZ" gnus-article-decode-HZ t] - ["OutlooK deuglify" gnus-article-outlook-deuglify-article t] + ("(Outlook) Deuglify" + ["Unwrap lines" gnus-outlook-unwrap-lines t] + ["Repair attribution" gnus-outlook-repair-attribution t] + ["Rearrange citation" gnus-outlook-rearrange-citation t] + ["Full (Outlook) deuglify" + gnus-article-outlook-deuglify-article t]) ) ("Output" ["Save in default format" gnus-summary-save-article @@ -10715,7 +10738,8 @@ If REVERSE, save parts that do not match TYPE." (set-buffer gnus-article-buffer) (let ((handles (or gnus-article-mime-handles (mm-dissect-buffer nil gnus-article-loose-mime) - (mm-uu-dissect)))) + (and gnus-article-emulate-mime + (mm-uu-dissect))))) (when handles (gnus-summary-save-parts-1 type dir handles reverse) (unless gnus-article-mime-handles ;; Don't destroy this case. diff --git a/lisp/mail-source.el b/lisp/mail-source.el index e8414491f..bf9d624bc 100644 --- a/lisp/mail-source.el +++ b/lisp/mail-source.el @@ -55,6 +55,7 @@ (list 'const (car a))) imap-stream-alist))) +;;;###autoload (defcustom mail-sources nil "*Where the mail backends will look for incoming mail. This variable is a list of mail source specifiers. -- 2.25.1