From mboxrd@z Thu Jan 1 00:00:00 1970 From: Memnon Anon Subject: Setting org-agenda-time-grid: My day starts at midnight Date: Thu, 19 Aug 2010 08:17:38 +0200 Message-ID: <874oerjgef.fsf@mean.albasani.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=42616 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OlyRc-0002dn-4B for emacs-orgmode@gnu.org; Thu, 19 Aug 2010 02:17:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OlyRb-0003l9-46 for emacs-orgmode@gnu.org; Thu, 19 Aug 2010 02:17:44 -0400 Received: from mail-bw0-f41.google.com ([209.85.214.41]:34316) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OlyRa-0003l3-Uy for emacs-orgmode@gnu.org; Thu, 19 Aug 2010 02:17:43 -0400 Received: by bwz6 with SMTP id 6so1410153bwz.0 for ; Wed, 18 Aug 2010 23:17:41 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode 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