From 0713d18a192accd35f106fed3310306c32417445 Mon Sep 17 00:00:00 2001 From: DennieTeMolder Date: Mon, 12 Feb 2024 12:06:36 +0100 Subject: [PATCH] fill-column-master: keep RHS mode-line on screen Ref: https://github.com/seagle0128/doom-modeline/issues/672 --- config.el | 3 ++- modules/ui/zen-light/autoload/fill-column-master.el | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/config.el b/config.el index c990c33..2051cfa 100644 --- a/config.el +++ b/config.el @@ -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)) @@ -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") diff --git a/modules/ui/zen-light/autoload/fill-column-master.el b/modules/ui/zen-light/autoload/fill-column-master.el index 3f6e6af..0fcd97b 100644 --- a/modules/ui/zen-light/autoload/fill-column-master.el +++ b/modules/ui/zen-light/autoload/fill-column-master.el @@ -6,7 +6,7 @@ :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 @@ -14,14 +14,19 @@ :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)))