Hi Uwe, >>>>> Uwe Brauer <o...@mat.ucm.es> writes: > 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? The actual job of inserting timestamp is carried out by `org-insert-time-stamp', which begins with (let ((fmt (funcall (if with-hm 'cdr 'car) org-time-stamp-formats)) , and the value of `org-time-stamp-formats' is ("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>") at least for emacs 25.2. So I suppose binding `org-time-stamp-formats' temporarily with `let' in your custom `TeX-arg-date' would do the trick. Bye, Ikumi Keita _______________________________________________ auctex-devel mailing list auctex-devel@gnu.org https://lists.gnu.org/mailman/listinfo/auctex-devel