tumashu <tuma...@163.com> writes:

> Hello:
>
>
> When I update to org 9.5,  I find that  the align of time like "7:00" has 
> been changed.
>
> I think the new style is not beautiful as old style.
>  
> 1. New style look like not align to  the first char, for the width of 9 looks 
> like > 1
> 2. the old style is align ":"

The attached patch should fix the issue. Please, test it though. I do
not use time grid regularly.

Best,
Ihor

>From df5c35bd84e1d343c52c605c2c77393fb11ad590 Mon Sep 17 00:00:00 2001
Message-Id: <df5c35bd84e1d343c52c605c2c77393fb11ad590.1633333631.git.yanta...@gmail.com>
From: Ihor Radchenko <yanta...@gmail.com>
Date: Mon, 4 Oct 2021 15:45:16 +0800
Subject: [PATCH] org-agenda: Make sure that time grid is aligned when hour <10

* lisp/org-agenda.el (org-agenda-format-item): Make sure that hour
part of begin time in time grid always occupy 5 chars

Fixes https://list.orgmode.org/orgmode/3afe1bba.2f48.17c350d0a41.coremail.tuma...@163.com/
---
 lisp/org-agenda.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 354f40867..e20d0225f 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6765,7 +6765,7 @@         (defvar level) (defvar tag) (defvar time))
 	    (setq duration (- (org-duration-to-minutes s2)
 			      (org-duration-to-minutes s1))))
           ;; Format S1 and S2 for display.
-	  (when s1 (setq s1 (org-get-time-of-day s1 'overtime)))
+	  (when s1 (setq s1 (format "%05s" (org-get-time-of-day s1 'overtime))))
 	  (when s2 (setq s2 (org-get-time-of-day s2 'overtime))))
 	(when (string-match org-tag-group-re txt)
 	  ;; Tags are in the string
-- 
2.32.0

Reply via email to