# HG changeset patch # User Uwe Brauer # Date 1501599726 0 # Tue Aug 01 15:02:06 2017 +0000 # Node ID c3dcbf6fe34f347333a8f2e6561cbaf419d9e41a # Parent e7bbf50d624b450f5a9ac77abdbfc82b18245764 Add org-time-stamp-formats to TeX-arg-date. * latex.el (TeX-arg-date-use-orgmode): new variable. (TeX-arg-date): Modify the function and allow to use org-time-stamp-formats to insert a date into the \date macro. diff --git a/latex.el b/latex.el --- a/latex.el +++ b/latex.el @@ -2558,17 +2558,26 @@ :group 'LaTeX-macro :type 'string) + +(defvar TeX-arg-date-use-orgmode nil + "Use `org-time-stamp' instead of the simple built in date TeX date function. Default + is `nil'.") + + (defun TeX-arg-date (optional &optional prompt) "Prompt for a date, defaulting to the current date. If OPTIONAL is non-nil, insert the resulting value as an optional argument, otherwise as a mandatory one. Use PROMPT as the prompt string." - (let ((default (format-time-string TeX-date-format (current-time)))) - (TeX-argument-insert - (TeX-read-string (TeX-argument-prompt - optional prompt (format "Date (default %s)" default)) - nil nil default) - optional))) + (if TeX-arg-date-use-orgmode + (let ((org-time-stamp-formats '("%d-%m-%Y" . "%d-%m-%Y %H:%M"))) + (concat (insert "{") (org-time-stamp nil) (insert "}"))) + (let ((default (format-time-string TeX-date-format (current-time)))) + (TeX-argument-insert + (TeX-read-string (TeX-argument-prompt + optional prompt (format "Date (default %s)" default)) + nil nil default) + optional)))) (defun TeX-arg-version (optional &optional prompt) "Prompt for the version of a file.