2002-01-28 Katsumi Yamaoka <yamaoka@jpl.org>
authorKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 28 Jan 2002 01:33:12 +0000 (01:33 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Mon, 28 Jan 2002 01:33:12 +0000 (01:33 +0000)
* lpath.el: Bind `w3m-cid-retrieve-function-alist'.

2002-01-27  TSUCHIYA Masatoshi  <tsuchiya@namazu.org>

* gnus-art.el (gnus-article-wash-html-with-w3m): Handle cid: URLs.

* mm-view.el (mm-setup-w3m): Add `mm-w3m-cid-retrieve' to
`w3m-cid-retrieve-function-alist' for `gnus-article-mode'.
(mm-w3m-cid-retrieve): New function.
(mm-inline-text-html-render-with-w3m): Handle cid: URLs.

lisp/ChangeLog
lisp/gnus-art.el
lisp/lpath.el
lisp/mm-view.el

index f73bfef..e0e96bf 100644 (file)
@@ -1,10 +1,23 @@
+2002-01-28  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * lpath.el: Bind `w3m-cid-retrieve-function-alist'.
+
+2002-01-27  TSUCHIYA Masatoshi  <tsuchiya@namazu.org>
+
+       * gnus-art.el (gnus-article-wash-html-with-w3m): Handle cid: URLs.
+
+       * mm-view.el (mm-setup-w3m): Add `mm-w3m-cid-retrieve' to
+       `w3m-cid-retrieve-function-alist' for `gnus-article-mode'.
+       (mm-w3m-cid-retrieve): New function.
+       (mm-inline-text-html-render-with-w3m): Handle cid: URLs.
+
 2002-01-27  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * gnus-agent.el (gnus-agent-fetch-articles): Don't save empty articles.
 
 2002-01-27  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
-       * gnus-util.el (gnus-cache-file-contents): Don't use equalp. 
+       * gnus-util.el (gnus-cache-file-contents): Don't use equalp.
 
 2002-01-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 2002-01-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-agent.el (gnus-agent-load-alist): Use new caching
-       function. 
+       function.
 
        * gnus-util.el (gnus-cache-file-contents): New function.
 
        * gnus-agent.el (gnus-agent-file-loading-cache): New variable.
        (gnus-agent-load-alist): Use it.
 
-       * nnagent.el (nnagent-retrieve-headers): Use optimized function. 
+       * nnagent.el (nnagent-retrieve-headers): Use optimized function.
 
        * nnheader.el (nnheader-insert-nov-file): New function.
 
-       * gnus-util.el (gnus-parse-without-error): Correct the loop. 
+       * gnus-util.el (gnus-parse-without-error): Correct the loop.
 
        * gnus-sum.el (gnus-dependencies-add-header): Use in-reply-to if
        there are no references.
        (gnus-extract-message-id-from-in-reply-to): New function.
        (gnus-nov-parse-line): Use in-reply-to if there are no
-       references. 
+       references.
 
 2002-01-25  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
index 58a0b06..534a56c 100644 (file)
@@ -1192,7 +1192,7 @@ It is a string, such as \"PGP\". If nil, ask user."
   :type 'string
   :group 'mime-security)
 
-(defcustom gnus-article-wash-function 
+(defcustom gnus-article-wash-function
   (cond ((locate-library "w3")
         'gnus-article-wash-html-with-w3)
        ((locate-library "w3m")
@@ -1731,7 +1731,7 @@ unfolded."
 (defun gnus-article-treat-body-boundary ()
   "Place a boundary line at the end of the headers."
   (interactive)
-  (when (and gnus-body-boundary-delimiter 
+  (when (and gnus-body-boundary-delimiter
             (> (length gnus-body-boundary-delimiter) 0))
     (gnus-with-article-headers
       (goto-char (point-max))
@@ -1820,7 +1820,7 @@ unfolded."
            (when (and wash-face-p
                       (progn
                         (goto-char (point-min))
-                        (not (re-search-forward 
+                        (not (re-search-forward
                               "^X-Face\\(-[0-9]+\\)?:[\t ]*" nil t)))
                       (gnus-buffer-live-p gnus-original-article-buffer))
              ;; If type `W f', use gnus-original-article-buffer,
@@ -1840,7 +1840,7 @@ unfolded."
                (when xpm
                  (setq image (gnus-create-image xpm 'xpm t))
                  (gnus-article-goto-header "from")
-                 (when (bobp) 
+                 (when (bobp)
                    (insert "From: [no `from' set]\n")
                    (forward-char -17))
                  (gnus-add-wash-type 'xface)
@@ -2089,9 +2089,10 @@ If READ-CHARSET, ask for a coding system."
 (defun gnus-article-wash-html-with-w3m ()
   "Wash the current buffer with w3m."
   (mm-setup-w3m)
-  (w3m-region (point) (point-max))
+  (let ((w3m-safe-url-regexp "\\`cid:"))
+    (w3m-region (point) (point-max)))
   (setq mm-w3m-minor-mode t))
-  
+
 (defun article-hide-list-identifiers ()
   "Remove list identifies from the Subject header.
 The `gnus-list-identifiers' variable specifies what to do."
@@ -4868,7 +4869,7 @@ If given a prefix, show the hidden text instead."
                 (gnus-cache-request-article article group))
            'article)
           ;; Check the agent cache.
-          ((and gnus-agent gnus-agent-cache gnus-plugged 
+          ((and gnus-agent gnus-agent-cache gnus-plugged
                 (numberp article)
                 (gnus-agent-request-article article group))
            'article)
@@ -5597,7 +5598,7 @@ specified by `gnus-button-alist'."
     (gnus-eval-format
      gnus-prev-page-line-format nil
      `(,@(gnus-local-map-property gnus-prev-page-map)
-        gnus-prev t 
+        gnus-prev t
         gnus-callback gnus-article-button-prev-page
         article-type annotation))
     (widget-convert-button
@@ -5644,7 +5645,7 @@ specified by `gnus-button-alist'."
        (buffer-read-only nil))
     (gnus-eval-format gnus-next-page-line-format nil
                      `(,@(gnus-local-map-property gnus-next-page-map)
-                         gnus-next t 
+                         gnus-next t
                          gnus-callback gnus-article-button-next-page
                          article-type annotation))
     (widget-convert-button
index 484557d..469d7e6 100644 (file)
@@ -60,6 +60,7 @@
              rmail-enable-mime-composing
              rmail-insert-mime-forwarded-message-function
              w3-meta-content-type-charset-regexp
+             w3m-current-buffer w3m-cid-retrieve-function-alist
              w3m-meta-content-type-charset-regexp w3m-mode-map))
 
 (if (featurep 'xemacs)
index 6258e1d..f22d064 100644 (file)
 (defun mm-setup-w3m ()
   (unless mm-w3m-setup
     (require 'w3m)
+    (unless (assq 'gnus-article-mode w3m-cid-retrieve-function-alist)
+      (push (cons 'gnus-article-mode 'mm-w3m-cid-retrieve)
+           w3m-cid-retrieve-function-alist))
     (gnus-add-minor-mode 'mm-w3m-minor-mode " w3m" w3m-mode-map)
     (setq mm-w3m-setup t)))
 
+(defun mm-w3m-cid-retrieve (url &rest args)
+  (when (string-match "\\`cid:" url)
+    (setq url (concat "<" (substring url (match-end 0)) ">"))
+    (catch 'found-handle
+      (dolist (handle (with-current-buffer w3m-current-buffer
+                       gnus-article-mime-handles))
+       (when (and (listp handle)
+                  (equal url (mm-handle-id handle)))
+         (mm-insert-part handle)
+         (throw 'found-handle (mm-handle-media-type handle)))))))
+
 (defun mm-inline-text-html-render-with-w3m (handle)
   (mm-setup-w3m)
   (let ((text (mm-get-part handle))
        (when charset
          (delete-region (point-min) (point-max))
          (insert (mm-decode-string text charset)))
-       (w3m-region (point-min) (point-max))
+       (let ((w3m-safe-url-regexp "\\`cid:"))
+         (w3m-region (point-min) (point-max)))
        (setq mm-w3m-minor-mode t))
       (mm-handle-set-undisplayer
        handle