changeset 110999:9330a5183ae6

Merge changes made in Gnus trunk. shr.el: Fix defcustom type (char -> character). nnimap.el (nnimap-open-connection): Remove %s from openssl incantation, which is no longer valid. gnus-sum.el (gnus-summary-refer-thread): Implement a version that uses *-request-thread. gnus-int.el (gnus-request-thread): New back end function. nnimap.el (nnimap-request-thread): New back end function. shr.el: Indent. gnus-art.el, shr.el: Have shr switch buffer truncation on if there are big tables. (nnimap-open-connection): Message when opening connection for debugging purposes.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Thu, 14 Oct 2010 22:39:54 +0000
parents a5b0f6d4e94a
children f4924d5f36ac
files lisp/gnus/ChangeLog lisp/gnus/gnus-art.el lisp/gnus/gnus-int.el lisp/gnus/gnus-sum.el lisp/gnus/nnimap.el lisp/gnus/shr.el
diffstat 6 files changed, 103 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Thu Oct 14 23:35:03 2010 +0200
+++ b/lisp/gnus/ChangeLog	Thu Oct 14 22:39:54 2010 +0000
@@ -1,3 +1,29 @@
+2010-10-14  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* nnimap.el (nnimap-open-connection): Message when opening connection
+	for debugging purposes.
+
+	* gnus-art.el (gnus-article-setup-buffer): Set article mode truncation
+	on every setup buffer call to allow this to change from article to
+	article.
+
+	* shr.el (shr-tag-table): Experimental feature: Truncate lines in
+	buffers where we have a wide table.
+
+2010-10-14  Andrew Cohen  <cohen@andy.bu.edu>
+
+	* gnus-sum.el (gnus-summary-refer-thread): Implement a version that
+	uses *-request-thread.
+
+2010-10-14  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* nnimap.el (nnimap-open-connection): Remove %s from openssl
+	incantation, which is no longer valid.
+
+2010-10-14  Julien Danjou  <julien@danjou.info>
+
+	* shr.el: Fix defcustom type (char -> character).
+
 2010-10-14  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* nnimap.el (nnimap-open-connection): tls-program should be a list of
