0

If time is 08:00, emacs should display 33.3% in modeline

and show 80.0% when time is 19:12.

How can I do this in .emacs? thanks very much.

algorithm is current-time/24.

2 Answers 2

3

As @phils says, you can override the custom setting “Display Time String Forms”. In particular:

Go to the “Display Time” customization group and change the value of the “Display Time String Forms” setting to:

((format "%.1f%%"
   (* 100 (/ (+ (* (string-to-number 24-hours) 3600)
                (* (string-to-number minutes) 60)
                (string-to-number seconds))
             86400.0)))
)
1
  • exactly what I want, thanks very much. It works well. Should seed you two guys cakes before Christmas ;-)
    – ryrd
    Dec 5, 2013 at 2:09
0

If you want display-time-mode to display the time in this way, you should look into the display-time-string-forms variable, which will enable you to perform any arbitrary processing. I don't think any of the simpler customisations provide for this particular approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.