summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tag-emacs/emacs.d/init.org41
1 files changed, 25 insertions, 16 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org
index ac4d4e2..d2fd813 100644
--- a/tag-emacs/emacs.d/init.org
+++ b/tag-emacs/emacs.d/init.org
@@ -141,26 +141,25 @@ Let’s try a basic theme.
 (use-package basic-theme
   :config (progn
             (load-theme 'basic t)
+
+            (set-face-background 'mode-line "#a1b56c")
+
+            (defvar mode-line-default-format mode-line-format)
+            (defcustom mode-line-default-hidden t
+              "Whether to hide the mode line by default")
+
             (defun show-mode-line ()
               (interactive)
-              (let ((faces-to-toggle '(mode-line mode-line-inactive)))
-                (mapcar (lambda (face)
-                          (set-face-background face "#a1b56c")
-                          (set-face-attribute face nil :height (face-attribute 'default :height)))
-                        faces-to-toggle)))
+              (setq mode-line-format mode-line-default-format)
+              (when (called-interactively-p)
+                (setq-default mode-line-format mode-line-default-format)
+                (setq mode-line-default-hidden nil)))
             (defun hide-mode-line ()
               (interactive)
-              (let ((faces-to-toggle '(mode-line mode-line-inactive)))
-                (mapcar (lambda (face)
-                          (set-face-background face "#e8e8e8")
-                          (set-face-attribute face nil :height 20))
-                        faces-to-toggle)))
-            (defun mode-line-visual-toggle ()
-              (interactive)
-              (cond ((string= "#a1b56c" (face-attribute 'mode-line :background))
-                     (hide-mode-line))
-                    (t
-                     (show-mode-line))))
+              (setq mode-line-format nil)
+              (when (called-interactively-p)
+                (setq-default mode-line-format nil)
+                (setq mode-line-default-hidden t)))
 
             (setq-default cursor-type 'bar)
             (setq-default cursor-in-non-selected-windows nil)
@@ -176,6 +175,16 @@ Let’s try a basic theme.
               (show-mode-line))
             (hide-clutter)
 
+            (when mode-line-default-hidden
+              (call-interactively #'hide-mode-line))
+
+            (defun hide-mode-line-if-default-hidden ()
+              (if mode-line-default-hidden
+                  (hide-mode-line)
+                (show-mode-line)))
+
+            (add-hook 'after-change-major-mode-hook #'hide-mode-line-if-default-hidden)
+
             (add-hook 'minibuffer-setup-hook #'show-mode-line)
             (add-hook 'minibuffer-exit-hook #'hide-mode-line)))
 #+END_SRC