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

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to