emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 7a3c057 03/76: Added support for toggling the mode line di


From: Ian Dunn
Subject: [elpa] master 7a3c057 03/76: Added support for toggling the mode line display.
Date: Thu, 23 Feb 2017 19:42:43 -0500 (EST)

branch: master
commit 7a3c057541d02758e6bb4c6736501fb782c6c82b
Author: Ian D <address@hidden>
Commit: Ian D <address@hidden>

    Added support for toggling the mode line display.
---
 lisp/enwc-setup.el |  5 +++--
 lisp/enwc.el       | 17 +++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index c0e3ac2..fddcd08 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -97,8 +97,9 @@
   "Sets up ENWC.
 This setups ENWC and confirms that one of the backends can be found
 on D-Bus."
-  (setq global-mode-string (append global-mode-string
-                                  '(enwc-display-string)))
+  (if enwc-display-mode-line
+      (setq global-mode-string (append global-mode-string
+                                       '(enwc-display-string))))
   (run-at-time t 1 'enwc-update-mode-line)
 
   (let ((cur-back nil)
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 825cb5f..f851b62 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -70,6 +70,14 @@ and the first active backend found will be used."
   :group 'enwc
   :type 'list)
 
+(defcustom enwc-display-mode-line 't
+  "Whether or not to use ENWC's modeline display.
+When set to non-nil, this will cause the current
+network signal strength to be displayed on the
+Emacs mode line."
+  :group 'enwc
+  :type 'boolean)
+
 ;;; The function variables for the abstract layer.
 
 (defvar enwc-scan-func nil
@@ -427,6 +435,15 @@ This is initiated during setup, and runs once every 
second."
                                        (number-to-string str))
                                      "%] "))))
 
+(defun enwc-toggle-display-mode-line ()
+  "Toggles the mode line display."
+  (interactive)
+  (let ((new (not enwc-display-mode-line)))
+    (if new
+        (setq global-mode-string (append global-mode-string 
'(enwc-display-string)))
+      (setq global-mode-string (delq 'enwc-display-string global-mode-string)))
+    (setq enwc-display-mode-line new)))
+
 ;;;;;;;;;;;;;;;;;;
 ;; Scan internal
 ;;;;;;;;;;;;;;;;;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]