From 221c60e44864272785bab9f012c9128af021b9b6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 15 Jun 2018 00:03:29 +0200 Subject: [PATCH] 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. --- init/look-and-feel.el | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/init/look-and-feel.el b/init/look-and-feel.el index e40299c60..67f09834a 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)