I am interested in inserting custom dates using the calendar, I found Insert date using a calendar which turned out to be quite useful. Org calendar : change date language? seems to have no effect (I would also like to avoid setting the variable via seq
)
While this code works fine for English dates.
(defun my/org-insert-date-english ()
"Insert a date at point using `org-read-date' with its optional argument
of TO-TIME so that the user can customize the date format more easily."
(interactive)
(require 'org)
(let ((time (org-read-date nil 'to-time nil "Date: ")))
(insert (format-time-string "(W%W) (%a) %d %b %Y"
time))))
;; Inserts: (W19) (Thu) 16 May 2019
I was trying to modify it to get it work to insert dates in a different laguage than english.
My modifications below don't work but I am not sure why, could someone pin point what am I doing wrong?
(defun my/org-insert-date-german ()
"Insert a date at point using `org-read-date' with its optional argument
of TO-TIME so that the user can customize the date format more easily."
(interactive)
(require 'org)
(letf ((time (org-read-date nil 'to-time nil "Date: "))
(calendar-week-start-day 1)
(calendar-day-name-array ["Montag" "Dienstag" "Mittwoch" "Donnerstag"
"Freitag" "Samstag" "Sonntag"])
(calendar-month-name-array ["Januar" "Februar" "März" "April" "Mai" "Juni"
"Juli" "August" "September" "Oktober" "November"
"Dezember"]))
(insert (format-time-string "(KW%W) (%a) %d. %b %Y"
time))))
;; Inserts: (KW19) (Thu) 16. May 2019
;; Desired: (KW19) (Donnerstag) 16. Mai 2019
Notes: - Using Emacs 26.2