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

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

[elpa] master 4a3acfc 07/76: * enwc.el (enwc-enable-display-mode-line, e


From: Ian Dunn
Subject: [elpa] master 4a3acfc 07/76: * enwc.el (enwc-enable-display-mode-line, enwc-disable-display-mode-line, enwc-toggle-display-mode-line): Broke enable/disable mode line functionality into different functions.
Date: Thu, 23 Feb 2017 19:42:44 -0500 (EST)

branch: master
commit 4a3acfcc096b4bc09185e941c302d1e689df613c
Author: Ian D <address@hidden>
Commit: Ian D <address@hidden>

    * enwc.el (enwc-enable-display-mode-line, enwc-disable-display-mode-line, 
enwc-toggle-display-mode-line): Broke enable/disable mode line functionality 
into different functions.
    
    * enwc-setup.el (enwc-setup): Uses enwc-enable-display-mode-line to enable 
the mode line if requested by the user.
---
 lisp/enwc-setup.el | 14 ++++++++++----
 lisp/enwc.el       | 32 +++++++++++++++++++++++++-------
 2 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index 66004f6..ec6bf9d 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -97,10 +97,16 @@
 This setups ENWC and confirms that one of the backends can be found
 on D-Bus."
   (if enwc-display-mode-line
-      (setq global-mode-string (append global-mode-string
-                                       '(enwc-display-string))))
-  (setq enwc-display-mode-line-timer 
-        (run-at-time t 1 'enwc-update-mode-line))
+      (enwc-enable-display-mode-line)
+      ;; (progn
+      ;;   (unless (member 'enwc-display-string
+      ;;                   global-mode-string)
+      ;;     (setq global-mode-string (append global-mode-string
+      ;;                                      '(enwc-display-string))))
+      ;;   (setq enwc-display-mode-line-timer 
+      ;;         (run-at-time t 1 'enwc-update-mode-line)))
+    )
+  
 
   (if (and enwc-auto-scan (> enwc-auto-scan-interval 0))
       (setq enwc-scan-timer
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 0723aa6..a11c307 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -456,15 +456,34 @@ This is initiated during setup, and runs once every 
second."
                                          "*"
                                        (number-to-string str))
                                      "%] "))))
+(defun enwc-enable-display-mode-line ()
+  "Enables the mode line display."
+  (interactive)
+  (or global-mode-string (setq global-mode-string '("")))
+  (setq enwc-display-mode-line t)
+  (unless (member 'enwc-display-string
+                  global-mode-string)
+    (setq global-mode-string (append global-mode-string 
'(enwc-display-string))))
+  (if (not enwc-display-mode-line-timer)
+      (setq enwc-display-mode-line-timer
+            (run-at-time t 1 'enwc-update-mode-line))))
+
+(defun enwc-disable-display-mode-line ()
+  "Disables the mode line display."
+  (interactive)
+  (or global-mode-string (setq global-mode-string '("")))
+  (setq enwc-display-mode-line nil)
+  (setq global-mode-string (remove 'enwc-display-string global-mode-string))
+  (if enwc-display-mode-line-timer
+      (cancel-timer enwc-display-mode-line-timer))
+  (setq enwc-display-mode-line-timer nil))
 
 (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)))
+  (if (not enwc-display-mode-line)
+      (enwc-enable-display-mode-line)
+    (enwc-disable-display-mode-line)))
 
 (defun enwc-toggle-auto-scan ()
   "Toggles automatic scanning.
@@ -967,8 +986,7 @@ and redisplays the settings from the network profile
                        (cons (cons (car x)
                                    (widget-field-value-get (widget-at)))
                              nil)))))
-    (print settings)
-
+    ;;(print settings)
     (enwc-save-nw-settings enwc-using-wired enwc-edit-id settings)))
 
 (defun enwc-edit-entry-at-point ()



reply via email to

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