diff options
author | Vasilij Schneidermann <mail@vasilij.de> | 2017-09-19 19:56:35 +0200 |
---|---|---|
committer | Vasilij Schneidermann <mail@vasilij.de> | 2017-09-19 19:56:35 +0200 |
commit | e752d2bdf78648bd881c5c32ab6707f788b7f558 (patch) | |
tree | 9c83fd679ec7c5bfb3fd0ce4bc7975eaa8add014 | |
parent | 6e29ee309c7f323a446034ea4fefb400b16199e3 (diff) |
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...
-rw-r--r-- | README.rst | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 |