From ecbdecc927a3b3f7e0927d225e6e6464c244c2ae Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann Date: Wed, 21 Aug 2019 21:19:44 +0200 Subject: Support not filling text at all Closes #57 --- nov.el | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'nov.el') diff --git a/nov.el b/nov.el index d55f5a5..7389607 100644 --- a/nov.el +++ b/nov.el @@ -71,10 +71,11 @@ Otherwise the default face is used." (defcustom nov-text-width nil "Width filled text shall occupy. An integer is interpreted as the number of columns. If nil, use -the full window's width. Note that this variable only has an -effect in Emacs 25.1 or greater." +the full window's width. If t, disable filling completely. Note +that this variable only has an effect in Emacs 25.1 or greater." :type '(choice (integer :tag "Fixed width in characters") - (const :tag "Use the width of the window" nil)) + (const :tag "Use the width of the window" nil) + (const :tag "Disable filling" t)) :group 'nov) (defcustom nov-render-html-function 'nov-render-html @@ -489,12 +490,15 @@ chapter title." (let (;; HACK: make buttons use our own commands (shr-map nov-mode-map) (shr-external-rendering-functions nov-shr-rendering-functions) - (shr-use-fonts nov-variable-pitch) - (shr-width nov-text-width)) + (shr-use-fonts nov-variable-pitch)) ;; HACK: `shr-external-rendering-functions' doesn't cover ;; every usage of `shr-tag-img' (cl-letf (((symbol-function 'shr-tag-img) 'nov-render-img)) - (shr-render-region (point-min) (point-max)))) + (if (eq nov-text-width t) + (cl-letf (((symbol-function 'shr-fill-line) 'ignore)) + (shr-render-region (point-min) (point-max))) + (let ((shr-width nov-text-width)) + (shr-render-region (point-min) (point-max)))))) (run-hooks 'nov-post-html-render-hook)) (defun nov-render-document () -- cgit v1.2.3