[-- Attachment #1.1: Type: text/plain, Size: 278 bytes --] 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 ":" Feng. [-- Attachment #1.2: Type: text/html, Size: 650 bytes --] [-- Attachment #2: 截图_2021-09-30_12-38-41.png --] [-- Type: image/png, Size: 17550 bytes --] [-- Attachment #3: I prefer.png --] [-- Type: image/png, Size: 14532 bytes --]
tumashu <tumashu@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 ":" It has been reported in https://orgmode.org/list/87czr6uhhk.fsf@alphapapa.net However, the problem is not reproducible. Are you able to provide a recipe? Best, Ihor
On Thursday, 30 Sep 2021 at 18:59, Ihor Radchenko wrote: > However, the problem is not reproducible. Are you able to provide a > recipe? For the record, I see the same as the OP: alignment on the first character of the time string, not on the :. However, my org is not quite up to date and don't wish to update it right now as busy preparing teaching materials for start of the teaching term! (they're all written in org mode, of course) -- : Eric S Fraga via Emacs 28.0.50, Org 9.5-g9a4a24 : Latest paper written in org: https://arxiv.org/abs/2106.05096
[-- Attachment #1: Type: text/plain, Size: 433 bytes --] tumashu <tumashu@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 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org-agenda-Make-sure-that-time-grid-is-aligned-when-.patch --] [-- Type: text/x-diff, Size: 1240 bytes --] From df5c35bd84e1d343c52c605c2c77393fb11ad590 Mon Sep 17 00:00:00 2001 Message-Id: <df5c35bd84e1d343c52c605c2c77393fb11ad590.1633333631.git.yantar92@gmail.com> From: Ihor Radchenko <yantar92@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.tumashu@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
On 04/10/2021 14:48, Ihor Radchenko wrote: > tumashu writes: >> >> 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. > - (when s1 (setq s1 (org-get-time-of-day s1 'overtime))) > + (when s1 (setq s1 (format "%05s" (org-get-time-of-day s1 'overtime)))) I think, "%5s" is enough, flag "0" does not anything useful for strings.
Hello,
Max Nikulin <manikulin@gmail.com> writes:
> On 04/10/2021 14:48, Ihor Radchenko wrote:
>> tumashu writes:
>>>
>>> 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.
>
>> - (when s1 (setq s1 (org-get-time-of-day s1 'overtime)))
>> + (when s1 (setq s1 (format "%05s" (org-get-time-of-day s1 'overtime))))
>
> I think, "%5s" is enough, flag "0" does not anything useful for
> strings.
Also, the fix belongs to `org-get-time-of-day', which is also
responsible for formatting the output.
Regards,
--
Nicolas Goaziou
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>> I think, "%5s" is enough, flag "0" does not anything useful for
>> strings.
>
> Also, the fix belongs to `org-get-time-of-day', which is also
> responsible for formatting the output.
I doubt so. `org-get-time-of-day' is used to format ending time in time
ranges. If we force fixed width in `org-get-time-of-day', we may have
something like " 8:00- 9:00" instead of " 8:00-9:00". On the other
hand, the current behaviour for non-nil org-agenda-timegrid-use-ampm, we
already have "8am- 9am" even without the patch.
WDYT?
Best,
Ihor
At 2021-10-04 15:48:49, "Ihor Radchenko" <yantar92@gmail.com> wrote: >tumashu <tumashu@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. If change s1, I think s2 should be deal with too, by the way, what about change the below function? ``` (defun org-agenda-time-of-day-to-ampm-maybe (time) "Conditionally convert TIME to AM/PM format. This is based on `org-agenda-timegrid-use-ampm'." (if org-agenda-timegrid-use-ampm (org-agenda-time-of-day-to-ampm time) time)) ^^^ ``` Another way is creating a new function for the below code, so user can advice it to full control time string format. ``` (cond (s2 (concat (org-agenda-time-of-day-to-ampm-maybe s1) "-" (org-agenda-time-of-day-to-ampm-maybe s2) (when org-agenda-timegrid-use-ampm " "))) (s1 (concat (org-agenda-time-of-day-to-ampm-maybe s1) (if org-agenda-timegrid-use-ampm (concat time-grid-trailing-characters " ") time-grid-trailing-characters))) (t "")) ``` > >Best, >Ihor >
Hello,
Ihor Radchenko <yantar92@gmail.com> writes:
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> Also, the fix belongs to `org-get-time-of-day', which is also
>> responsible for formatting the output.
>
> I doubt so. `org-get-time-of-day' is used to format ending time in time
> ranges. If we force fixed width in `org-get-time-of-day', we may have
> something like " 8:00- 9:00" instead of " 8:00-9:00". On the other
> hand, the current behaviour for non-nil org-agenda-timegrid-use-ampm, we
> already have "8am- 9am" even without the patch.
>
> WDYT?
Fair enough. I think I should not even try to understand
"org-agenda.el".
Regards,
--
Nicolas Goaziou
tumashu <tumashu@163.com> writes:
> Another way is creating a new function for the below code, so user can advice it to full control time string format.
It is technically possible. However, to be frank, org-agenda code is
too much mess to introduce yet another function or customisation. I am
reluctant to do anything more than bug fixing until we refactor
org-agenda.el to something more maintainable.
If you have no objections to the patch, I will apply it next week with
suggestion from Max.
Best,
Ihor
Ihor Radchenko <yantar92@gmail.com> writes:
> If you have no objections to the patch, I will apply it next week with
> suggestion from Max.
Applied to bugfix as 85aaa1990