From e752d2bdf78648bd881c5c32ab6707f788b7f558 Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann Date: Tue, 19 Sep 2017 19:56:35 +0200 Subject: Further improve justify-kp example Previously you got an error when it tried filling an empty, yet wide line, such as what an image produces... --- README.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index e82c121..08e3f74 100644 --- a/README.rst +++ b/README.rst @@ -64,7 +64,8 @@ file: .. code:: elisp (defun my-nov-font-setup () - (face-remap-add-relative 'variable-pitch :font "Liberation Serif-14")) + (face-remap-add-relative 'variable-pitch :family "Liberation Serif" + :height 1.0)) (add-hook 'nov-mode-hook 'my-nov-font-setup) To completely disable the variable pitch font, customize @@ -122,10 +123,11 @@ Here's an advanced example of text justification with the `justify-kp (save-excursion (goto-char (point-min)) (while (not (eobp)) - (goto-char (line-end-position)) - (when (> (shr-pixel-column) max-width) - (goto-char (line-beginning-position)) - (pj-justify)) + (when (not (looking-at "^[[:space:]]*$")) + (goto-char (line-end-position)) + (when (> (shr-pixel-column) max-width) + (goto-char (line-beginning-position)) + (pj-justify))) (forward-line 1)))) (add-hook 'window-configuration-change-hook 'my-nov-window-configuration-change-hook -- cgit v1.2.3