Skip to content

Commit

Permalink
fill-column-master: keep RHS mode-line on screen
Browse files Browse the repository at this point in the history
  • Loading branch information
DennieTeMolder committed Feb 12, 2024
1 parent a3f35a4 commit 0713d18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion config.el
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@

(after! doom-modeline
(setq doom-modeline-buffer-file-name-style 'truncate-except-project
dirvish-mode-line-height doom-modeline-height)
mode-line-right-align-edge 'right-fringe)

;; Only display encoding in modeline when it's not UTF-8
(add-hook 'after-change-major-mode-hook #'dtm-doom-modeline-conditional-encoding-h))
Expand Down Expand Up @@ -340,6 +340,7 @@

(after! dirvish
(setq dirvish-reuse-session nil
dirvish-mode-line-height doom-modeline-height
dirvish-quick-access-entries
`(("D" "~/Downloads/" "Downloads")
("dc" ,doom-core-dir "Doom Core")
Expand Down
11 changes: 8 additions & 3 deletions modules/ui/zen-light/autoload/fill-column-master.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@
:init-value nil :lighter nil :global nil
:after-hook (fill-column-master-adjust)
(when (not fill-column-visual-mode)
(fill-column-master-manage-hooks fill-column-center-mode)))
(fill-column-master--manage-state fill-column-center-mode)))

;;;###autoload
(define-minor-mode fill-column-visual-mode
"Adjust right margin to end the buffer at `fill-column' in the current window."
:init-value nil :lighter nil :global nil
:after-hook (fill-column-master-adjust)
(when (not fill-column-center-mode)
(fill-column-master-manage-hooks fill-column-visual-mode)))
(fill-column-master--manage-state fill-column-visual-mode)))

(defun fill-column-master-manage-hooks (enable)
(defun fill-column-master--manage-state (enable)
"Setup/teardown necessary hooks & variables depending on ENABLE.
Ref: https://github.com/seagle0128/doom-modeline/issues/672"
(if enable
(progn
(when (eq mode-line-right-align-edge 'window)
(setq-local mode-line-right-align-edge 'right-margin))
(add-hook 'window-configuration-change-hook #'fill-column-master-adjust 'append 'local)
(add-hook 'display-line-numbers-mode-hook #'fill-column-master-adjust 'append 'local)
(add-hook 'text-scale-mode-hook #'fill-column-master-adjust 'append 'local))
(kill-local-variable 'mode-line-right-align-edge)
(remove-hook 'window-configuration-change-hook #'fill-column-master-adjust 'local)
(remove-hook 'display-line-numbers-mode-hook #'fill-column-master-adjust 'local)
(remove-hook 'text-scale-mode-hook #'fill-column-master-adjust 'local)))
Expand Down

0 comments on commit 0713d18

Please sign in to comment.