ui/fci: conform to conventions; minor refactor
This commit is contained in:
parent
1c5080315a
commit
0af32e0c52
1 changed files with 6 additions and 6 deletions
|
@ -22,9 +22,9 @@ Changes to this variable do not take effect until `fci-mode' is restarted.")
|
||||||
(add-hook 'org-mode-hook #'turn-off-fci-mode)
|
(add-hook 'org-mode-hook #'turn-off-fci-mode)
|
||||||
|
|
||||||
;; turn off fci if the window is narrow than fill column
|
;; turn off fci if the window is narrow than fill column
|
||||||
(defun fci-conditional (window)
|
(defun +fci-toggle-maybe (window)
|
||||||
(let ((fci-enabled (symbol-value 'fci-mode))
|
(let ((fci-enabled (symbol-value 'fci-mode))
|
||||||
(fci-column (if fci-rule-column fci-rule-column fill-column)))
|
(fci-column (or fci-rule-column fill-column)))
|
||||||
(with-selected-window window
|
(with-selected-window window
|
||||||
(if (and (eq fci-enabled nil)
|
(if (and (eq fci-enabled nil)
|
||||||
(< fci-column
|
(< fci-column
|
||||||
|
@ -32,11 +32,11 @@ Changes to this variable do not take effect until `fci-mode' is restarted.")
|
||||||
(turn-on-fci-mode)
|
(turn-on-fci-mode)
|
||||||
(turn-off-fci-mode)))))
|
(turn-off-fci-mode)))))
|
||||||
|
|
||||||
(defun fci-width-workaround (&rest _)
|
(defun +fci|width-workaround (&rest _)
|
||||||
(walk-windows #'fci-conditional 'no-minibuf))
|
(walk-windows #'+fci-toggle-maybe 'no-minibuf))
|
||||||
|
|
||||||
(add-hook 'window-size-change-functions 'fci-width-workaround)
|
(add-hook 'window-size-change-functions #'+fci|width-workaround)
|
||||||
(add-hook 'window-configuration-change-hook 'fci-width-workaround)
|
(add-hook 'window-configuration-change-hook #'+fci|width-workaround)
|
||||||
|
|
||||||
(defun +fci|set-color ()
|
(defun +fci|set-color ()
|
||||||
"Automatically change `fci-rule-color' based on `+fci-rule-color-function's
|
"Automatically change `fci-rule-color' based on `+fci-rule-color-function's
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue