branch: elpa/telephone-line
commit 1dc10acfc4ff26814248b4f45ae330457172dffc
Author: Daniel Bordak <[email protected]>
Commit: Daniel Bordak <[email protected]>
Apparently this is the only hook that's needed now?
Seems to work. Read over the mailing list, this should be the proper way
of hooking this as of emacs 24.2.
---
telephone-line.el | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/telephone-line.el b/telephone-line.el
index d87c08f6b4..7eab80bd52 100644
--- a/telephone-line.el
+++ b/telephone-line.el
@@ -166,25 +166,22 @@ Secondary separators do not incur a background color
change."
,reserve)))
'face face))
-(defvar telephone-line-selected-window nil)
+;; Active Window
-(defun telephone-line--set-selected-window ()
- (when (not (minibuffer-window-active-p (frame-selected-window)))
+(defvar telephone-line-selected-window (frame-selected-window))
+
+(defun telephone-line--set-selected-window (_)
+ (unless (minibuffer-window-active-p (frame-selected-window))
(setq telephone-line-selected-window (frame-selected-window))))
-(add-hook 'window-configuration-change-hook
#'telephone-line--set-selected-window)
-(add-hook 'focus-in-hook #'telephone-line--set-selected-window)
-(defadvice select-window (after telephone-line-select-window activate)
- "Set telephone-line's selected window value for use in determining the
active mode-line."
- (telephone-line--set-selected-window))
-(defadvice select-frame (after telephone-line-select-frame activate)
- "Set telephone-line's selected window value for use in determining the
active mode-line."
- (telephone-line--set-selected-window))
+(add-hook 'pre-redisplay-functions #'telephone-line--set-selected-window)
(defun telephone-line-selected-window-active ()
"Return whether the current window is active."
(eq telephone-line-selected-window (selected-window)))
+;; Face Functions
+
(defun telephone-line-face-map (sym)
"Return the face corresponding to SYM for the selected window's active
state."
(telephone-line--face-map sym (telephone-line-selected-window-active)))
@@ -220,6 +217,8 @@ Secondary separators do not incur a background color
change."
((not (bound-and-true-p evil-mode)) 'mode-line)
(t (intern (concat "telephone-line-evil-" (symbol-name evil-state))))))
+;; Modeline generation
+
;;TODO: Clean this up
(defun telephone-line--separator-generator (primary-sep)
(lambda (acc e)