changeset 111138:11259a64bfc0

gnus-sum.el (gnus-summary-select-article): Make sure we have the original article buffer live. gnus-sum.el (gnus-summary-select-article-buffer): Mention gnus-widen-article-buffer. shr.el (shr-tag-object): Added. nnir.el, gnus-group.el: Make nnir work by default. gnus-agent.el (gnus-agent-fetch-group): Don't download stuff if the group isn't covered by the agent. gnus-sum.el (gnus-group-make-articles-read): Propagate marks to the backend for unknown groups. gnus-html.el (gnus-html-prefetch-images): Decode entities before prefetching images.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 24 Oct 2010 09:55:56 +0000
parents 1b078a586243
children d383b5e03a3d
files lisp/gnus/ChangeLog lisp/gnus/gnus-agent.el lisp/gnus/gnus-group.el lisp/gnus/gnus-html.el lisp/gnus/gnus-sum.el lisp/gnus/nnir.el lisp/gnus/shr.el
diffstat 7 files changed, 117 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Sun Oct 24 12:12:17 2010 +0900
+++ b/lisp/gnus/ChangeLog	Sun Oct 24 09:55:56 2010 +0000
@@ -1,3 +1,33 @@
+2010-10-24  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus-html.el (gnus-html-prefetch-images): Decode entities before
+	prefetching images.
+
+	* gnus-sum.el (gnus-group-make-articles-read): Propagate marks to the
+	backend for unknown groups.  This is mainly useful for nnimap groups.
+
+	* gnus-agent.el (gnus-agent-fetch-group): Don't download stuff if the
+	group isn't covered by the agent.
+
+2010-10-22  Andrew Cohen  <cohen@andy.bu.edu>
+
+	* nnir.el (nnir-method-default-engines): new variable.
+	(nnir-run-query): use it.
+	(nnir-group-mode-hook): remove key binding and move to gnus-group.el.
+	(gnus-summary-nnir-goto-thread): change group if needed.
+
+	* gnus-group.el (gnus-group-group-map): add key binding for
+	gnus-group-make-nnir-group.
+
+2010-10-24  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* shr.el (shr-tag-object): Added.
+
+	* gnus-sum.el (gnus-summary-select-article): Make sure we have the
+	original article buffer live.
+	(gnus-summary-select-article-buffer): Mention
+	gnus-widen-article-buffer.
+
 2010-10-23  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* shr.el (shr-tag-strong): Added.
--- a/lisp/gnus/gnus-agent.el	Sun Oct 24 12:12:17 2010 +0900
+++ b/lisp/gnus/gnus-agent.el	Sun Oct 24 09:55:56 2010 +0000
@@ -801,12 +801,13 @@
   (setq group (or group gnus-newsgroup-name))
   (unless group
     (error "No group on the current line"))
