emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 185/299: Add completion for ProvidesPackage, ProvidesClass, and P


From: Stefan Monnier
Subject: [elpa] 185/299: Add completion for ProvidesPackage, ProvidesClass, and ProvidesFile.
Date: Sun, 02 Nov 2014 03:11:19 +0000

monnier pushed a commit to branch externals/auctex
in repository elpa.

commit 7414b46c182074b5499331dca8606cd635d10e92
Author: Mosè Giordano <address@hidden>
Date:   Sat Oct 19 17:11:28 2013 +0200

    Add completion for ProvidesPackage, ProvidesClass, and ProvidesFile.
    
    * latex.el (TeX-arg-file-name): New function.
    (TeX-arg-file-name-sans-extension): Ditto.
    (TeX-arg-version): Ditto.
    (LaTeX-common-initialization): Add completion for
    `ProvidesPackage', `ProvidesClass', and `ProvidesFile'.
    
    * doc/auctex.texi (Adding Macros): Document `TeX-arg-version',
    `TeX-arg-file-name', and `TeX-arg-file-name-sans-extension'.
---
 ChangeLog       |   11 +++++++++++
 doc/auctex.texi |   12 ++++++++++++
 latex.el        |   43 ++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 65 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 422f7ee..570fafe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-10-19  Mos� Giordano  <address@hidden>
+
+       * latex.el (TeX-arg-file-name): New function.
+       (TeX-arg-file-name-sans-extension): Ditto.
+       (TeX-arg-version): Ditto.
+       (LaTeX-common-initialization): Add completion for
+       `ProvidesPackage', `ProvidesClass', and `ProvidesFile'.
+
+       * doc/auctex.texi (Adding Macros): Document `TeX-arg-version',
+       `TeX-arg-file-name', and `TeX-arg-file-name-sans-extension'.
+
 2013-10-14  Tassilo Horn  <address@hidden>
 
        * doc/changes.texi: Mention the enhanced tabular indentation.
diff --git a/doc/auctex.texi b/doc/auctex.texi
index b664602..f3b6b41 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -4188,6 +4188,10 @@ Prompt for a @TeX{} macro with completion.
 @item TeX-arg-date
 Prompt for a date, defaulting to the current date.
 
address@hidden TeX-arg-version
+Prompt for the version of a file, using as initial input the current
+date.
+
 @item TeX-arg-environment
 Prompt for a @LaTeX{} environment with completion.
 
@@ -4206,6 +4210,14 @@ Prompt for a @LaTeX{} savebox completing with known 
saveboxes.
 Prompt for a filename in the current directory, and use it without the
 extension.
 
address@hidden TeX-arg-file-name
+Prompt for a filename and use as initial input the name of the file
+being visited in the current buffer, with extension.
+
address@hidden TeX-arg-file-name-sans-extension
+Prompt for a filename and use as initial input the name of the file
+being visited in the current buffer, without extension.
+
 @item TeX-arg-input-file
 @vindex TeX-arg-input-file-search
 Prompt for the name of an input file in @TeX{}'s search path, and use it
diff --git a/latex.el b/latex.el
index 2d28859..98d15a0 100644
--- a/latex.el
+++ b/latex.el
@@ -1708,6 +1708,29 @@ string."
                                       "" "" nil)
                       optional))
 
+(defun TeX-arg-file-name (optional &optional prompt)
+  "Prompt for a file name.
+Initial input is the name of the file being visited in the
+current buffer, with extension.  If OPTIONAL is non-nil, insert
+it as an optional argument.  Use PROMPT as the prompt string."
+  (TeX-argument-insert
+   (TeX-read-string
+    (TeX-argument-prompt optional prompt "Name")
+    (file-name-nondirectory buffer-file-name))
+   optional))
+
+(defun TeX-arg-file-name-sans-extension (optional &optional prompt)
+  "Prompt for a file name.
+Initial input is the name of the file being visited in the
+current buffer, without extension.  If OPTIONAL is non-nil,
+insert it as an optional argument.  Use PROMPT as the prompt
+string."
+  (TeX-argument-insert
+   (TeX-read-string
+    (TeX-argument-prompt optional prompt "Name")
+    (file-name-sans-extension (file-name-nondirectory buffer-file-name)))
+   optional))
+
 (defun TeX-arg-define-label (optional &optional prompt)
   "Prompt for a label completing with known labels.
 If OPTIONAL is non-nil, insert the resulting value as an optional
@@ -2085,6 +2108,16 @@ string."
                      nil nil default)
      optional)))
 
+(defun TeX-arg-version (optional &optional prompt)
+  "Prompt for the version of a file.
+Use as initial input 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."
+  (TeX-argument-insert
+   (TeX-read-string (TeX-argument-prompt optional prompt "Version")
+                   (format-time-string "%Y/%m/%d" (current-time)))
+   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
@@ -5897,7 +5930,15 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
        [ "Number of arguments" ] [ "Default value for first argument" ] t)
      '("usepackage" LaTeX-arg-usepackage)
      '("RequirePackage" LaTeX-arg-usepackage)
-     '("ProvidesPackage" "Name" [ "Version" ])
+     '("ProvidesPackage" (TeX-arg-file-name-sans-extension "Package name")
+       [ TeX-arg-conditional (y-or-n-p "Insert version? ")
+                            ([ TeX-arg-version ]) nil])
+     '("ProvidesClass" (TeX-arg-file-name-sans-extension "Class name")
+       [ TeX-arg-conditional (y-or-n-p "Insert version? ")
+                            ([ TeX-arg-version ]) nil])
+     '("ProvidesFile" (TeX-arg-file-name "File name")
+       [ TeX-arg-conditional (y-or-n-p "Insert version? ")
+                            ([ TeX-arg-version ]) nil ])
      '("documentclass" TeX-arg-document)))
 
   (TeX-add-style-hook "latex2e"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]