[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-devel] use optional org-time-stamp for TeX macro date (TeX-arg-d
From: |
Uwe Brauer |
Subject: |
[AUCTeX-devel] use optional org-time-stamp for TeX macro date (TeX-arg-date) |
Date: |
Fri, 28 Jul 2017 15:40:27 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Hi
I would like to use, optionally, org-time-stamp instead of the vanilla
TeX-arg-date. The advantate is that the calendar is called in it is easy
to select an appropriate date.
So I came up with this
(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."
(if TeX-arg-date-use-orgmode
(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))))
(I can send a patch if needed)
But I must admit that the implementation is very crude. Org-time-stamp
inserts
\date{<2017-07-13 Thu>}
Which is a bit ugly, that format can be changed but as I learned form
the orgmode list
,----
| Custom format time are applied during fontification time. The major mode
| you're using in your LaTeX document doesn't know about Org fontification
| rules.
|
| You may want to add some rules to font lock there
`----
So that is a bit though.
Any suggestions?
Uwe Brauer
- [AUCTeX-devel] use optional org-time-stamp for TeX macro date (TeX-arg-date),
Uwe Brauer <=