# HG changeset patch # User Katsumi Yamaoka # Date 1283150950 0 # Node ID d575ee440ad447e5bf341c8d3c41e7fb567e6bd4 # Parent d24d9e523bc47dce7d35ca062c5481aab48d48b1# Parent fcae870dab3a215a389c40fb0b2337271f580fe3 Merge from mainline. diff -r d24d9e523bc4 -r d575ee440ad4 doc/misc/ChangeLog --- a/doc/misc/ChangeLog Mon Aug 30 06:09:18 2010 +0000 +++ b/doc/misc/ChangeLog Mon Aug 30 06:49:10 2010 +0000 @@ -1,3 +1,18 @@ +2010-08-29 Lars Magne Ingebrigtsen + + * gnus.texi (Drafts): Mention B DEL. + +2010-08-29 Tim Landscheidt (tiny change) + + * gnus.texi (Delayed Articles): Mention that the Date header is the + original one, even if you delay. + +2010-08-29 Lars Magne Ingebrigtsen + + * gnus.texi (Asynchronous Fetching): Document + gnus-async-post-fetch-function. + (HTML): Made into its own section. + 2010-08-26 Michael Albinus Sync with Tramp 2.1.19. diff -r d24d9e523bc4 -r d575ee440ad4 doc/misc/emacs-mime.texi --- a/doc/misc/emacs-mime.texi Mon Aug 30 06:09:18 2010 +0000 +++ b/doc/misc/emacs-mime.texi Mon Aug 30 06:49:10 2010 +0000 @@ -394,7 +394,7 @@ @item mm-text-html-renderer @vindex mm-text-html-renderer This selects the function used to render @acronym{HTML}. The predefined -renderers are selected by the symbols @code{w3}, +renderers are selected by the symbols @code{gnus-article-html}, @code{w3}, @code{w3m}@footnote{See @uref{http://emacs-w3m.namazu.org/} for more information about emacs-w3m}, @code{links}, @code{lynx}, @code{w3m-standalone} or @code{html2text}. If @code{nil} use an diff -r d24d9e523bc4 -r d575ee440ad4 doc/misc/gnus.texi --- a/doc/misc/gnus.texi Mon Aug 30 06:09:18 2010 +0000 +++ b/doc/misc/gnus.texi Mon Aug 30 06:49:10 2010 +0000 @@ -6043,6 +6043,11 @@ This variable can also be a number. In that case, center the window at the given number of lines from the top. +@item gnus-summary-stop-at-end-of-message +@vindex gnus-summary-stop-at-end-of-message +If non-@code{nil}, don't go to the next article when hitting +@kbd{SPC}, and you're at the end of the article. + @end table @@ -6753,6 +6758,12 @@ Just don't forget to set that up :-) @end table +When delaying an article with @kbd{C-c C-j}, Message mode will +automatically add a @code{"Date"} header with the current time. In +many cases you probably want the @code{"Date"} header to reflect the +time the message is sent instead. To do this, you have to delete +@code{Date} from @code{message-draft-headers}. + @node Marking Articles @section Marking Articles @@ -8271,6 +8282,16 @@ preferably be short and sweet to avoid slowing down Gnus too much. It's probably a good idea to byte-compile things like this. +@vindex gnus-async-post-fetch-function +@findex gnus-html-prefetch-images +After an article has been prefetched, this +@code{gnus-async-post-fetch-function} will be called. The buffer will +be narrowed to the region of the article that was fetched. A useful +value would be @code{gnus-html-prefetch-images}, which will prefetch +and store images referenced in the article, so that you don't have to +wait for them to be fetched when you read the article. This is useful +for @acronym{HTML} messages that have external images. + @vindex gnus-prefetched-article-deletion-strategy Articles have to be removed from the asynch buffer sooner or later. The @code{gnus-prefetched-article-deletion-strategy} says when to remove @@ -12186,6 +12207,7 @@ @menu * Hiding Headers:: Deciding what headers should be displayed. * Using MIME:: Pushing articles through @acronym{MIME} before reading them. +* HTML:: Reading @acronym{HTML} messages. * Customizing Articles:: Tailoring the look of the articles. * Article Keymap:: Keystrokes available in the article buffer. * Misc Article:: Other stuff. @@ -12482,6 +12504,48 @@ Also @pxref{MIME Commands}. +@node HTML +@section @acronym{HTML} +@cindex @acronym{HTML} + +If you have @code{w3m} installed on your system, Gnus can display +@acronym{HTML} articles in the article buffer. There are many Gnus +add-ons for doing this, using various approaches, but there's one +(sort of) built-in method that's used by default. + +For a complete overview, consult @xref{Display Customization, +,Display Customization, emacs-mime, The Emacs MIME Manual}. This +section only describes the default method. + +@table @code +@item mm-text-html-renderer +@vindex mm-text-html-renderer +If set to @code{gnus-article-html}, Gnus will use the built-in method, +that's based on @code{curl} and @code{w3m}. + +@item gnus-html-cache-directory +@vindex gnus-html-cache-directory +Gnus will download and cache images according to how +@code{mm-w3m-safe-url-regexp} is set. These images will be stored in +this directory. + +@item gnus-html-cache-size +@vindex gnus-html-cache-size +When @code{gnus-html-cache-size} bytes have been used in that +directory, the oldest files will be deleted. The default is 500MB. + +@item gnus-html-frame-width +@vindex gnus-html-frame-width +The width to use when rendering HTML. The default is 70. + +@end table + +To use this, make sure that you have @code{w3m} and @code{curl} +installed. If you have, then Gnus should display @acronym{HTML} +automatically. + + + @node Customizing Articles @section Customizing Articles @cindex article customization @@ -13559,6 +13623,9 @@ @kbd{D t} (@code{gnus-draft-toggle-sending}) command to mark the message as unsendable. This is a toggling command. +Finally, if you want to delete a draft, use the normal @kbd{B DEL} +command (@pxref{Mail Group Commands}). + @node Rejected Articles @section Rejected Articles diff -r d24d9e523bc4 -r d575ee440ad4 doc/misc/message.texi --- a/doc/misc/message.texi Mon Aug 30 06:09:18 2010 +0000 +++ b/doc/misc/message.texi Mon Aug 30 06:49:10 2010 +0000 @@ -1645,7 +1645,8 @@ @cindex split large message The limitation of messages sent as message/partial. The lower bound of message size in characters, beyond which the message should be sent -in several parts. If it is @code{nil}, the size is unlimited. +in several parts. If it is @code{nil} (which is the default), the +size is unlimited. @end table diff -r d24d9e523bc4 -r d575ee440ad4 lisp/gnus/ChangeLog --- a/lisp/gnus/ChangeLog Mon Aug 30 06:09:18 2010 +0000 +++ b/lisp/gnus/ChangeLog Mon Aug 30 06:49:10 2010 +0000 @@ -1,3 +1,75 @@ +2009-02-04 Andreas Schwab + + * gnus-score.el (gnus-score-string): Fix regex for matching extra + headers and regexp-quote the match if necessary. + +2009-03-24 Miles Bader + + * smiley.el (smiley-regexp-alist): Don't delete the semicolon before + the blinking smiley. + +2009-03-24 Simon Josefsson + + * smiley.el (smiley-regexp-alist): Disallow ;;) from being treated as a + blink smiley. + +2010-08-29 Lars Magne Ingebrigtsen + + * gnus-start.el (gnus-dribble-read-file): Ensure that the directory + where the dribbel file lives exists. + + * message.el (message-send-mail-partially-limit): Change the default to + nil, since most people don't want this. + + * mm-url.el (mm-url-decode-entities): Also decode entities like + ㈒. + +2009-07-16 Kevin Ryde (tiny change) + + * gnus-sum.el (gnus-summary-idna-message): + * nnrss.el (nnrss-normalize-date, nnrss-discover-feed): + Hyperlink urls in docstrings with URL `...'. + +2010-08-29 Adam Sjøgren + + * gnus-html.el (gnus-html-put-image): Use XEmacs-compatible image + functions. + +2010-08-29 Lars Magne Ingebrigtsen + + * gnus-art.el (gnus-article-add-button): Take an optional parameter to + say what the mouseover text should be. + + * gnus-html.el (gnus-html-prefetch-images): Use the summary-local + version of the mm-w3m-safe-url-regexp variable to only download images + in the groups where we want that to happen. + + * gnus-sum.el (gnus-summary-stop-at-end-of-message): New variable. + + * gnus-art.el (gnus-article-beginning-of-window): Make into defun for + easier debugging. + (gnus-article-beginning-of-window): Add kludge to allow spacing past + big pictures in the article buffer. + + * mm-decode.el (mm-text-html-renderer): Default the html renderer to + gnus-article-html. + (mm-text-html-renderer): gnus-article-html needs curl in addition to + w3m. + + * gnus-html.el: Start a new super-simple HTML renderer based on w3m. + +2010-08-28 Lars Magne Ingebrigtsen + + * gnus.el (gnus-valid-select-methods): Remove reference to nngoogle, + which doesn't exist. + + * message.el (message-inhibit-ecomplete): New variable to allow some + function to inhibit ecomplete address storage. + (message-resend): Disable ecomplete message storage when resending + messages. + + * nntp.el (nntp-async-kluge): Remove the Emacs 20.3-related kluge. + 2010-08-27 Katsumi Yamaoka * gnus-sum.el (gnus-summary-move-article, gnus-summary-delete-article): diff -r d24d9e523bc4 -r d575ee440ad4 lisp/gnus/gnus-art.el --- a/lisp/gnus/gnus-art.el Mon Aug 30 06:09:18 2010 +0000 +++ b/lisp/gnus/gnus-art.el Mon Aug 30 06:49:10 2010 +0000 @@ -6283,18 +6283,22 @@ (gnus-article-next-page-1 lines) nil)) -(defmacro gnus-article-beginning-of-window () +(defun gnus-article-beginning-of-window () "Move point to the beginning of the window. In Emacs, the point is placed at the line number which `scroll-margin' specifies." (if (featurep 'xemacs) - '(move-to-window-line 0) - '(move-to-window-line - (min (max 0 scroll-margin) - (max 1 (- (window-height) - (if mode-line-format 1 0) - (if header-line-format 1 0) - 2)))))) + (move-to-window-line 0) + ;; There is an obscure bug in Emacs that makes it impossible to + ;; scroll past big pictures in the article buffer. Try to fix + ;; this by adding a sanity check by counting the lines visible. + (when (> (count-lines (window-start) (window-end)) 30) + (move-to-window-line + (min (max 0 scroll-margin) + (max 1 (- (window-height) + (if mode-line-format 1 0) + (if header-line-format 1 0) + 2))))))) (defun gnus-article-next-page-1 (lines) (unless (featurep 'xemacs) @@ -7899,7 +7903,7 @@ ;;; External functions: -(defun gnus-article-add-button (from to fun &optional data) +(defun gnus-article-add-button (from to fun &optional data text) "Create a button between FROM and TO with callback FUN and data DATA." (when gnus-article-button-face (gnus-overlay-put (gnus-make-overlay from to nil t) @@ -7911,6 +7915,7 @@ (list 'gnus-callback fun) (and data (list 'gnus-data data)))) (widget-convert-button 'link from to :action 'gnus-widget-press-button + :help-echo (or text "Follow the link") :button-keymap gnus-widget-button-keymap)) ;;; Internal functions: diff -r d24d9e523bc4 -r d575ee440ad4 lisp/gnus/gnus-async.el --- a/lisp/gnus/gnus-async.el Mon Aug 30 06:09:18 2010 +0000 +++ b/lisp/gnus/gnus-async.el Mon Aug 30 06:49:10 2010 +0000 @@ -71,6 +71,13 @@ :group 'gnus-asynchronous :type 'function) +(defcustom gnus-async-post-fetch-function nil + "Function called after an article has been prefetched. +The function will be called narrowed to the region of the article +that was fetched." + :group 'gnus-asynchronous + :type 'function) + ;;; Internal variables. (defvar gnus-async-prefetch-article-buffer " *Async Prefetch Article*") @@ -227,6 +234,11 @@ (setq gnus-async-current-prefetch-article nil) (when arg (gnus-async-set-buffer) + (when gnus-async-post-fetch-function + (save-excursion + (save-restriction + (narrow-to-region mark (point-max)) + (funcall gnus-async-post-fetch-function summary)))) (gnus-async-with-semaphore (setq gnus-async-article-alist diff -r d24d9e523bc4 -r d575ee440ad4 lisp/gnus/gnus-html.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lisp/gnus/gnus-html.el Mon Aug 30 06:49:10 2010 +0000 @@ -0,0 +1,226 @@ +;;; gnus-html.el --- Quoted-Printable functions + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Lars Magne Ingebrigtsen +;; Keywords: html, web + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; The idea is to provide a simple, fast and pretty minimal way to +;; render HTML (including links and images) in a buffer, based on an +;; external HTML renderer (i.e., w3m). + +;;; Code: + +(defcustom gnus-html-cache-directory (nnheader-concat gnus-directory "html-cache/") + "Where Gnus will cache images it downloads from the web." + :group 'gnus-art + :type 'directory) + +(defcustom gnus-html-cache-size 500000000 + "The size of the Gnus image cache." + :group 'gnus-art + :type 'integer) + +(defcustom gnus-html-frame-width 70 + "What width to use when rendering HTML." + :group 'gnus-art + :type 'integer) + +;;;###autoload +(defun gnus-article-html (handle) + (let ((article-buffer (current-buffer))) + (save-restriction + (narrow-to-region (point) (point)) + (save-excursion + (mm-with-part handle + (let* ((coding-system-for-read 'utf-8) + (coding-system-for-write 'utf-8) + (default-process-coding-system + (cons coding-system-for-read coding-system-for-write))) + (call-process-region (point-min) (point-max) + "w3m" + nil article-buffer nil + "-halfdump" + "-no-cookie" + "-O" "UTF-8" + "-o" "ext_halfdump=1" + "-t" (format "%s" tab-width) + "-cols" (format "%s" gnus-html-frame-width) + "-o" "display_image=off" + "-T" "text/html")))) + (gnus-html-wash-tags)))) + +(defun gnus-html-wash-tags () + (let (tag parameters string start end images) + (mm-url-decode-entities) + (goto-char (point-min)) + (while (re-search-forward "<\\([^ />]+\\)\\([^>]*\\)>" nil t) + (setq tag (match-string 1) + parameters (match-string 2) + start (match-beginning 0)) + (when (plusp (length parameters)) + (set-text-properties 0 (1- (length parameters)) nil parameters)) + (delete-region start (point)) + (when (search-forward (concat "") nil t) + (delete-region (match-beginning 0) (match-end 0))) + (setq end (point)) + (cond + ;; Fetch and insert a picture. + ((equal tag "img_alt") + (when (string-match "src=\"\\([^\"]+\\)" parameters) + (setq parameters (match-string 1 parameters)) + (when (or (null mm-w3m-safe-url-regexp) + (string-match mm-w3m-safe-url-regexp parameters)) + (let ((file (gnus-html-image-id parameters))) + (if (file-exists-p file) + ;; It's already cached, so just insert it. + (when (gnus-html-put-image file (point)) + ;; Delete the ALT text. + (delete-region start end)) + ;; We don't have it, so schedule it for fetching + ;; asynchronously. + (push (list parameters + (set-marker (make-marker) start) + (point-marker)) + images)))))) + ;; Add a link. + ((equal tag "a") + (when (string-match "href=\"\\([^\"]+\\)" parameters) + (setq parameters (match-string 1 parameters)) + (gnus-article-add-button start end + 'browse-url parameters + parameters) + (let ((overlay (gnus-make-overlay start end))) + (gnus-overlay-put overlay 'evaporate t) + (gnus-overlay-put overlay 'gnus-button-url parameters) + (when gnus-article-mouse-face + (gnus-overlay-put overlay 'mouse-face gnus-article-mouse-face))))) + ;; Whatever. Just ignore the tag. + (t + )) + (goto-char start)) + (goto-char (point-min)) + ;; The output from -halfdump isn't totally regular, so strip + ;; off any s that were left over. + (while (re-search-forward "" nil t) + (replace-match "" t t)) + (when images + (gnus-html-schedule-image-fetching (current-buffer) (nreverse images))))) + +(defun gnus-html-schedule-image-fetching (buffer images) + (let* ((url (caar images)) + (process (start-process + "images" nil "curl" + "-s" "--create-dirs" + "--location" + "--max-time" "60" + "-o" (gnus-html-image-id url) + url))) + (process-kill-without-query process) + (set-process-sentinel process 'gnus-html-curl-sentinel) + (set-process-plist process (list 'images images + 'buffer buffer)))) + +(defun gnus-html-image-id (url) + (expand-file-name (sha1 url) gnus-html-cache-directory)) + +(defun gnus-html-curl-sentinel (process event) + (when (string-match "finished" event) + (let* ((images (getf (process-plist process) 'images)) + (buffer (getf (process-plist process) 'buffer)) + (spec (pop images)) + (file (gnus-html-image-id (car spec)))) + (when (and (buffer-live-p buffer) + ;; If the position of the marker is 1, then that + ;; means that the text is was in has been deleted; + ;; i.e., that the user has selected a different + ;; article before the image arrived. + (not (= (marker-position (cadr spec)) 1))) + (save-excursion + (set-buffer buffer) + (let ((buffer-read-only nil)) + (when (gnus-html-put-image file (cadr spec)) + (delete-region (cadr spec) (caddr spec)))))) + (when images + (gnus-html-schedule-image-fetching buffer images))))) + +(defun gnus-html-put-image (file point) + (let ((image (ignore-errors + (create-image file)))) + (if (and image + ;; Kludge to avoid displaying 30x30 gif images, which + ;; seems to be a signal of a broken image. + (not (and (eq (getf (cdr image) :type) 'gif) + (= (car (image-size image t)) 30) + (= (cdr (image-size image t)) 30)))) + (progn + (put-image image point) + t) + (when (fboundp 'find-image) + (put-image (find-image '((:type xpm :file "lock-broken.xpm"))) + point)) + nil))) + +(defun gnus-html-prune-cache () + (let ((total-size 0) + files) + (dolist (file (directory-files gnus-html-cache-directory t nil t)) + (let ((attributes (file-attributes file))) + (unless (nth 0 attributes) + (incf total-size (nth 7 attributes)) + (push (list (time-to-seconds (nth 5 attributes)) + (nth 7 attributes) file) + files)))) + (when (> total-size gnus-html-cache-size) + (setq files (sort files (lambda (f1 f2) + (< (car f1) (car f2))))) + (dolist (file files) + (when (> total-size gnus-html-cache-size) + (decf total-size (cadr file)) + (delete-file (nth 2 file))))))) + +;;;###autoload +(defun gnus-html-prefetch-images (summary) + (let (safe-url-regexp urls) + (when (buffer-live-p summary) + (save-excursion + (set-buffer summary) + (setq safe-url-regexp mm-w3m-safe-url-regexp)) + (save-match-data + (while (re-search-forward ", and also the RFC822 style +URL `http://www.w3.org/TR/NOTE-datetime', and also the RFC822 style which RSS 2.0 allows." (let (case-fold-search vector year month day time zone cts given) (cond ((null date)) ; do nothing for this case @@ -1012,7 +1012,7 @@ (defun nnrss-discover-feed (url) "Given a page, find an RSS feed using Mark Pilgrim's -`ultra-liberal rss locator' (http://diveintomark.org/2002/08/15.html)." +`ultra-liberal rss locator' (URL `http://diveintomark.org/2002/08/15.html')." (let ((parsed-page (nnrss-fetch url))) diff -r d24d9e523bc4 -r d575ee440ad4 lisp/gnus/nntp.el --- a/lisp/gnus/nntp.el Mon Aug 30 06:09:18 2010 +0000 +++ b/lisp/gnus/nntp.el Mon Aug 30 06:49:10 2010 +0000 @@ -298,13 +298,6 @@ (defvoo nntp-server-xover 'try) (defvoo nntp-server-list-active-group 'try) -(defvar nntp-async-needs-kluge - (string-match "^GNU Emacs 20\\.3\\." (emacs-version)) - "*When non-nil, nntp will poll asynchronous connections -once a second. By default, this is turned on only for Emacs -20.3, which has a bug that breaks nntp's normal method of -noticing asynchronous data.") - (defvar nntp-async-timer nil) (defvar nntp-async-process-list nil) @@ -1368,17 +1361,7 @@ nntp-process-decode decode nntp-process-callback callback nntp-process-start-point (point-max)) - (setq after-change-functions '(nntp-after-change-function)) - (if nntp-async-needs-kluge - (nntp-async-kluge process)))) - -(defun nntp-async-kluge (process) - ;; emacs 20.3 bug: process output with encoding 'binary - ;; doesn't trigger after-change-functions. - (unless nntp-async-timer - (setq nntp-async-timer - (run-at-time 1 1 'nntp-async-timer-handler))) - (add-to-list 'nntp-async-process-list process)) + (setq after-change-functions '(nntp-after-change-function)))) (defun nntp-async-timer-handler () (mapcar diff -r d24d9e523bc4 -r d575ee440ad4 lisp/gnus/smiley.el --- a/lisp/gnus/smiley.el Mon Aug 30 06:09:18 2010 +0000 +++ b/lisp/gnus/smiley.el Mon Aug 30 06:49:10 2010 +0000 @@ -102,7 +102,8 @@ ;; The XEmacs version has a baroque, if not rococo, set of these. (defcustom smiley-regexp-alist - '(("\\(;-?)\\)\\W" 1 "blink") + '(("\\(;-)\\)\\W" 1 "blink") + ("[^;]\\(;)\\)\\W" 1 "blink") ("\\(:-]\\)\\W" 1 "forced") ("\\(8-)\\)\\W" 1 "braindamaged") ("\\(:-|\\)\\W" 1 "indifferent")