From 030158f32daaefe34476bbd0ec7156b46c2f3f2a Mon Sep 17 00:00:00 2001 From: Gnus developers Date: Thu, 14 Oct 2010 22:39:54 +0000 Subject: [PATCH] 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. --- lisp/gnus/ChangeLog | 26 ++++++++++++++++++++++++++ lisp/gnus/gnus-art.el | 3 ++- lisp/gnus/gnus-int.el | 6 ++++++ lisp/gnus/gnus-sum.el | 46 +++++++++++++++++++++++++--------------------- lisp/gnus/nnimap.el | 26 +++++++++++++++++++++++++- lisp/gnus/shr.el | 30 +++++++++++++++++++----------- 6 files changed, 103 insertions(+), 34 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 7a8a9e171d0..27363445e35 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,5 +1,31 @@ 2010-10-14 Lars Magne Ingebrigtsen + * 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 + + * gnus-sum.el (gnus-summary-refer-thread): Implement a version that + uses *-request-thread. + +2010-10-14 Lars Magne Ingebrigtsen + + * nnimap.el (nnimap-open-connection): Remove %s from openssl + incantation, which is no longer valid. + +2010-10-14 Julien Danjou + + * shr.el: Fix defcustom type (char -> character). + +2010-10-14 Lars Magne Ingebrigtsen + * nnimap.el (nnimap-open-connection): tls-program should be a list of programs. diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index f84b134163c..32411066da1 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -4474,7 +4474,6 @@ commands: ;; 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 @@ Internal variable.") (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)) diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el index b210df452ca..19bcffe0049 100644 --- a/lisp/gnus/gnus-int.el +++ b/lisp/gnus/gnus-int.el @@ -504,6 +504,12 @@ If BUFFER, insert the article in that group." 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)) diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 1086e28882c..568e2976268 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -8824,31 +8824,35 @@ Return the number of articles fetched." (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) diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 3fbcef60bc0..bb9f5691984 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -304,6 +304,7 @@ textual parts.") ((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 @@ textual parts.") "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 @@ textual parts.") (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 diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el index cfabf1a8bfc..4d70a62ac50 100644 --- a/lisp/gnus/shr.el +++ b/lisp/gnus/shr.el @@ -56,17 +56,17 @@ fit these criteria." (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 @@ Return a string with image data." (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 @@ Return a string with image data." ;; 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 -- 2.11.4.GIT