From 70041e9ae7072eac5eeff2b5e1a50d9eab6b39f7 Mon Sep 17 00:00:00 2001 From: Gnus developers Date: Fri, 17 Dec 2010 22:45:16 +0000 Subject: [PATCH] Merge changes made in Gnus trunk. nnir.el (nnir-get-active): Ignore nnir-ignored-newsgroups if null. gnus-sum.el (gnus-summary-refer-thread): Simplify code. Restore gnus-use-agent. (gnus-get-newsgroup-headers): Avoid unwanted spaces at eol. gravatar.el (gravatar-retrieve-synchronously): New function. (gravatar-get-data): Make more robust. gnus-util.el (gnus-rescale-image): Allow to resize images even if they are from file. Can also scale up. nnimap.el (nnimap-retrieve-headers): Remove CRLF from the headers. nnir.el (nnir-mode): Make sure 'gnus-registry-install is bound. gnus-sum.el (gnus-get-newsgroup-headers): Revert the last change here, since it's up to the backends to do CRLF removal if their protocol has it. gnus-group.el (gnus-group-delete-articles): New command. --- lisp/gnus/ChangeLog | 34 ++++++++++++++++++++++++++++++++++ lisp/gnus/gnus-gravatar.el | 2 +- lisp/gnus/gnus-group.el | 9 +++++++++ lisp/gnus/gnus-sum.el | 25 +++++++++++-------------- lisp/gnus/gnus-util.el | 21 ++++++++------------- lisp/gnus/gravatar.el | 28 +++++++++++++++++++++++----- lisp/gnus/nnimap.el | 5 +++-- lisp/gnus/nnir.el | 6 ++++-- 8 files changed, 93 insertions(+), 37 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index b725a688fe6..c79a6d7f219 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,37 @@ +2010-12-17 Lars Magne Ingebrigtsen + + * gnus-group.el (gnus-group-delete-articles): New command. + +2010-12-17 Andrew Cohen + + * nnir.el (nnir-mode): Make sure 'gnus-registry-install is bound. + +2010-12-17 Lars Magne Ingebrigtsen + + * gnus-sum.el (gnus-get-newsgroup-headers): Revert the last change + here, since it's up to the backends to do CRLF removal if their + protocol has it. + + * nnimap.el (nnimap-retrieve-headers): Remove CRLF from the headers. + +2010-12-17 Julien Danjou + + * gnus-util.el (gnus-rescale-image): Allow to resize images even if + they are from file. Can also scale up. + +2010-12-17 Andrew Cohen + + * gnus-sum.el (gnus-summary-refer-thread): Simplify code. Restore + gnus-use-agent. + (gnus-get-newsgroup-headers): Avoid unwanted spaces at eol. + + * nnir.el (nnir-get-active): Ignore nnir-ignored-newsgroups if null. + +2010-12-17 Julien Danjou + + * gravatar.el (gravatar-retrieve-synchronously): New function. + (gravatar-get-data): Make more robust. + 2010-12-16 Lars Magne Ingebrigtsen * nnimap.el (nnimap-wait-for-response): Fix the end-point calculation diff --git a/lisp/gnus/gnus-gravatar.el b/lisp/gnus/gnus-gravatar.el index 1bd64e9533f..2b1143b3b7b 100644 --- a/lisp/gnus/gnus-gravatar.el +++ b/lisp/gnus/gnus-gravatar.el @@ -56,7 +56,7 @@ If nil, default to `gravatar-size'." (let* ((mail-extr-disable-voodoo t) (addresses (mail-extract-address-components (or (mail-fetch-field header) "") t)) - (gravatar-size gnus-gravatar-size) + (gravatar-size (or gnus-gravatar-size gravatar-size)) name) (dolist (address addresses) (when (and (setq name (car address)) diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 73eeb7104ca..9ce4f86f3ab 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -2734,6 +2734,15 @@ server." (lambda (group) (gnus-group-delete-group group nil t)))))) +(defun gnus-group-delete-articles (group) + "Delete all articles in the current group." + (interactive (list (gnus-group-group-name))) + (let ((articles (gnus-uncompress-range (gnus-active group)))) + (when (gnus-yes-or-no-p + (format "Do you really want to delete these %d articles forever? " + (length articles))) + (gnus-request-expire-articles articles group 'force)))) + (defun gnus-group-delete-group (group &optional force no-prompt) "Delete the current group. Only meaningful with editable groups. If FORCE (the prefix) is non-nil, all the articles in the group will diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index ceaa014363a..1966e4af6c9 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -8868,30 +8868,27 @@ fetch what's specified by the `gnus-refer-thread-limit' variable." (interactive "P") (gnus-warp-to-article) - (let ((id (mail-header-id (gnus-summary-article-header))) - (gnus-inhibit-demon t) - (gnus-agent nil) - (gnus-summary-ignore-duplicates t) - (gnus-read-all-available-headers t) - (limit (if limit (prefix-numeric-value limit) - gnus-refer-thread-limit))) + (let* ((header (gnus-summary-article-header)) + (id (mail-header-id header)) + (gnus-inhibit-demon t) + (gnus-summary-ignore-duplicates t) + (gnus-read-all-available-headers t) + (limit (if limit (prefix-numeric-value limit) + gnus-refer-thread-limit))) (setq gnus-newsgroup-headers (gnus-merge 'list gnus-newsgroup-headers (if (gnus-check-backend-function 'request-thread gnus-newsgroup-name) - (gnus-request-thread (gnus-summary-article-header)) + (gnus-request-thread header) (let* ((last (if (numberp limit) - (min (+ (mail-header-number - (gnus-summary-article-header)) + (min (+ (mail-header-number header) limit) gnus-newsgroup-highest) gnus-newsgroup-highest)) (subject (gnus-simplify-subject - (mail-header-subject - (gnus-summary-article-header)))) - (refs (split-string (or (mail-header-references - (gnus-summary-article-header)) + (mail-header-subject header))) + (refs (split-string (or (mail-header-references header) ""))) (gnus-parse-headers-hook (lambda () (goto-char (point-min)) diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index fa4bf076a30..50292f4ff76 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -1983,21 +1983,16 @@ empty directories from OLD-PATH." "Rescale IMAGE to SIZE if possible. SIZE is in format (WIDTH . HEIGHT). Return a new image. Sizes are in pixels." - (if (or (not (fboundp 'imagemagick-types)) - (not (get-buffer-window (current-buffer)))) - image + (when (fboundp 'imagemagick-types) (let ((new-width (car size)) (new-height (cdr size))) - (when (> (cdr (image-size image t)) new-height) - (setq image (or (create-image (plist-get (cdr image) :data) 'imagemagick t - :height new-height) - image))) - (when (> (car (image-size image t)) new-width) - (setq image (or - (create-image (plist-get (cdr image) :data) 'imagemagick t - :width new-width) - image))) - image))) + (unless (= (cdr (image-size image t)) new-height) + (setcdr image (plist-put (cdr image) :type 'imagemagick)) + (setcdr image (plist-put (cdr image) :height new-height))) + (unless (= (car (image-size image t)) new-width) + (setcdr image (plist-put (cdr image) :type 'imagemagick)) + (setcdr image (plist-put (cdr image) :width new-width))))) + image) (defun gnus-list-memq-of-list (elements list) "Return non-nil if any of the members of ELEMENTS are in LIST." diff --git a/lisp/gnus/gravatar.el b/lisp/gnus/gravatar.el index 50b0ba1d636..c17bd201d2b 100644 --- a/lisp/gnus/gravatar.el +++ b/lisp/gnus/gravatar.el @@ -78,10 +78,11 @@ (defun gravatar-get-data () "Get data from current buffer." - (when (string-match "^HTTP/.+ 200 OK$" - (buffer-substring (point-min) (line-end-position))) - (when (search-forward "\n\n" nil t) - (buffer-substring (point) (point-max))))) + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^HTTP/.+ 200 OK$" nil (line-end-position)) + (when (search-forward "\n\n" nil t) + (buffer-substring (point) (point-max)))))) (eval-and-compile (cond ((featurep 'xemacs) @@ -98,7 +99,7 @@ If no image available, return 'error." (let ((data (gravatar-get-data))) (if data - (gravatar-create-image data nil t) + (gravatar-create-image data nil t) 'error))) ;;;###autoload @@ -117,6 +118,23 @@ You can provide a list of argument to pass to CB in CBARGS." (gravatar-data->image)) cbargs)))) +;;;###autoload +(defun gravatar-retrieve-synchronously (mail-address) + "Retrieve MAIL-ADDRESS gravatar and returns it." + (let ((url (gravatar-build-url mail-address))) + (if (gravatar-cache-expired url) + (with-current-buffer (url-retrieve-synchronously url) + (when gravatar-automatic-caching + (url-store-in-cache (current-buffer))) + (let ((data (gravatar-data->image))) + (kill-buffer (current-buffer)) + data)) + (with-temp-buffer + (mm-disable-multibyte) + (url-cache-extract (url-cache-create-filename url)) + (gravatar-data->image))))) + + (defun gravatar-retrieved (status cb &optional cbargs) "Callback function used by `gravatar-retrieve'." ;; Store gravatar? diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 34e57b6dc19..acbb091b356 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -167,7 +167,8 @@ textual parts.") (nnimap-article-ranges (gnus-compress-sequence articles)) (nnimap-header-parameters)) t) - (nnimap-transform-headers)) + (nnimap-transform-headers) + (nnheader-remove-cr-followed-by-lf)) (insert-buffer-substring (nnimap-find-process-buffer (current-buffer)))) 'headers)) @@ -1568,7 +1569,7 @@ textual parts.") (min (- (point) 500) (save-excursion - (forward-line -1) + (forward-line -3) (point)))) (point-min)) t))) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index f2348bf40ad..87377e6c6a9 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -1543,7 +1543,8 @@ server is of form 'backend:name'." (let ((cur (current-buffer)) name) (goto-char (point-min)) - (unless (string= nnir-ignored-newsgroups "") + (unless (or (null nnir-ignored-newsgroups) + (string= nnir-ignored-newsgroups "")) (delete-matching-lines nnir-ignored-newsgroups)) (if (eq (car method) 'nntp) (while (not (eobp)) @@ -1589,7 +1590,8 @@ server is of form 'backend:name'." (when (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir) (setq gnus-summary-line-format (or nnir-summary-line-format gnus-summary-line-format)) - (when (eq gnus-registry-install t) + (when (and (boundp 'gnus-registry-install) + (eq gnus-registry-install t)) (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action t) (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action t) (remove-hook 'gnus-summary-article-expire-hook 'gnus-registry-action t) -- 2.39.5