branch: elpa/telephone-line
commit cbaf1b813475003ceb677acb48c4e964a99c68d9
Author: Daniel Bordak <[email protected]>
Commit: Daniel Bordak <[email protected]>
Switch guards to boundp checks rather than eval-after-load
---
telephone-line-segments.el | 71 +++++++++++++++++++++++-----------------------
1 file changed, 35 insertions(+), 36 deletions(-)
diff --git a/telephone-line-segments.el b/telephone-line-segments.el
index 960842c868..b1322f83da 100644
--- a/telephone-line-segments.el
+++ b/telephone-line-segments.el
@@ -98,42 +98,41 @@ mouse-3: Toggle minor modes"
(when (boundp 'erc-modified-channels-object)
(string-trim erc-modified-channels-object)))
-(eval-after-load 'evil
- '(telephone-line-defsegment* telephone-line-evil-tag-segment ()
- (let ((tag (cond
- ((not (evil-visual-state-p)) (upcase (symbol-name
evil-state)))
- ((eq evil-visual-selection 'block)
- (if telephone-line-evil-use-short-tag "VB" "V-BLOCK"))
- ((eq evil-visual-selection 'line)
- (if telephone-line-evil-use-short-tag "VL" "V-LINE"))
- (t "VISUAL"))))
- (if telephone-line-evil-use-short-tag
- (seq-take tag 2)
- tag))))
-
-(eval-after-load 'xah-fly-keys
- '(telephone-line-defsegment* telephone-line-xah-fly-keys-segment ()
- (let ((tag (if xah-fly-insert-state-q
- "INSERT" "COMMAND")))
- (if telephone-line-evil-use-short-tag
- (seq-take tag 1)
- tag))))
-
-(eval-after-load 'ryo-modal
- '(telephone-line-defsegment* telephone-line-ryo-modal-segment ()
- (let ((tag (if ryo-modal-mode
- "RYO" "EMACS")))
- (if telephone-line-evil-use-short-tag
- (seq-take tag 1)
- tag))))
-
-(eval-after-load 'workgroups2
- '(telephone-line-defsegment* telephone-line-workgroups2-segment ()
- (telephone-line-raw (wg-mode-line-string) t)))
-
-(eval-after-load 'nyan-mode
- '(telephone-line-defsegment* telephone-line-nyan-segment ()
- (nyan-create)))
+(telephone-line-defsegment* telephone-line-evil-tag-segment ()
+ (when (bound-and-true-p evil-mode)
+ (let ((tag (cond
+ ((not (evil-visual-state-p)) (upcase (symbol-name evil-state)))
+ ((eq evil-visual-selection 'block)
+ (if telephone-line-evil-use-short-tag "VB" "V-BLOCK"))
+ ((eq evil-visual-selection 'line)
+ (if telephone-line-evil-use-short-tag "VL" "V-LINE"))
+ (t "VISUAL"))))
+ (if telephone-line-evil-use-short-tag
+ (seq-take tag 2)
+ tag))))
+
+(telephone-line-defsegment* telephone-line-xah-fly-keys-segment ()
+ (when (boundp xah-fly-insert-state-q)
+ (let ((tag (if xah-fly-insert-state-q
+ "INSERT" "COMMAND")))
+ (if telephone-line-evil-use-short-tag
+ (seq-take tag 1)
+ tag))))
+
+(telephone-line-defsegment* telephone-line-ryo-modal-segment ()
+ (let ((tag (if (bound-and-true-p ryo-modal-mode)
+ "RYO" "EMACS")))
+ (if telephone-line-evil-use-short-tag
+ (seq-take tag 1)
+ tag)))
+
+(telephone-line-defsegment* telephone-line-workgroups2-segment ()
+ (when (bound-and-true-p workgroups-mode)
+ (telephone-line-raw (wg-mode-line-string) t)))
+
+(telephone-line-defsegment* telephone-line-nyan-segment ()
+ (when (bound-and-true-p nyan-mode)
+ (nyan-create)))
(provide 'telephone-line-segments)
;;; telephone-line-segments.el ends here