monnier pushed a commit to branch externals/auctex
in repository elpa.
commit e9e8057f086b56a9642dba792648e09835bbb00a
Author: Tassilo Horn <[email protected]>
Date: Mon Mar 4 09:26:50 2013 +0000
* latex.el (TeX-arg-date): New function.
(LaTeX-common-initialization): Use `TeX-arg-date' for \date macro.
* doc/auctex.texi: Document `TeX-arg-date'.
* style/doc.el ("doc"): Use `TeX-arg-date' for the \changes macro.
---
ChangeLog | 9 +++++++++
doc/auctex.texi | 3 +++
latex.el | 14 +++++++++++++-
style/doc.el | 2 +-
4 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 50558c3..6ec462c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-03-04 Tassilo Horn <[email protected]>
+
+ * latex.el (TeX-arg-date): New function.
+ (LaTeX-common-initialization): Use `TeX-arg-date' for \date macro.
+
+ * doc/auctex.texi: Document `TeX-arg-date'.
+
+ * style/doc.el ("doc"): Use `TeX-arg-date' for the \changes macro.
+
2013-02-26 Tassilo Horn <[email protected]>
* tex.el (TeX-run-style-hooks): Guard running style hooks in a
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 309f3c7..61609df 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -3961,6 +3961,9 @@ Prompt for a @LaTeX{} length completing with known
lengths.
@item TeX-arg-macro
Prompt for a @TeX{} macro with completion.
+@item TeX-arg-date
+Prompt for a date, defaulting to the current date.
+
@item TeX-arg-environment
Prompt for a @LaTeX{} environment with completion.
diff --git a/latex.el b/latex.el
index 724936b..41de1b2 100644
--- a/latex.el
+++ b/latex.el
@@ -1980,6 +1980,18 @@ string."
nil t)
optional))
+(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 "%Y/%m/%d" (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-pagestyle (optional &optional prompt definition)
"Prompt for a LaTeX pagestyle with completion.
If OPTIONAL is non-nil, insert the resulting value as an optional
@@ -5461,7 +5473,7 @@ i.e. you do _not_ have to cater for this yourself by
adding \\\\' or $."
'("breve" t) '("check" t) '("hat" t) '("vec" t) '("dot" t)
'("widetilde" t) '("widehat" t)
'("author" t)
- '("date" t)
+ '("date" TeX-arg-date)
'("thanks" t)
'("title" t)
'("pagenumbering" (TeX-arg-eval
diff --git a/style/doc.el b/style/doc.el
index b342d87..e45f0f7 100644
--- a/style/doc.el
+++ b/style/doc.el
@@ -119,7 +119,7 @@
"efill"
"pfill"
"PrintIndex"
- '("changes" "version" "date (YYYY/MM/DD)")
+ '("changes" "version" TeX-arg-date t)
"generalname"
"RecordChanges"
"GlossaryPrologue"