emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Date prompt and parse-time variables
@ 2024-10-12  9:02 Gautier Ponsinet
  0 siblings, 0 replies; only message 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] only message in thread

only message in thread, other threads:[~2024-10-12  9:03 UTC | newest]

Thread overview: (only message) (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

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).