monnier pushed a commit to branch externals/auctex
in repository elpa.
commit 81fb5151e46662b72439d3cb039fd44585f102a4
Author: Mosè Giordano <[email protected]>
Date: Tue Apr 16 16:04:52 2013 +0200
Use user-full-name as initial input to author macro.
* latex.el (LaTeX-default-author): New customizable variable.
(LaTeX-arg-author): New function.
(LaTeX-common-initialization): Use `LaTeX-arg-author' for the
\author macro.
* doc/auctex.texi (Adding Macros): Document `LaTeX-arg-author'.
Mention `LaTeX-default-author' option.
---
ChangeLog | 10 ++++++++--
doc/auctex.texi | 5 +++++
latex.el | 21 ++++++++++++++++++++-
3 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4409695..5cdc377 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,19 @@
2013-04-16 Mos� Giordano <[email protected]>
+ * latex.el (LaTeX-default-author): New customizable variable.
+ (LaTeX-arg-author): New function.
+ (LaTeX-common-initialization): Use `LaTeX-arg-author' for the
+ \author macro.
+
* doc/auctex.texi (Itemize-like): Document `TeX-arg-item-label-p'
option.
(Tabular-like): Document `LaTeX-default-width' option.
(Modes and Hooks): Add modes and hooks to indices.
(Adding Macros): Document `TeX-arg-index-tag', `TeX-arg-index',
`TeX-arg-document', `LaTeX-arg-usepackage', `TeX-arg-bibstyle',
- `TeX-arg-bibliography', `TeX-read-key-val', and `TeX-arg-key-val'
- functions. Mention `TeX-arg-cite-note-p' option.
+ `TeX-arg-bibliography', `LaTeX-arg-author', `TeX-read-key-val',
+ and `TeX-arg-key-val' functions. Mention `TeX-arg-cite-note-p'
+ and `LaTeX-default-author' options.
(Adding Environments): Use in example code actually present in
`listings.el' file.
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 7b8a526..fbf37fb 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -4095,6 +4095,11 @@ Insert width and height as a pair. No arguments.
@item TeX-arg-coordinate
Insert x and y coordinates as a pair. No arguments.
+@item LaTeX-arg-author
+@vindex LaTeX-default-author
+Prompt for document author, using @code{LaTeX-default-author} as initial
+input.
+
@item TeX-read-key-val
Prompt for a key=value list of options and return them.
diff --git a/latex.el b/latex.el
index 5bfb5df..d647bba 100644
--- a/latex.el
+++ b/latex.el
@@ -2196,6 +2196,25 @@ string."
TeX-left-right-braces)))
(indent-according-to-mode)))))
+(defcustom LaTeX-default-author user-full-name
+ "Initial input to `LaTeX-arg-author' prompt.
+If nil, do not prompt at all."
+ :group 'LaTeX-macro
+ :type '(choice (const :tag "Do not prompt" nil)
+ string))
+
+(defun LaTeX-arg-author (optional &optional prompt)
+ "Prompt for author name.
+Insert the given value as a TeX macro argument. If OPTIONAL is
+non-nil, insert it as an optional argument. Use PROMPT as the
+prompt string. `LaTeX-default-author' is the initial input."
+ (let ((author (if LaTeX-default-author
+ (read-string
+ (TeX-argument-prompt optional prompt "Author(s)")
+ LaTeX-default-author)
+ "")))
+ (TeX-argument-insert author optional nil)))
+
(defun TeX-read-key-val (optional key-val-alist &optional prompt)
"Prompt for keys and values in KEY-VAL-ALIST and return them.
If OPTIONAL is non-nil, indicate in the prompt that we are
@@ -5557,7 +5576,7 @@ i.e. you do _not_ have to cater for this yourself by
adding \\\\' or $."
'("acute" t) '("grave" t) '("ddot" t) '("tilde" t) '("bar" t)
'("breve" t) '("check" t) '("hat" t) '("vec" t) '("dot" t)
'("widetilde" t) '("widehat" t)
- '("author" t)
+ '("author" LaTeX-arg-author)
'("date" TeX-arg-date)
'("thanks" t)
'("title" t)