* shr.el (shr-width, shr-insert-document): Allow nil as shr-width value
authorTassilo Horn <tassilo@member.fsf.org>
Sun, 2 Jan 2011 05:20:41 +0000 (06:20 +0100)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 2 Jan 2011 05:20:41 +0000 (06:20 +0100)
with the meaning of using the full emacs window width for rendering.

lisp/ChangeLog
lisp/shr.el

index 417f737..6288501 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-30  Tassilo Horn  <tassilo@member.fsf.org>
+
+       * shr.el (shr-width, shr-insert-document): Allow nil as shr-width value
+       with the meaning of using the full emacs window width for rendering.
+
 2010-12-27  Daiki Ueno  <ueno@unixuser.org>
 
        * mml2015.el (mml2015-epg-sign, mml2015-epg-encrypt): Take care the
index 1e95dde..c403c6d 100644 (file)
@@ -74,8 +74,12 @@ fit these criteria."
   :type 'character)
 
 (defcustom shr-width fill-column
-  "Frame width to use for rendering."
-  :type 'integer
+  "Frame width to use for rendering.
+May either be an integer specifying a fixed width in characters,
+or nil, meaning that the full width of the window should be
+used."
+  :type '(choice (integer :tag "Fixed width in characters")
+                (const   :tag "Use the width of the window" nil))
   :group 'shr)
 
 (defvar shr-content-function nil
@@ -111,6 +115,8 @@ cid: URL as the argument.")
 
 ;;;###autoload
 (defun shr-insert-document (dom)
+  (unless (integerp shr-width)
+    (set (make-local-variable 'shr-width) (window-width)))
   (setq shr-content-cache nil)
   (let ((shr-state nil)
        (shr-start nil))