all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* The align of time is not beautiful as 9.4 when I update to org 9.5.
@ 2021-09-30  4:53 tumashu
  2021-09-30 10:59 ` Ihor Radchenko
  2021-10-04  7:48 ` [PATCH] " Ihor Radchenko
  0 siblings, 2 replies; 11+ messages in thread
From: tumashu @ 2021-09-30  4:53 UTC (permalink / raw)
  To: emacs-orgmode


[-- 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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: The align of time is not beautiful as 9.4 when I update to org 9.5.
  2021-09-30  4:53 The align of time is not beautiful as 9.4 when I update to org 9.5 tumashu
@ 2021-09-30 10:59 ` Ihor Radchenko
  2021-09-30 11:19   ` Eric S Fraga
  2021-10-04  7:48 ` [PATCH] " Ihor Radchenko
  1 sibling, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2021-09-30 10:59 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: The align of time is not beautiful as 9.4 when I update to org 9.5.
  2021-09-30 10:59 ` Ihor Radchenko
@ 2021-09-30 11:19   ` Eric S Fraga
  0 siblings, 0 replies; 11+ messages in thread
From: Eric S Fraga @ 2021-09-30 11:19 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: tumashu, emacs-orgmode

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.
  2021-09-30  4:53 The align of time is not beautiful as 9.4 when I update to org 9.5 tumashu
  2021-09-30 10:59 ` Ihor Radchenko
@ 2021-10-04  7:48 ` Ihor Radchenko
  2021-10-04  9:52   ` Max Nikulin
  2021-10-04 10:55   ` tumashu
  1 sibling, 2 replies; 11+ messages in thread
From: Ihor Radchenko @ 2021-10-04  7:48 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-orgmode

[-- 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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.
  2021-10-04  7:48 ` [PATCH] " Ihor Radchenko
@ 2021-10-04  9:52   ` Max Nikulin
  2021-10-04 10:13     ` Nicolas Goaziou
  2021-10-04 10:55   ` tumashu
  1 sibling, 1 reply; 11+ messages in thread
From: Max Nikulin @ 2021-10-04  9:52 UTC (permalink / raw)
  To: emacs-orgmode

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.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.
  2021-10-04  9:52   ` Max Nikulin
@ 2021-10-04 10:13     ` Nicolas Goaziou
  2021-10-04 10:36       ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2021-10-04 10:13 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.
  2021-10-04 10:13     ` Nicolas Goaziou
@ 2021-10-04 10:36       ` Ihor Radchenko
  2021-10-06 12:48         ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2021-10-04 10:36 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Max Nikulin, emacs-orgmode

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re:[PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.
  2021-10-04  7:48 ` [PATCH] " Ihor Radchenko
  2021-10-04  9:52   ` Max Nikulin
@ 2021-10-04 10:55   ` tumashu
  2021-12-11  7:44     ` Ihor Radchenko
  1 sibling, 1 reply; 11+ messages in thread
From: tumashu @ 2021-10-04 10:55 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

















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
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.
  2021-10-04 10:36       ` Ihor Radchenko
@ 2021-10-06 12:48         ` Nicolas Goaziou
  0 siblings, 0 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2021-10-06 12:48 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Max Nikulin, emacs-orgmode

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re:[PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.
  2021-10-04 10:55   ` tumashu
@ 2021-12-11  7:44     ` Ihor Radchenko
  2021-12-18  8:15       ` Ihor Radchenko
  0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2021-12-11  7:44 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re:[PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.
  2021-12-11  7:44     ` Ihor Radchenko
@ 2021-12-18  8:15       ` Ihor Radchenko
  0 siblings, 0 replies; 11+ messages in thread
From: Ihor Radchenko @ 2021-12-18  8:15 UTC (permalink / raw)
  To: tumashu; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-12-18  8:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-30  4:53 The align of time is not beautiful as 9.4 when I update to org 9.5 tumashu
2021-09-30 10:59 ` Ihor Radchenko
2021-09-30 11:19   ` Eric S Fraga
2021-10-04  7:48 ` [PATCH] " Ihor Radchenko
2021-10-04  9:52   ` Max Nikulin
2021-10-04 10:13     ` Nicolas Goaziou
2021-10-04 10:36       ` Ihor Radchenko
2021-10-06 12:48         ` Nicolas Goaziou
2021-10-04 10:55   ` tumashu
2021-12-11  7:44     ` Ihor Radchenko
2021-12-18  8:15       ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.