about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-06-14T22·03+0200
committerVincent Ambo <tazjin@gmail.com>2018-06-14T23·15+0200
commit221c60e44864272785bab9f012c9128af021b9b6 (patch)
tree82eea2fb3848ce00f0a52b9a56f2064c2c0ba060
parent75749b68b0deb34588c8bd88597f1ac9583c815c (diff)
refactor(look-and-feel): Replace SML with telephone-line
Telephone line has a slightly easier to configure segment system. This
commit also uses the commit introduced in the previous function to
conditionally display miscellaneous modeline information in the last
window of a frame.

More configuration for this will come over time.
-rw-r--r--init/look-and-feel.el28
1 files changed, 26 insertions, 2 deletions
diff --git a/init/look-and-feel.el b/init/look-and-feel.el
index e40299c60282..67f09834ae42 100644
--- a/init/look-and-feel.el
+++ b/init/look-and-feel.el
@@ -1,5 +1,7 @@
 ;;; -*- lexical-binding: t; -*-
 
+(require 'telephone-line)
+
 ;; Hide those ugly tool bars:
 (tool-bar-mode 0)
 (scroll-bar-mode 0)
@@ -34,8 +36,30 @@
 ;; If this file is evaluating there may also be a new (initial) frame:
 (configure-new-frame (selected-frame))
 
-;; Configure smart mode line
-(sml/setup)
+;; Configure telephone-line
+(defun telephone-misc-if-last-window ()
+  "Renders the mode-line-misc-info string for display in the
+  mode-line if the currently active window is the last one in the
+  frame.
+
+  The idea is to not display information like the current time,
+  load, battery levels in all buffers."
+
+  (if (bottom-right-window-p)
+      (telephone-line-raw mode-line-misc-info t)
+    ""))
+
+(telephone-line-defsegment telephone-line-last-window-segment ()
+  (telephone-misc-if-last-window))
+
+(setq telephone-line-lhs
+      '((nil . (telephone-line-position-segment))
+        (accent . (telephone-line-buffer-segment))))
+
+(setq telephone-line-rhs
+      '((accent . (telephone-line-major-mode-segment))
+        (nil . (telephone-line-last-window-segment))))
+(telephone-line-mode 1)
 
 ;; Auto refresh buffers
 (global-auto-revert-mode 1)