A little investigation indicates that you'll need to modify the various shr-fill-*
functions to achieve this. The shr-width
variable may or may not still be relevant at that point, but it seems reasonable to set that as well.
It you just want to hard-code this, you can redefine the functions like so:
(eval-after-load 'shr
'(progn (setq shr-width -1)
(defun shr-fill-text (text) text)
(defun shr-fill-lines (start end) nil)
(defun shr-fill-line () nil)))
If you want behaviour you can toggle, I would probably advise the functions to conditionally do nothing, based upon some variable. e.g.:
(defadvice shr-fill-text (around shr-no-fill-text activate)
"Do not fill text when `shr-no-fill-mode' is enabled."
(if (bound-and-true-p shr-no-fill-mode)
(ad-get-arg 0)
ad-do-it))
(defadvice shr-fill-lines (around shr-no-fill-lines activate)
"Do not fill text when `shr-no-fill-mode' is enabled."
(unless (bound-and-true-p shr-no-fill-mode)
ad-do-it))
(defadvice shr-fill-line (around shr-no-fill-line activate)
"Do not fill text when `shr-no-fill-mode' is enabled."
(unless (bound-and-true-p shr-no-fill-mode)
ad-do-it))
(define-minor-mode shr-no-fill-mode
"Global minor mode which prevents `shr' and `eww' from filling text output."
;; :lighter (:eval (if (derived-mode-p 'eww-mode) " ShrNoFill"))
:global t)
(shr-no-fill-mode 1) ;; To enable by default.
;; M-x shr-no-fill-mode to toggle.