From ae97e6451dc1d2b7454e39953f202a63ed54a2ae Mon Sep 17 00:00:00 2001 From: Gnus developers Date: Tue, 19 Jul 2011 22:19:06 +0000 Subject: [PATCH] Merge changes made in Gnus trunk. gnus-group.el (gnus-group-read-ephemeral-group): Make sure we don't enter invalid buffer configurations into the quit form (bug#9107). (gnus-group-tool-bar-gnome): Replace connect/disconnect with unplugged/plugged. gnus-sum.el (gnus-summary-refer-thread): When inserting new headers, keep track of which ones are unread (bug#9061). gnus.el (gnus-refer-article-method): Allow entering any sexp (bug#9055). gnus-art.el (gnus-article-show-images): Allow working if using w3m (bug#9041). gnus-html.el (mm-util): Require (bug#9073). gnus-sum.el (gnus-delete-duplicate-headers): New function. (gnus-summary-refer-thread): Use it to remove duplicates in the un-threaded view (bug#9053). (gnus-summary-insert-subject): Document USE-OLD-HEADER (bug#9070). nnir.el (nnir-read-server-parm): Use default value from global variable. Without this the default search engine parameters aren't used at all. message.el (message-unique-id): Don't use the undocumented return value from (random t) (bug#9118). --- lisp/gnus/ChangeLog | 34 ++++++++++++++++++++ lisp/gnus/gnus-art.el | 15 ++++++--- lisp/gnus/gnus-group.el | 13 +++++--- lisp/gnus/gnus-html.el | 1 + lisp/gnus/gnus-sum.el | 71 ++++++++++++++++++++++++++++------------- lisp/gnus/gnus.el | 1 + lisp/gnus/message.el | 8 +++-- lisp/gnus/nnir.el | 1 + 8 files changed, 109 insertions(+), 35 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 32f5b702c6f..d18be47fb9d 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,37 @@ +2011-07-19 Lars Magne Ingebrigtsen + + * gnus-group.el (gnus-group-read-ephemeral-group): Make sure we don't + enter invalid buffer configurations into the quit form (bug#9107). + (gnus-group-tool-bar-gnome): Replace connect/disconnect with + unplugged/plugged. + + * gnus-sum.el (gnus-summary-refer-thread): When inserting new headers, + keep track of which ones are unread (bug#9061). + + * gnus.el (gnus-refer-article-method): Allow entering any sexp + (bug#9055). + + * gnus-art.el (gnus-article-show-images): Allow working if using w3m + (bug#9041). + + * gnus-html.el (mm-util): Require (bug#9073). + + * gnus-sum.el (gnus-delete-duplicate-headers): New function. + (gnus-summary-refer-thread): Use it to remove duplicates in the + un-threaded view (bug#9053). + (gnus-summary-insert-subject): Document USE-OLD-HEADER (bug#9070). + +2011-07-07 Kan-Ru Chen + + * nnir.el (nnir-read-server-parm): Use default value from global + variable. Without this the default search engine parameters aren't + used at all. + +2011-07-19 Lars Magne Ingebrigtsen + + * message.el (message-unique-id): Don't use the undocumented return + value from (random t) (bug#9118). + 2011-07-16 Lars Magne Ingebrigtsen * message.el (message-auto-save-directory): If the ~/Mail directory diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 7255be416eb..c29000f4691 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -2267,6 +2267,8 @@ unfolded." (dolist (elem gnus-article-image-alist) (gnus-delete-images (car elem)))))) +(autoload 'w3m-toggle-inline-images "w3m") + (defun gnus-article-show-images () "Show any images that are in the HTML-rendered article buffer. This only works if the article in question is HTML." @@ -2274,11 +2276,14 @@ This only works if the article in question is HTML." (gnus-with-article-buffer (save-restriction (widen) - (dolist (region (gnus-find-text-property-region (point-min) (point-max) - 'image-displayer)) - (destructuring-bind (start end function) region - (funcall function (get-text-property start 'image-url) - start end)))))) + (if (eq mm-text-html-renderer 'w3m) + (let ((mm-inline-text-html-with-images nil)) + (w3m-toggle-inline-images)) + (dolist (region (gnus-find-text-property-region (point-min) (point-max) + 'image-displayer)) + (destructuring-bind (start end function) region + (funcall function (get-text-property start 'image-url) + start end))))))) (defun gnus-article-treat-fold-newsgroups () "Unfold folded message headers. diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index b4dca3e1fc4..2a31ccd34f0 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -1008,10 +1008,10 @@ Pre-defined symbols include `gnus-group-tool-bar-gnome' and '((gnus-group-post-news "mail/compose") ;; Some useful agent icons? I don't use the agent so agent users should ;; suggest useful commands: - (gnus-agent-toggle-plugged "disconnect" t + (gnus-agent-toggle-plugged "unplugged" t :help "Gnus is currently unplugged. Click to work online." :visible (and gnus-agent (not gnus-plugged))) - (gnus-agent-toggle-plugged "connect" t + (gnus-agent-toggle-plugged "plugged" t :help "Gnus is currently plugged. Click to work offline." :visible (and gnus-agent gnus-plugged)) ;; FIXME: gnus-agent-toggle-plugged (in gnus-agent-group-make-menu-bar) @@ -2298,11 +2298,14 @@ Return the name of the group if selection was successful." `(-1 nil (,group ,gnus-level-default-subscribed nil nil ,method ,(cons - (if quit-config - (cons 'quit-config quit-config) + (cond + (quit-config + (cons 'quit-config quit-config)) + ((assq gnus-current-window-configuration + gnus-buffer-configuration) (cons 'quit-config (cons gnus-summary-buffer - gnus-current-window-configuration))) + gnus-current-window-configuration)))) parameters))) gnus-newsrc-hashtb) (push method gnus-ephemeral-servers) diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el index 6ca3c8b7945..d3da6aab1b7 100644 --- a/lisp/gnus/gnus-html.el +++ b/lisp/gnus/gnus-html.el @@ -38,6 +38,7 @@ (require 'url-cache) (require 'xml) (require 'browse-url) +(require 'mm-util) (eval-and-compile (unless (featurep 'xemacs) (require 'help-fns))) (defcustom gnus-html-image-cache-ttl (days-to-time 7) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 5a817e12104..86ff0180f55 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -6562,7 +6562,10 @@ This is meant to be called in `gnus-article-internal-prepare-hook'." (defun gnus-summary-insert-subject (id &optional old-header use-old-header) "Find article ID and insert the summary line for that article. OLD-HEADER can either be a header or a line number to insert -the subject line on." +the subject line on. +If USE-OLD-HEADER is non-nil, then OLD-HEADER should be a header, +and OLD-HEADER will be used when the summary line is inserted, +too, instead of trying to fetch new headers." (let* ((line (and (numberp old-header) old-header)) (old-header (and (vectorp old-header) old-header)) (header (cond ((and old-header use-old-header) @@ -8950,6 +8953,21 @@ Return the number of articles fetched." (gnus-summary-position-point) n))) +(defun gnus-delete-duplicate-headers (headers) + ;; First remove leading duplicates. + (while (and (> (length headers) 1) + (= (mail-header-number (car headers)) + (mail-header-number (cadr headers)))) + (pop headers)) + ;; Then the rest. + (let ((result headers)) + (while (> (length headers) 1) + (if (= (mail-header-number (car headers)) + (mail-header-number (cadr headers))) + (setcdr headers (cddr headers)) + (pop headers))) + result)) + (defun gnus-summary-refer-thread (&optional limit) "Fetch all articles in the current thread. If no backend-specific 'request-thread function is available @@ -8964,29 +8982,36 @@ variable." (gnus-summary-ignore-duplicates t) (gnus-read-all-available-headers t) (limit (if limit (prefix-numeric-value limit) - gnus-refer-thread-limit))) + gnus-refer-thread-limit)) + (new-headers + (if (gnus-check-backend-function + 'request-thread gnus-newsgroup-name) + (gnus-request-thread header gnus-newsgroup-name) + (let* ((last (if (numberp limit) + (min (+ (mail-header-number header) + limit) + gnus-newsgroup-highest) + gnus-newsgroup-highest)) + (subject (gnus-simplify-subject + (mail-header-subject header))) + (refs (split-string (or (mail-header-references header) + ""))) + (gnus-parse-headers-hook + (lambda () (goto-char (point-min)) + (keep-lines + (regexp-opt (append refs (list id subject))))))) + (gnus-fetch-headers (list last) (if (numberp limit) + (* 2 limit) limit) t))))) + (dolist (header new-headers) + (when (member (mail-header-number header) gnus-newsgroup-unselected) + (push (mail-header-number header) gnus-newsgroup-unreads) + (setq gnus-newsgroup-unselected + (delete (mail-header-number header) gnus-newsgroup-unselected)))) (setq gnus-newsgroup-headers - (gnus-merge - 'list gnus-newsgroup-headers - (if (gnus-check-backend-function - 'request-thread gnus-newsgroup-name) - (gnus-request-thread header gnus-newsgroup-name) - (let* ((last (if (numberp limit) - (min (+ (mail-header-number header) - limit) - gnus-newsgroup-highest) - gnus-newsgroup-highest)) - (subject (gnus-simplify-subject - (mail-header-subject header))) - (refs (split-string (or (mail-header-references header) - ""))) - (gnus-parse-headers-hook - (lambda () (goto-char (point-min)) - (keep-lines - (regexp-opt (append refs (list id subject))))))) - (gnus-fetch-headers (list last) (if (numberp limit) - (* 2 limit) limit) t))) - 'gnus-article-sort-by-number)) + (gnus-delete-duplicate-headers + (gnus-merge + 'list gnus-newsgroup-headers new-headers + 'gnus-article-sort-by-number))) (gnus-summary-limit-include-thread id))) (defun gnus-summary-refer-article (message-id) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index b66d5f22474..7ff90f583cf 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -1435,6 +1435,7 @@ list, Gnus will try all the methods in the list until it finds a match." (const current) (const :tag "Google" (nnweb "refer" (nnweb-type google))) gnus-select-method + sexp (repeat :menu-tag "Try multiple" :tag "Multiple" :value (current (nnweb "refer" (nnweb-type google))) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index ff013e5b291..47c4de0aedc 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4785,7 +4785,9 @@ Do not use this for anything important, it is cryptographically weak." (require 'sha1) (let (sha1-maximum-internal-length) (sha1 (concat (message-unique-id) - (format "%x%x%x" (random) (random t) (random)) + (format "%x%x%x" (random) + (progn (random t) (random)) + (random)) (prin1-to-string (recent-keys)) (prin1-to-string (garbage-collect)))))) @@ -5488,10 +5490,12 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'." ;; You might for example insert a "." somewhere (not next to another dot ;; or string boundary), or modify the "fsf" string. (defun message-unique-id () + (random t) ;; Don't use microseconds from (current-time), they may be unsupported. ;; Instead we use this randomly inited counter. (setq message-unique-id-char - (% (1+ (or message-unique-id-char (logand (random t) (1- (lsh 1 20))))) + (% (1+ (or message-unique-id-char + (logand (random most-positive-fixnum) (1- (lsh 1 20))))) ;; (current-time) returns 16-bit ints, ;; and 2^16*25 just fits into 4 digits i base 36. (* 25 25))) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 8099cc2a7cc..3f140ef59d9 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -1640,6 +1640,7 @@ server is of form 'backend:name'." (let ((method (gnus-server-to-method server))) (cond ((and method (assq key (cddr method))) (nth 1 (assq key (cddr method)))) + ((boundp key) (symbol-value key)) (t nil)))) (defun nnir-possibly-change-server (server) -- 2.39.2