emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Date prompt and parse-time variables
@ 2024-10-12  9:02 Gautier Ponsinet
  2024-11-03 18:13 ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Gautier Ponsinet @ 2024-10-12  9:02 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

Hello everyone,

The org manual recommends to configure the variables parse-time-months
and parse-time-weekdays in order to use another language than English in
the time/date prompt. However, this can create conflict with other
functionality. For instance, it conflicts with the elfeed news reader
package.

Maybe, the org manual could also recommand to limit the effect of the
configuration of the parse-time variables by advising certain org
functions for the date prompt? (Looking at the code it seems that is
enough to advise the function org-read-date. Currently, I have the code
attached to this mail in my init file which seems to do the trick.)

Or, there could exist org specific variables org-parse-time-months and
org-parse-time-weekdays.

What do you all think?

All the best,
Gautier.

[-- Attachment #2: org-parse-time.el --]
[-- Type: text/plain, Size: 1149 bytes --]

(require 'parse-time)

(defun parse-time-fr (f &rest args)
  "Call the function F with arguments ARGS with `parse-time-months' and
`parse-time-weekdays' set to unaccented French."
  (let ((parse-time-months '(("jan" . 1)
			     ("fev" . 2)
			     ("mar" . 3)
			     ("avr" . 4)
			     ("mai" . 5)
			     ("jun" . 6)
			     ("jul" . 7)
			     ("aou" . 8)
			     ("sep" . 9)
			     ("oct" . 10)
			     ("nov" . 11)
			     ("dec" . 12)
			     ("janvier" . 1)
			     ("fevrier" . 2)
			     ("mars" . 3)
			     ("avril" . 4)
			     ("mai" . 5)
			     ("juin" . 6)
			     ("juillet" . 7)
			     ("aout" . 8)
			     ("septembre" . 9)
			     ("octobre" . 10)
			     ("novembre" . 11)
			     ("decembre" . 12)))
	(parse-time-weekdays '(("dim" . 0)
			       ("lun" . 1)
			       ("mar" . 2)
			       ("mer" . 3)
			       ("jeu" . 4)
			       ("ven" . 5)
			       ("sam" . 6)
			       ("dimanche" . 0)
			       ("lundi" . 1)
			       ("mardi" . 2)
			       ("mercredi" . 3)
			       ("jeudi" . 4)
			       ("vendredi" . 5)
			       ("samedi" . 6))))
    (apply f args)))

(advice-add 'org-read-date :around #'parse-time-fr)

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

* Re: Date prompt and parse-time variables
  2024-10-12  9:02 Date prompt and parse-time variables Gautier Ponsinet
@ 2024-11-03 18:13 ` Ihor Radchenko
  2024-11-03 21:10   ` Gautier Ponsinet
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2024-11-03 18:13 UTC (permalink / raw)
  To: Gautier Ponsinet; +Cc: emacs-orgmode

Gautier Ponsinet <gautier@gautierponsinet.xyz> writes:

> The org manual recommends to configure the variables parse-time-months
> and parse-time-weekdays in order to use another language than English in
> the time/date prompt. However, this can create conflict with other
> functionality. For instance, it conflicts with the elfeed news reader
> package.

You do not have to replace the month names in that variable. You may
instead leave the English mappings, adding your non-English names as
extra.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: Date prompt and parse-time variables
  2024-11-03 18:13 ` Ihor Radchenko
@ 2024-11-03 21:10   ` Gautier Ponsinet
  0 siblings, 0 replies; 3+ messages in thread
From: Gautier Ponsinet @ 2024-11-03 21:10 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Hello Ihor,

Ihor Radchenko <yantar92@posteo.net> [2024-11-03 18:13 +0000]:
> You do not have to replace the month names in that variable. You may
> instead leave the English mappings, adding your non-English names as
> extra.

Oh! You are absolutely right, and I had completely missed the point
here. Thank you very much!

All the best,
Gautier.


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

end of thread, other threads:[~2024-11-03 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-12  9:02 Date prompt and parse-time variables Gautier Ponsinet
2024-11-03 18:13 ` Ihor Radchenko
2024-11-03 21:10   ` Gautier Ponsinet

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).