emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Gautier Ponsinet <gautier@gautierponsinet.xyz>
To: emacs-orgmode@gnu.org
Subject: Date prompt and parse-time variables
Date: Sat, 12 Oct 2024 12:02:57 +0300	[thread overview]
Message-ID: <87r08lk81q.fsf@gautierponsinet.xyz> (raw)

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

             reply	other threads:[~2024-10-12  9:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-12  9:02 Gautier Ponsinet [this message]
2024-11-03 18:13 ` Date prompt and parse-time variables Ihor Radchenko
2024-11-03 21:10   ` Gautier Ponsinet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r08lk81q.fsf@gautierponsinet.xyz \
    --to=gautier@gautierponsinet.xyz \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).