stumpwm-devel
[Top][All Lists]
Advanced

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

Re: [STUMP] Best of the modelines


From: Chris Gray
Subject: Re: [STUMP] Best of the modelines
Date: Fri, 13 Nov 2009 16:53:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Sébastien Vauban wrote:

> Hi,

> Sébastien Vauban wrote:
>> I'd be interested by knowing what awesome feature you've put in your 
>> modeline.

>> I know we can put all the things from contribs, adding colors and information
>> like the currently played song; but do you have anything else that's
>> interesting and could be shared with us?  Monitoring?  Application or network
>> status?  Etc?

> I now have this:

> (defun current-date ()
>   "Returns the date formatted as `2009-11-12 Thu 17:21:43'."
>   (run-shell-command "YMDd=`date '+%F %a'`; HMS=`date '+%H:%M:%S'`; echo -n 
> $YMDd ^B$HMS^b" t))

This is possible to do in lisp:

--8<---------------cut here---------------start------------->8---
(defconstant *day-names*
    '("Mon" "Tue" "Wed"
      "Thu" "Fri" "Sat"
      "Sun"))

(defconstant *month-names*
  '("Jan" "Feb" "Mar" "Apr"
    "May" "Jun" "Jul" "Aug"
    "Sep" "Oct" "Nov" "Dec"))

(defun date-string ()
  (multiple-value-bind
        (second minute hour date month year day-of-week dst-p tz)
      (get-decoded-time)
    (format nil "~a ~a ~d ~2,'0d:~2,'0d:~2,'0d ~d"
            (nth day-of-week *day-names*)
            (nth (- month 1) *month-names*)
            date
            hour
            minute
            second
            year)))
--8<---------------cut here---------------end--------------->8---

Cheers,
Chris





reply via email to

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