diff options
author | JSDurand <mmemmew@gmail.com> | 2023-05-28 12:52:57 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-05-28 12:52:57 +0800 |
commit | 1a60ba4fba517c54e6d8b7286bd5471819248118 (patch) | |
tree | cf6a9acba6b09b7f66f93198432cf27395a3c09d | |
parent | 8b925fc10de905e80a44fa7df8262c1b39a2e829 (diff) |
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'.
-rw-r--r-- | modeline.el | 19 |
1 files changed, 19 insertions, 0 deletions
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 |