--- a/lisp/gnus/gnus-art.el	Thu Oct 14 23:35:03 2010 +0200
+++ b/lisp/gnus/gnus-art.el	Thu Oct 14 22:39:54 2010 +0000
@@ -4474,7 +4474,6 @@
   ;; face.
   (set (make-local-variable 'nobreak-char-display) nil)
   (setq cursor-in-non-selected-windows nil)
-  (setq truncate-lines gnus-article-truncate-lines)
   (gnus-set-default-directory)
   (buffer-disable-undo)
   (setq buffer-read-only t
@@ -4534,9 +4533,11 @@
 	  (setq gnus-button-marker-list nil)
 	  (unless (eq major-mode 'gnus-article-mode)
 	    (gnus-article-mode))
+	  (setq truncate-lines gnus-article-truncate-lines)
 	  (current-buffer))
       (with-current-buffer (gnus-get-buffer-create name)
 	(gnus-article-mode)
+	(setq truncate-lines gnus-article-truncate-lines)
 	(make-local-variable 'gnus-summary-buffer)
 	(setq gnus-summary-buffer
 	      (gnus-summary-buffer-name gnus-newsgroup-name))
--- a/lisp/gnus/gnus-int.el	Thu Oct 14 23:35:03 2010 +0200
+++ b/lisp/gnus/gnus-int.el	Thu Oct 14 22:39:54 2010 +0000
@@ -504,6 +504,12 @@
 	     article (gnus-group-real-name group)
 	     (nth 1 gnus-command-method) buffer)))
 
+(defun gnus-request-thread (id)
+  "Request the thread containing the article specified by Message-ID id."
+  (let ((gnus-command-method (gnus-find-method-for-group gnus-newsgroup-name)))
+    (funcall (gnus-get-function gnus-command-method 'request-thread)
+	     id)))
+
 (defun gnus-request-head (article group)
   "Request the head of ARTICLE in GROUP."
   (let* ((gnus-command-method (gnus-find-method-for-group group))
--- a/lisp/gnus/gnus-sum.el	Thu Oct 14 23:35:03 2010 +0200
+++ b/lisp/gnus/gnus-sum.el	Thu Oct 14 22:39:54 2010 +0000
@@ -8824,31 +8824,35 @@
 
 (defun gnus-summary-refer-thread (&optional limit)
   "Fetch all articles in the current thread.
-If LIMIT (the numerical prefix), fetch that many old headers instead
-of what's specified by the `gnus-refer-thread-limit' variable."
+If no backend-specific 'request-thread function is available
+fetch LIMIT (the numerical prefix) old headers. If LIMIT is nil
+fetch what's specified by the `gnus-refer-thread-limit'
+variable."
   (interactive "P")
   (let ((id (mail-header-id (gnus-summary-article-header)))
 	(limit (if limit (prefix-numeric-value limit)
 		 gnus-refer-thread-limit)))
-    (unless (eq gnus-fetch-old-headers 'invisible)
-      (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
-      ;; Retrieve the headers and read them in.
-      (if (eq (if (numberp limit)
-		  (gnus-retrieve-headers
-		   (list (min
-			  (+ (mail-header-number
-			      (gnus-summary-article-header))
-			     limit)
-			  gnus-newsgroup-end))
-		   gnus-newsgroup-name (* limit 2))
-		;; gnus-refer-thread-limit is t, i.e. fetch _all_
-		;; headers.
-		(gnus-retrieve-headers (list gnus-newsgroup-end)
-				       gnus-newsgroup-name limit))
-	      'nov)
-	  (gnus-build-all-threads)
-	(error "Can't fetch thread from back ends that don't support NOV"))
-      (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
+    (if  (gnus-check-backend-function 'request-thread gnus-newsgroup-name)
+	(gnus-request-thread id)
+      (unless (eq gnus-fetch-old-headers 'invisible)
+	(gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
+	;;	Retrieve the headers and read them in.
+	(if (numberp limit)
+	    (gnus-retrieve-headers
+	     (list (min
+		    (+ (mail-header-number
+			(gnus-summary-article-header))
+		       limit)
+		    gnus-newsgroup-end))
+	     gnus-newsgroup-name (* limit 2))
+	  ;; gnus-refer-thread-limit is t, i.e. fetch _all_
+	  ;; headers.
+	  (gnus-retrieve-headers (list gnus-newsgroup-end)
+				 gnus-newsgroup-name limit)
+	  (gnus-message 5 "Fetching headers for %s...done"
+			gnus-newsgroup-name))))
+    (when (eq gnus-headers-retrieved-by 'nov)
+      (gnus-build-all-threads))
     (gnus-summary-limit-include-thread id)))
 
 (defun gnus-summary-refer-article (message-id)
--- a/lisp/gnus/nnimap.el	Thu Oct 14 23:35:03 2010 +0200
+++ b/lisp/gnus/nnimap.el	Thu Oct 14 22:39:54 2010 +0000
@@ -304,6 +304,7 @@
 	       ((or (eq nnimap-stream 'network)
 		    (and (eq nnimap-stream 'starttls)
 			 (fboundp 'open-gnutls-stream)))
+		(message "Opening connection to %s..." nnimap-address)
 		(open-network-stream
 		 "*nnimap*" (current-buffer) nnimap-address
 		 (setq port
@@ -313,18 +314,22 @@
 			     "143"))))
 		'("143" "imap"))
 	       ((eq nnimap-stream 'shell)
+		(message "Opening connection to %s via shell..." nnimap-address)
 		(nnimap-open-shell-stream
 		 "*nnimap*" (current-buffer) nnimap-address
 		 (setq port (or nnimap-server-port "imap")))
 		'("imap"))
 	       ((eq nnimap-stream 'starttls)
+		(message "Opening connection to %s via starttls..."
+			 nnimap-address)
 		(let ((tls-program
-		       '("openssl s_client %s -connect %h:%p -no_ssl2 -ign_eof -starttls imap")))
+		       '("openssl s_client -connect %h:%p -no_ssl2 -ign_eof -starttls imap")))
 		  (open-tls-stream
 		   "*nnimap*" (current-buffer) nnimap-address
 		   (setq port (or nnimap-server-port "imap"))))
 		'("imap"))
 	       ((memq nnimap-stream '(ssl tls))
+		(message "Opening connection to %s via tls..." nnimap-address)
 		(funcall (if (fboundp 'open-gnutls-stream)
 			     'open-gnutls-stream
 			   'open-tls-stream)
@@ -1311,6 +1316,25 @@
   (setq nnimap-status-string "Read-only server")
   nil)
 
+(deffoo nnimap-request-thread (id)
+    (let* ((refs (split-string
+	       (or (mail-header-references (gnus-summary-article-header))
+		   "")))
+	   (cmd (let ((value
+		       (format
+			"(OR HEADER REFERENCES %s HEADER Message-Id %s)"
+			id id)))
+		  (dolist (refid refs value)
+		    (setq value (format
+				 "(OR (OR HEADER Message-Id %s HEADER REFERENCES %s) %s)"
+				 refid refid value)))))
+	   (result
+	    (with-current-buffer (nnimap-buffer)
+	      (nnimap-command  "UID SEARCH %s" cmd))))
+      (gnus-fetch-headers (and (car result)
+	   (delete 0 (mapcar #'string-to-number
+			     (cdr (assoc "SEARCH" (cdr result)))))))))
+
 (defun nnimap-possibly-change-group (group server)
   (let ((open-result t))
     (when (and server
--- a/lisp/gnus/shr.el	Thu Oct 14 23:35:03 2010 +0200
+++ b/lisp/gnus/shr.el	Thu Oct 14 22:39:54 2010 +0000
@@ -56,17 +56,17 @@
 (defcustom shr-table-line ?-
   "Character used to draw table line."
   :group 'shr
-  :type 'char)
+  :type 'character)
 
 (defcustom shr-table-corner ?+
   "Character used to draw table corner."
   :group 'shr
-  :type 'char)
+  :type 'character)
 
 (defcustom shr-hr-line ?-
   "Character used to draw hr line."
   :group 'shr
-  :type 'char)
+  :type 'character)
 
 (defcustom shr-width fill-column
   "Frame width to use for rendering."
@@ -404,14 +404,17 @@
             (width (string-to-number width)))
         (when (< width max-width)
           (let ((align (cdr (assq :align cont))))
-            (cond ((string= align "right")
-                   (insert (propertize
-                            " " 'display
-                            `(space . (:align-to ,(list (- max-width width)))))))
-                  ((string= align "center")
-                   (insert (propertize
-                            " " 'display
-                            `(space . (:balign-to ,(list (- (/ max-width 2) width))))))))))))
+            (cond
+	     ((string= align "right")
+	      (insert (propertize
+		       " " 'display
+		       `(space . (:align-to
+				  ,(list (- max-width width)))))))
+	     ((string= align "center")
+	      (insert (propertize
+		       " " 'display
+		       `(space . (:balign-to
+				  ,(list (- (/ max-width 2) width))))))))))))
     (let ((start (point-marker)))
       (when (zerop (length alt))
         (setq alt "[img]"))
@@ -537,6 +540,11 @@
 	 ;; unbreakable text).
 	 (sketch (shr-make-table cont suggested-widths))
 	 (sketch-widths (shr-table-widths sketch suggested-widths)))
+    ;; This probably won't work very well.
+    (when (> (1+ (loop for width across sketch-widths
+		       summing (1+ width)))
+	     (frame-width))
+      (setq truncate-lines t))
     ;; Then render the table again with these new "hard" widths.
     (shr-insert-table (shr-make-table cont sketch-widths t) sketch-widths))
   ;; Finally, insert all the images after the table.  The Emacs buffer