aboutsummaryrefslogtreecommitdiff
path: root/nov.el
diff options
context:
space:
mode:
authorVasilij Schneidermann <mail@vasilij.de>2019-08-21 21:19:44 +0200
committerVasilij Schneidermann <mail@vasilij.de>2019-08-21 21:20:33 +0200
commitecbdecc927a3b3f7e0927d225e6e6464c244c2ae (patch)
treec29474f70de61117938999069602a81e6b7ee94d /nov.el
parent5184fbb1f3b3540be58a28f6dd469ff212ccc9bd (diff)
Support not filling text at all
Closes #57
Diffstat (limited to 'nov.el')
-rw-r--r--nov.el16
1 files changed, 10 insertions, 6 deletions
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 ()