Re: CSV agenda export formats some day and month values as single digits

2022-12-27 Thread Ihor Radchenko
Max Nikulin  writes:

>> The reason I suggest using the default value is that
>> `calendar-iso-date-display-form' is a defcustom.
>
> Thank you, I did not noticed that it is a user option. I should think 
> more on this. If a user has a reason to override the ISO format, perhaps 
> it should be respected in some way.

It will not be very obvious that calendar-related customization will
affect agenda export. If we want to allow customizing csv export format,
we need to introduce agenda-specific customization instead.

I suggest keeping this as a constant for now and provide a defcustom if
there is interest. There haven't been any until now, including this
report, which merely pointed to a bug.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: CSV agenda export formats some day and month values as single digits

2022-12-26 Thread Max Nikulin

On 26/12/2022 17:34, Ihor Radchenko wrote:

Max Nikulin writes:

(let ((calendar-date-display-form calendar-iso-date-display-form))

...

The reason I suggest using the default value is that
`calendar-iso-date-display-form' is a defcustom.


Thank you, I did not noticed that it is a user option. I should think 
more on this. If a user has a reason to override the ISO format, perhaps 
it should be respected in some way.





Re: CSV agenda export formats some day and month values as single digits

2022-12-26 Thread Ihor Radchenko
Max Nikulin  writes:

> On 26/12/2022 16:23, Ihor Radchenko wrote:
>> 
>> Fixed on bugfix now.
>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9c79aedec
>
> I have never heard about `calendar-date-display' before so I am curious 
> under which circumstances the following will not work:
>
> (let ((calendar-date-display-form calendar-iso-date-display-form))

Your variant should also work, and it is more concise. Could you make it
into a patch? But not using the variable. Rather, the default value.

The reason I suggest using the default value is that
`calendar-iso-date-display-form' is a defcustom. There is no reason why
agenda export should depend on changed custom setting here.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: CSV agenda export formats some day and month values as single digits

2022-12-26 Thread Max Nikulin

On 26/12/2022 16:23, Ihor Radchenko wrote:


Fixed on bugfix now.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9c79aedec


I have never heard about `calendar-date-display' before so I am curious 
under which circumstances the following will not work:


(let ((calendar-date-display-form calendar-iso-date-display-form))




Re: CSV agenda export formats some day and month values as single digits

2022-12-26 Thread Ihor Radchenko
[Adding Org mailing list back to CC]

"David O'Toole"  writes:

> Here is a script and some files that reproduce the issue for me in a fresh
> "emacs -Q".
>
> csv-test.el  --- the test script
> csv-test.org --- the file to pull agenda items from
> csv-test.csv --- the output

Thanks!
Fixed on bugfix now.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9c79aedec

> GNU Emacs 29.0.60 (build 2, x86_64-pc-linux-gnu, GTK+ Version
> 3.24.33, cairo version 1.16.0) of 2022-12-04
>
> Org mode version 9.6 (release_9.6-3-ga4d38e @
> /usr/local/share/emacs/29.0.60/lisp/org/)
>
>
>
> On Sun, Dec 25, 2022 at 9:37 AM David O'Toole 
> wrote:
>
>> Sure, I'll follow up with steps to reproduce it, and I'll include the
>> output as an attachment.
>>
>> On Sun, Dec 25, 2022 at 7:57 AM Ihor Radchenko 
>> wrote:
>>
>>> "David O'Toole"  writes:
>>>
>>> > CSV export for the agenda is formatting January 1, 2023 as "2023-1-1"
>>> and
>>> > not "2023-01-01".
>>> > The raw output is here: https://pastebin.com/raw/EyN1JbhP
>>>
>>> Could you please provide detailed steps how to obtain the erroneous CSV
>>> output? See https://orgmode.org/manual/Feedback.html#Feedback
>>>
>>> Note that pastebin is not available in all countries. If you can, please
>>> send the code/text right in the email as an attachment. This is more
>>> sustainable for future readers.
>>>
>>> --
>>> Ihor Radchenko // yantar92,
>>> Org mode contributor,
>>> Learn more about Org mode at .
>>> Support Org development at ,
>>> or support my work at 
>>>
>>
> csv-test,Task 1,scheduled,TODO,,2022-12-25,,Scheduled:,,1099,2022-12-25
> csv-test,Task 2,scheduled,TODO,,2022-12-26,,Scheduled:,,1099,2022-12-26
> csv-test,Task 3,scheduled,TODO,,2023-1-1,,Scheduled:,,1099,2023-1-1
> ;; GNU Emacs 29.0.60 (build 2, x86_64-pc-linux-gnu, GTK+ Version
> ;; 3.24.33, cairo version 1.16.0) of 2022-12-04
>
> ;; Org mode version 9.6 (release_9.6-3-ga4d38e @
> ;; /usr/local/share/emacs/29.0.60/lisp/org/)
>
> ;; started with "emacs -Q"
>
> (defun capture-csv ()
>   (save-excursion 
> (with-output-to-string
>   "*csv*"
>   (org-batch-agenda-csv "a"
> org-agenda-span 10
> org-agenda-include-inactive-timestamps t
> org-agenda-skip-timestamp-if-done nil
> org-agenda-show-all-dates t
> org-agenda-skip-scheduled-if-done nil
>
> (setq org-agenda-files '("~/csv-test.org"))
>
> (let ((buffer (get-buffer-create "*csv*")))
>   (switch-to-buffer buffer)
>   (save-window-excursion
> (insert (capture-csv
>
>
>

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: CSV agenda export formats some day and month values as single digits

2022-12-25 Thread Ihor Radchenko
"David O'Toole"  writes:

> CSV export for the agenda is formatting January 1, 2023 as "2023-1-1" and
> not "2023-01-01".
> The raw output is here: https://pastebin.com/raw/EyN1JbhP

Could you please provide detailed steps how to obtain the erroneous CSV
output? See https://orgmode.org/manual/Feedback.html#Feedback

Note that pastebin is not available in all countries. If you can, please
send the code/text right in the email as an attachment. This is more
sustainable for future readers.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



CSV agenda export formats some day and month values as single digits

2022-12-23 Thread David O'Toole
Version: Org mode version 9.6 (release_9.6-3-ga4d38e @
/usr/local/share/emacs/29.0.60/lisp/org/)

CSV export for the agenda is formatting January 1, 2023 as "2023-1-1" and
not "2023-01-01".
The raw output is here: https://pastebin.com/raw/EyN1JbhP

The last two lines both have "2023-1-1".
This is incorrect because:

Expression: (format-time-string "%04Y-%02m-%02d" (date-to-time "2023-1-1"))
Result: "1999-12-31"