[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[STUMP] [PATCH] adjoin instead of push for adding to *screen-mode-line-f
From: |
John Li |
Subject: |
[STUMP] [PATCH] adjoin instead of push for adding to *screen-mode-line-formatters* |
Date: |
Mon, 7 Jul 2008 01:51:59 -0400 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
---
contrib/battery.lisp | 24 ++++++++++++------------
contrib/cpu.lisp | 3 ++-
contrib/mpd.lisp | 5 +++--
contrib/notifications.lisp | 3 ++-
4 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/contrib/battery.lisp b/contrib/battery.lisp
index 3e7ca13..550bd87 100644
--- a/contrib/battery.lisp
+++ b/contrib/battery.lisp
@@ -37,7 +37,8 @@
(export '(*battery-name*))
(dolist (a '((#\b fmt-bat-charge)))
- (push a *screen-mode-line-formatters*))
+ (setf *screen-mode-line-formatters*
+ (adjoin a *screen-mode-line-formatters* :test 'equal)))
(defvar *bat-state* nil)
(defvar *bat-remain* 0)
@@ -63,7 +64,7 @@
(let ((battery-state (read-battery-file *battery-name* "state"))
(battery-info (read-battery-file *battery-name* "info")))
(if (string= "no" (gethash "present" battery-state))
- (setq *bat-state* nil)
+ (setf *bat-state* nil)
(let ((charge-state (gethash "charging state" battery-state))
(remain (parse-integer (gethash "remaining capacity"
battery-state)
:junk-allowed t))
@@ -71,15 +72,14 @@
:junk-allowed t) 0) 60))
(full (parse-integer (gethash "design capacity" battery-info)
:junk-allowed t)))
- (setq *bat-remain* (round (/ (* 100 remain) full))
+ (setf *bat-remain* (round (/ (* 100 remain) full))
*bat-state* charge-state
*bat-remain-time* nil)
-
(when (> rate 0)
(let* ((online (round (/ (if (string= "charging" *bat-state*)
(- full remain) remain)
rate))))
- (setq *bat-remain-time* (multiple-value-bind (h m)
+ (setf *bat-remain-time* (multiple-value-bind (h m)
(truncate online 60)
(list h m)))))))))))
@@ -88,10 +88,10 @@
(declare (ignore ml))
(current-battery-charge)
(if *bat-state*
- (format nil "BAT: ~D%~A"
- *bat-remain*
- (if *bat-remain-time*
- (format nil " (~2,'0d:~2,'0d) ~A" (car *bat-remain-time*)
(cadr *bat-remain-time*) *bat-state*) "")) "no battery"))
+ (format nil "BAT: ~D%~A"
+ *bat-remain*
+ (if *bat-remain-time*
+ (format nil " (~2,'0d:~2,'0d) ~A" (car *bat-remain-time*)
(cadr *bat-remain-time*) *bat-state*) "")) "no battery"))
;; Alternative display:
@@ -116,9 +116,9 @@
;; (if (or (string= *bat-state* "charging")
;; (string= *bat-state* "charged"))
;; "AC" "DC")
-;; *bat-remain*
-;; (if (and (string/= *bat-state* "charged") *bat-remain-time*)
-;; (format nil (if (and (= (car *bat-remain-time*) 0)
+;; *bat-remain*
+;; (if (and (string/= *bat-state* "charged") *bat-remain-time*)
+;; (format nil (if (and (= (car *bat-remain-time*) 0)
;; (< (cadr *bat-remain-time*) 30))
;; " (^[^B^1*~2,'0d:~2,'0d^])" "
(~2,'0d:~2,'0d)")
;; (car *bat-remain-time*)
diff --git a/contrib/cpu.lisp b/contrib/cpu.lisp
index d62a080..5e1be53 100644
--- a/contrib/cpu.lisp
+++ b/contrib/cpu.lisp
@@ -41,7 +41,8 @@
(#\C fmt-cpu-usage-bar)
(#\f fmt-cpu-freq)
(#\t fmt-cpu-temp)))
- (push a *screen-mode-line-formatters*))
+ (setf *screen-mode-line-formatters*
+ (adjoin a *screen-mode-line-formatters* :test 'equal)))
;; Defaults arguments for fmt-cpu-usage-bar
(defvar *cpu-usage-bar-width* 10)
diff --git a/contrib/mpd.lisp b/contrib/mpd.lisp
index b8d1bdd..d76500d 100644
--- a/contrib/mpd.lisp
+++ b/contrib/mpd.lisp
@@ -134,7 +134,8 @@
;;mpd formatter
(dolist (a '((#\m fmt-mpd-status)))
- (push a *screen-mode-line-formatters*))
+ (setf *screen-mode-line-formatters*
+ (adjoin a *screen-mode-line-formatters* :test 'equal)))
(defparameter *mpd-current-song* nil)
(defparameter *mpd-status* nil)
@@ -454,4 +455,4 @@
(define-key m (kbd "d") "mpd-volume-down")
(define-key m (kbd "S") '*mpd-search-map*)
(define-key m (kbd "A") '*mpd-add-map*)
- m))
\ No newline at end of file
+ m))
diff --git a/contrib/notifications.lisp b/contrib/notifications.lisp
index 9d58c9c..bfa7b77 100644
--- a/contrib/notifications.lisp
+++ b/contrib/notifications.lisp
@@ -66,7 +66,8 @@
(in-package :stumpwm)
-(push '(#\N notifications-as-string) *screen-mode-line-formatters*)
+(setf *screen-mode-line-formatters*
+ (adjoin '(#\N notifications-as-string) *screen-mode-line-formatters*
:test 'equal))
(defparameter *notifications-delimiters* '("[" "]"))
--
1.5.6
- [STUMP] [PATCH] adjoin instead of push for adding to *screen-mode-line-formatters*,
John Li <=