changeset 110167:b8559a372ac8

gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sat, 04 Sep 2010 00:21:34 +0000
parents 514c8efbfdbb
children 1feebeccf097
files lisp/gnus/ChangeLog lisp/gnus/gnus-agent.el lisp/gnus/gnus-art.el lisp/gnus/gnus-html.el
diffstat 4 files changed, 46 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Sat Sep 04 00:12:44 2010 +0000
+++ b/lisp/gnus/ChangeLog	Sat Sep 04 00:21:34 2010 +0000
@@ -1,5 +1,13 @@
 2010-09-03  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+	* gnus-html.el (gnus-html-put-image): Allow images to be removed.
+	(gnus-html-wash-tags): Add a new `i' command to insert images.
+	(gnus-html-insert-image): New command and keystroke.
+
+	* gnus-agent.el (gnus-agent-auto-agentize-methods): Change the default
+	so that nnimap methods aren't agentized by default.  There's apparently
+	many problems related to agent/imap behaviour.
+
 	* gnus-art.el (gnus-article-copy-string): New command and key binding.
 
 	* gnus-html.el: Doc fix.
--- a/lisp/gnus/gnus-agent.el	Sat Sep 04 00:12:44 2010 +0000
+++ b/lisp/gnus/gnus-agent.el	Sat Sep 04 00:21:34 2010 +0000
@@ -184,7 +184,7 @@
   :type 'boolean
   :group 'gnus-agent)
 
-(defcustom gnus-agent-auto-agentize-methods '(nntp nnimap)
+(defcustom gnus-agent-auto-agentize-methods '(nntp)
   "Initially, all servers from these methods are agentized.
 The user may remove or add servers using the Server buffer.
 See Info node `(gnus)Server Buffer'."
--- a/lisp/gnus/gnus-art.el	Sat Sep 04 00:12:44 2010 +0000
+++ b/lisp/gnus/gnus-art.el	Sat Sep 04 00:21:34 2010 +0000
@@ -7832,8 +7832,8 @@
 					 'gnus-button-push from)
 		(gnus-put-text-property
 		 start end
-		 'gnus-data (buffer-substring-no-properties
-			     start end))))))))))
+		 'gnus-string (buffer-substring-no-properties
+			       start end))))))))))
 
 (defun gnus-article-extend-url-button (beg start end)
   "Extend url button if url is folded into two or more lines.
@@ -7945,7 +7945,7 @@
   "Copy the string in the button to the kill ring."
   (interactive)
   (gnus-article-check-buffer)
-  (let ((data (get-text-property (point) 'gnus-data)))
+  (let ((data (get-text-property (point) 'gnus-string)))
     (when data
       (with-temp-buffer
 	(insert data)
--- a/lisp/gnus/gnus-html.el	Sat Sep 04 00:12:44 2010 +0000
+++ b/lisp/gnus/gnus-html.el	Sat Sep 04 00:21:34 2010 +0000
@@ -66,6 +66,12 @@
   :group 'gnus-art
   :type 'float)
 
+(defvar gnus-html-image-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "u" 'gnus-article-copy-string)
+    (define-key map "i" 'gnus-html-insert-image)
+    map))
+
 ;;;###autoload
 (defun gnus-article-html (handle)
   (let ((article-buffer (current-buffer)))
@@ -142,12 +148,24 @@
 		    (delete-region start end)
 		    (gnus-put-image image (gnus-string-or string "*")))))
 	    ;; Normal, external URL.
-	    (unless (gnus-html-image-url-blocked-p
-		     url
-		     (if (buffer-live-p gnus-summary-buffer)
-			 (with-current-buffer gnus-summary-buffer
-			   gnus-blocked-images)
-		       gnus-blocked-images))
+	    (if (gnus-html-image-url-blocked-p
+		 url
+		 (if (buffer-live-p gnus-summary-buffer)
+		     (with-current-buffer gnus-summary-buffer
+		       gnus-blocked-images)
+		   gnus-blocked-images))
+		(progn
+		  (widget-convert-button
+		   'link start end
+		   :action 'gnus-html-insert-image
+		   :help-echo url
+		   :keymap gnus-html-image-map
+		   :button-keymap gnus-html-image-map)
+		  (gnus-put-text-property
+		   start end
+		   'gnus-image (list url
+				     (set-marker (make-marker) start)
+				     (set-marker (make-marker) end))))
 	      (let ((file (gnus-html-image-id url))
 		    width height)
 		(when (string-match "height=\"?\\([0-9]+\\)" parameters)
@@ -184,6 +202,7 @@
 	  (let ((overlay (gnus-make-overlay start end)))
 	    (gnus-overlay-put overlay 'evaporate t)
 	    (gnus-overlay-put overlay 'gnus-button-url url)
+	    (gnus-put-text-property start end 'gnus-string url)
 	    (when gnus-article-mouse-face
 	      (gnus-overlay-put overlay 'mouse-face gnus-article-mouse-face)))))
        ;; The upper-case IMG_ALT is apparently just an artifact that
@@ -202,6 +221,12 @@
     (when images
       (gnus-html-schedule-image-fetching (current-buffer) (nreverse images)))))
 
+(defun gnus-html-insert-image ()
+  "Fetch and insert the image under point."
+  (interactive)
+  (gnus-html-schedule-image-fetching
+   (current-buffer) (list (get-text-property (point) 'gnus-image))))
+
 (defun gnus-html-schedule-image-fetching (buffer images)
   (gnus-message 8 "gnus-html-schedule-image-fetching: buffer %s, images %s"
                 buffer images)
@@ -268,7 +293,9 @@
 			   (= (cdr size) 30))))
 	    (progn
 	      (gnus-put-image (gnus-html-rescale-image image file size)
-			      (gnus-string-or string "*"))
+			      (gnus-string-or string "*")
+			      'external)
+	      (gnus-add-image 'external image)
 	      t)
 	  (insert string)
 	  (when (fboundp 'find-image)