Allow customizing the rendering width.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 29 Aug 2010 02:02:50 +0000 (04:02 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 29 Aug 2010 02:02:50 +0000 (04:02 +0200)
lisp/gnus-html.el

index 4488dda..2291fd3 100644 (file)
   :group 'gnus-art
   :type 'integer)
 
+(defcustom gnus-html-frame-width 70
+  "What width to use when rendering HTML."
+  :group 'gnus-art
+  :type 'integer)
+
 ;;;###autoload
 (defun gnus-article-html (handle)
   (let ((article-buffer (current-buffer)))
                             "w3m" 
                             nil article-buffer nil
                             "-halfdump"
+                            "-t" (format "%s" tab-width)
+                            "-cols" (format "%s" gnus-html-frame-width)
                             "-T" "text/html"))
       (gnus-html-wash-tags))))
 
 (defun gnus-html-wash-tags ()
   (let (tag parameters string start end images)
-    ;;(subst-char-in-region (point-min) (point-max) ?_ ? )
     (goto-char (point-min))
     (while (re-search-forward "<\\([^ />]+\\)\\([^>]*\\)>" nil t)
       (setq tag (match-string 1)
       (goto-char start))
     ;; Delete any excessive space at the start.
     (goto-char (point-min))
-    (when (re-search-forward "[^ \t\n]" nil t)
+    (when (and (re-search-forward "[^ \t\n]" nil t)
+              (> (match-beginning 0) (point-min)))
       (delete-region (point-min) (1- (match-beginning 0))))
     (when images
       (gnus-html-schedule-image-fetching (current-buffer) images))))