emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Setting org-agenda-time-grid: My day starts at midnight


From: Memnon Anon
Subject: [Orgmode] Setting org-agenda-time-grid: My day starts at midnight
Date: Thu, 19 Aug 2010 08:17:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hi,

I am working nightshifts these days, so I wanted this:

,----
| (setq org-agenda-time-grid (quote 
|       ((daily weekly today require-timed) "----------------" 
|       ( 000 200 400 600 800 1000 1200 1400 1600 1800 2000 2200 2359))))
`----

which ... did not work.

Afaics, the reason is in org-agenda-add-time-grid-maybe:

--8<---------------cut here---------------start------------->8---
      (while (setq time (pop gridtimes))
        (unless (and remove (member time have))
=>        (setq time (int-to-string time))
          (push (org-format-agenda-item
                 nil string "" nil
=>               (concat (substring time 0 -2) ":" (substring time -2)))
                new)
          (put-text-property
           1 (length (car new)) 'face 'org-time-grid (car new))))
--8<---------------cut here---------------end--------------->8---

(setq time (int-to-string time)) => time= "0", so
(substring time 0 -2) => args-out-of-range.

I added one line:
--8<---------------cut here---------------start------------->8---
          (unless (and remove (member time have))
            (setq time (int-to-string time))
;;MAN make sure time is at least 3 characters long or substring will fail
=>          (when (< (length time) 3) (setq time (concat "00" time)))  
            (push (org-format-agenda-item
--8<---------------cut here---------------end--------------->8---

and it seems to work: I used it for the last hours and found no problem.

So you elisp gurus out there:

a) Will this break anything I am not aware of yet?
b) Is there a better way to achieve this?

Memnon 'Rock around the clock' Anon



reply via email to

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