From 1a60ba4fba517c54e6d8b7286bd5471819248118 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 28 May 2023 12:52:57 +0800 Subject: modeline: toggle mode-line * modeline.el (modeline-toggle): A function to toggle the display of the mode line. (modeline-alt-format): This is used to store the mode line so that we can toggle back. (global-map): Add a global binding: 'C-c T'. --- modeline.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'modeline.el') diff --git a/modeline.el b/modeline.el index 4fda761..a505733 100644 --- a/modeline.el +++ b/modeline.el @@ -104,6 +104,25 @@ (modeline-format-major-mode) (modeline-format-vc-mode))) +;;; Toggle modeline + +(defvar-local modeline-alt-format nil + "The variable to store the original mode line format, so that we +can toggle back the format later on.") + +(defun modeline-toggle () + "Toggle the display of the mode line." + (interactive) + (cond + ((null modeline-alt-format) + (setq-local modeline-alt-format mode-line-format) + (setq-local mode-line-format nil)) + (t + (setq-local mode-line-format modeline-alt-format) + (setq-local modeline-alt-format nil)))) + +(define-key global-map (vector 3 ?T) #'modeline-toggle) + ;;; Calculate the correct lengths of characters ;;;###autoload -- cgit v1.2.3-18-g5258