-
-  (gnus-agent-while-plugged
-    (let ((gnus-command-method (gnus-find-method-for-group group)))
-      (gnus-agent-with-fetch
-        (gnus-agent-fetch-group-1 group gnus-command-method)
-        (gnus-message 5 "Fetching %s...done" group)))))
+  (if (not (gnus-agent-group-covered-p group))
+      (message "%s isn't covered by the agent" group)
+    (gnus-agent-while-plugged
+      (let ((gnus-command-method (gnus-find-method-for-group group)))
+	(gnus-agent-with-fetch
+	  (gnus-agent-fetch-group-1 group gnus-command-method)
+	  (gnus-message 5 "Fetching %s...done" group))))))
 
 (defun gnus-agent-add-group (category arg)
   "Add the current group to an agent category."
--- a/lisp/gnus/gnus-group.el	Sun Oct 24 12:12:17 2010 +0900
+++ b/lisp/gnus/gnus-group.el	Sun Oct 24 09:55:56 2010 +0000
@@ -55,6 +55,8 @@
 (autoload 'gnus-agent-total-fetched-for "gnus-agent")
 (autoload 'gnus-cache-total-fetched-for "gnus-cache")
 
+(autoload 'gnus-group-make-nnir-group "nnir")
+
 (defcustom gnus-no-groups-message "No Gnus is good news"
   "*Message displayed by Gnus when no groups are available."
   :group 'gnus-start
@@ -653,6 +655,7 @@
   "D" gnus-group-enter-directory
   "f" gnus-group-make-doc-group
   "w" gnus-group-make-web-group
+  "G" gnus-group-make-nnir-group
   "M" gnus-group-read-ephemeral-group
   "r" gnus-group-rename-group
   "R" gnus-group-make-rss-group
@@ -904,6 +907,7 @@
 	["Add the help group" gnus-group-make-help-group t]
 	["Make a doc group..." gnus-group-make-doc-group t]
 	["Make a web group..." gnus-group-make-web-group t]
+	["Make a search group..." gnus-group-make-nnir-group t]
 	["Make a virtual group..." gnus-group-make-empty-virtual t]
 	["Add a group to a virtual..." gnus-group-add-to-virtual t]
 	["Make an ephemeral group..." gnus-group-read-ephemeral-group t]
--- a/lisp/gnus/gnus-html.el	Sun Oct 24 12:12:17 2010 +0900
+++ b/lisp/gnus/gnus-html.el	Sun Oct 24 09:55:56 2010 +0000
@@ -494,7 +494,8 @@
                             (gnus-blocked-images))))
       (save-match-data
 	(while (re-search-forward "<img[^>]+src=[\"']\\(http[^\"']+\\)" nil t)
-	  (let ((url (gnus-html-encode-url (match-string 1))))
+	  (let ((url (gnus-html-encode-url
+		      (mm-url-decode-entities-string (match-string 1)))))
 	    (unless (gnus-html-image-url-blocked-p url blocked-images)
               (when (gnus-html-cache-expired url gnus-html-image-cache-ttl)
                 (gnus-html-schedule-image-fetching nil
--- a/lisp/gnus/gnus-sum.el	Sun Oct 24 12:12:17 2010 +0900
+++ b/lisp/gnus/gnus-sum.el	Sun Oct 24 09:55:56 2010 +0000
@@ -6190,7 +6190,13 @@
 	 (info (nth 2 entry))
 	 (active (gnus-active group))
 	 range)
-    (when entry
+    (if (not entry)
+	;; Group that Gnus doesn't know exists, but still allow the
+	;; backend to set marks.
+	(gnus-request-set-mark
+	 group (list (list (gnus-compress-sequence (sort articles #'<))
+			   'add '(read))))
+      ;; Normal, subscribed groups.
       (setq range (gnus-compute-read-articles group articles))
       (with-current-buffer gnus-group-buffer
 	(gnus-undo-register
@@ -6942,7 +6948,9 @@
 ;; Various summary commands
 
 (defun gnus-summary-select-article-buffer ()
-  "Reconfigure windows to show the article buffer."
+  "Reconfigure windows to show the article buffer.
+If `gnus-widen-article-buffer' is set, show only the article
+buffer."
   (interactive)
   (if (not (gnus-buffer-live-p gnus-article-buffer))
       (error "There is no article buffer for this summary buffer")
@@ -7584,7 +7592,8 @@
 		       (null (get-buffer gnus-article-buffer))
 		       (not (eq article (cdr gnus-article-current)))
 		       (not (equal (car gnus-article-current)
-				   gnus-newsgroup-name))))
+				   gnus-newsgroup-name))
+		       (not (buffer-name gnus-original-article-buffer))))
 	      (and (not gnus-single-article-buffer)
 		   (or (null gnus-current-article)
 		       (not (eq gnus-current-article article))))
--- a/lisp/gnus/nnir.el	Sun Oct 24 12:12:17 2010 +0900
+++ b/lisp/gnus/nnir.el	Sun Oct 24 09:55:56 2010 +0000
@@ -378,6 +378,10 @@
 If this variable is nil, or if the provided function returns nil for a search
 result, `gnus-retrieve-headers' will be called instead.")
 
+(defvar nnir-method-default-engines
+  '((nnimap . imap)
+    (nntp . nil))
+  "Alist of default search engines by server method")
 
 ;;; Developer Extension Variable:
 
@@ -401,8 +405,8 @@
              ())
     (hyrex   nnir-run-hyrex
 	     ((group . "Group spec: ")))
-  (find-grep nnir-run-find-grep
-	     ((grep-options . "Grep options: "))))
+    (find-grep nnir-run-find-grep
+	       ((grep-options . "Grep options: "))))
   "Alist of supported search engines.
 Each element in the alist is a three-element list (ENGINE FUNCTION ARGS).
 ENGINE is a symbol designating the searching engine.  FUNCTION is also
@@ -677,16 +681,6 @@
            gnus-current-window-configuration)
      nil)))
 
-(eval-when-compile
-  (when (featurep 'xemacs)
-    ;; The `kbd' macro requires that the `read-kbd-macro' macro is available.
-    (require 'edmacro)))
-
-(defun nnir-group-mode-hook ()
-  (define-key gnus-group-mode-map (kbd "G G")
-    'gnus-group-make-nnir-group))
-(add-hook 'gnus-group-mode-hook 'nnir-group-mode-hook)
-
 ;; Why is this needed? Is this for compatibility with old/new gnusae? Using
 ;; gnus-group-server instead works for me.  -- Justus Piater
 (defmacro nnir-group-server (group)
@@ -716,22 +710,22 @@
 	 (id (mail-header-id (gnus-summary-article-header)))
 	 (refs (split-string
 		(mail-header-references (gnus-summary-article-header)))))
-    (if (string= (car (gnus-group-method group)) "nnimap")
-	(with-current-buffer (nnimap-buffer)
-	  (let* ((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 (nnimap-command
-			  "UID SEARCH %s" cmd)))
-	    (gnus-summary-read-group-1 group t t gnus-summary-buffer nil
-				       (and (car result)
-					    (delete 0 (mapcar #'string-to-number
-							      (cdr (assoc "SEARCH" (cdr result)))))))))
+    (if (eq (car (gnus-group-method group)) 'nnimap)
+	(progn (nnimap-possibly-change-group (gnus-group-short-name group) nil)
+	       (with-current-buffer (nnimap-buffer)
+		 (let* ((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 (nnimap-command
+				 "UID SEARCH %s" cmd)))
+		   (gnus-summary-read-group-1 group t t gnus-summary-buffer nil
+					      (and (car result)
+						   (delete 0 (mapcar #'string-to-number
+								     (cdr (assoc "SEARCH" (cdr result))))))))))
       (gnus-summary-read-group-1 group t t gnus-summary-buffer
 				 nil (list backend-number))
       (gnus-summary-limit (list backend-number))
@@ -1602,24 +1596,37 @@
     (if gnus-group-marked
 	(apply 'vconcat
 	       (mapcar (lambda (x)
-			 (let ((server (nnir-group-server x))
-			       search-func)
+			 (let* ((server (nnir-group-server x))
+				(engine
+				 (or (nnir-read-server-parm 'nnir-search-engine
+							    server)
+				     (cdr
+				      (assoc (car (gnus-server-to-method server))
+					     nnir-method-default-engines))))
+				search-func)
 			   (setq search-func (cadr
 					      (assoc
-					       (nnir-read-server-parm 'nnir-search-engine server) nnir-engines)))
+					       engine
+					       nnir-engines)))
 			   (if search-func
 			       (funcall search-func q server x)
 			     nil)))
-		       gnus-group-marked)
-	       )
+		       gnus-group-marked))
       (apply 'vconcat
 	     (mapcar (lambda (x)
 		       (if (and (equal (cadr x) 'ok) (not (equal (cadar x) "-ephemeral")))
-			   (let ((server (format "%s:%s" (caar x) (cadar x)))
-				 search-func)
+			   (let* ((server (format "%s:%s" (caar x) (cadar x)))
+				  (engine
+				   (or (nnir-read-server-parm 'nnir-search-engine
+							      server)
+				       (cdr
+					(assoc (car (gnus-server-to-method server))
+					       nnir-method-default-engines))))
+				  search-func)
 			     (setq search-func (cadr
 						(assoc
-						 (nnir-read-server-parm 'nnir-search-engine server) nnir-engines)))
+						 engine
+						 nnir-engines)))
 			     (if search-func
 				 (funcall search-func q server nil)
 			       nil))
--- a/lisp/gnus/shr.el	Sun Oct 24 12:12:17 2010 +0900
+++ b/lisp/gnus/shr.el	Sun Oct 24 09:55:56 2010 +0000
@@ -424,6 +424,18 @@
   (apply #'shr-fontize-cont cont types)
   (shr-ensure-paragraph))
 
+(defun shr-urlify (start url)
+  (widget-convert-button
+   'url-link start (point)
+   :help-echo url
+   :keymap shr-map
+   url)
+  (put-text-property start (point) 'shr-url url))
+
+(defun shr-encode-url (url)
+  "Encode URL."
+  (browse-url-url-encode-chars url "[)$ ]"))
+
 ;;; Tag-specific rendering rules.
 
 (defun shr-tag-p (cont)
@@ -478,16 +490,14 @@
 	(start (point))
 	shr-start)
     (shr-generic cont)
-    (widget-convert-button
-     'url-link (or shr-start start) (point)
-     :help-echo url
-     :keymap shr-map
-     url)
-    (put-text-property (or shr-start start) (point) 'shr-url url)))
+    (shr-urlify (or shr-start start) url)))
 
-(defun shr-encode-url (url)
-  "Encode URL."
-  (browse-url-url-encode-chars url "[)$ ]"))
+(defun shr-tag-object (cont)
+  (let ((url (cdr (assq :src (cdr (assq 'embed cont)))))
+	(start (point)))
+    (when url
+      (shr-insert " [multimedia] ")
+      (shr-urlify start url))))
 
 (defun shr-tag-img (cont)
   (when (and cont