fix(visual-fill-column): only trigger hook when active
This commit is contained in:
parent
5fb65ed973
commit
99ff48d1d3
1 changed files with 2 additions and 2 deletions
|
|
@ -1311,7 +1311,7 @@ The =visual-fill-column= package works by expanding the window's right margin. T
|
|||
When a buffer has line numbers, they can interfere with the margins and make the line smaller than it should be. We can mitigate this issue by adding extra columns to the window.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun ~/update-visual-fill-column-line-numbers (&optional _s _e _len)
|
||||
(defun ~/update-visual-fill-column-line-numbers ()
|
||||
(require 'visual-fill-column)
|
||||
(let ((dw (line-number-display-width)))
|
||||
;; 2 extra columns for padding (when line numbers are on)
|
||||
|
|
@ -1320,7 +1320,7 @@ When a buffer has line numbers, they can interfere with the margins and make the
|
|||
(unless (= dw (or (cdr visual-fill-column-extra-text-width) 0))
|
||||
(setq-local visual-fill-column-extra-text-width
|
||||
(cons 0 dw))
|
||||
(visual-fill-column--adjust-window))))
|
||||
(visual-fill-column-adjust))))
|
||||
|
||||
(add-hook! '(display-line-numbers-mode-hook post-command-hook doom-switch-buffer-hook)
|
||||
#'~/update-visual-fill-column-line-numbers)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue