Re:[PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.

2021-12-18 Thread Ihor Radchenko
Ihor Radchenko  writes:

> If you have no objections to the patch, I will apply it next week with
> suggestion from Max.

Applied to bugfix as 85aaa1990



Re:[PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.

2021-12-10 Thread Ihor Radchenko
tumashu   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



Re: [PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.

2021-10-06 Thread Nicolas Goaziou
Hello,

Ihor Radchenko  writes:

> Nicolas Goaziou  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



Re:[PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.

2021-10-04 Thread tumashu
















At 2021-10-04 15:48:49, "Ihor Radchenko"  wrote:
>tumashu  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
>


Re: [PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.

2021-10-04 Thread Ihor Radchenko
Nicolas Goaziou  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



Re: [PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.

2021-10-04 Thread Nicolas Goaziou
Hello,

Max Nikulin  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



Re: [PATCH] The align of time is not beautiful as 9.4 when I update to org 9.5.

2021-10-04 Thread Max Nikulin

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.