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

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

[elpa] externals/auctex e1ec6a0 33/36: Make second argument of LaTeX-lab


From: Stefan Monnier
Subject: [elpa] externals/auctex e1ec6a0 33/36: Make second argument of LaTeX-label optional.
Date: Fri, 28 Nov 2014 17:25:53 +0000

branch: externals/auctex
commit e1ec6a022a7cc03c6978f5401486334bb21ac94a
Author: Mosè Giordano <address@hidden>
Date:   Thu Nov 27 19:16:03 2014 +0100

    Make second argument of LaTeX-label optional.
    
    * latex.el (LaTeX-label-alist): Expand doc string.
    (LaTeX-label): Make second argument optional to restore backward
    compatibility and update doc string accordingly.  (Bug#19178)
---
 ChangeLog |    6 ++++++
 latex.el  |   27 ++++++++++++++++++++++-----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ddb7513..6f450ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-27  Mos� Giordano  <address@hidden>
+
+       * latex.el (LaTeX-label-alist): Expand doc string.
+       (LaTeX-label): Make second argument optional to restore backward
+       compatibility and update doc string accordingly.  (Bug#19178)
+
 2014-11-27  Matthew Leach  <address@hidden>
 
        * configure.ac: Merge from preview/configure.ac.
diff --git a/latex.el b/latex.el
index 80d2761..067a776 100644
--- a/latex.el
+++ b/latex.el
@@ -933,7 +933,14 @@ If nil, act like the empty string is given, but do not 
prompt."
     ("eqnarray" . LaTeX-eqnarray-label))
   "Lookup prefixes for labels.
 An alist where the CAR is the environment name, and the CDR
-either the prefix or a symbol referring to one."
+either the prefix or a symbol referring to one.
+
+If the name is not found, or if the CDR is nil, no label is
+automatically inserted for that environment.
+
+If you want to automatically insert a label for a environment but
+with an empty prefix, use the empty string \"\" as the CDR of the
+corresponding entry."
   :group 'LaTeX-label
   :type '(repeat (cons (string :tag "Environment")
                       (choice (string :tag "Label prefix")
@@ -941,10 +948,16 @@ either the prefix or a symbol referring to one."
 
 (make-variable-buffer-local 'LaTeX-label-alist)
 
-(defun LaTeX-label (name type)
+(defun LaTeX-label (name &optional type)
   "Insert a label for NAME at point.
-TYPE can be either environment or section.  If
-`LaTeX-label-function' is a valid function, LaTeX label will
+The optional TYPE argument can be either environment or section:
+in the former case this function looks up `LaTeX-label-alist' to
+choose which prefix to use for the label, in the latter case
+`LaTeX-section-label' will be looked up instead.  If TYPE is nil,
+you will be always prompted for a label, with an empty default
+prefix.
+
+If `LaTeX-label-function' is a valid function, LaTeX label will
 transfer the job to this function."
   (let ((prefix (cond
                 ((eq type 'environment)
@@ -955,7 +968,11 @@ transfer the job to this function."
                          LaTeX-section-label
                        (and (listp LaTeX-section-label)
                             (cdr (assoc name LaTeX-section-label))))
-                   ""))))
+                   ""))
+                ((null type)
+                 "")
+                (t
+                 nil)))
        label)
     (when (symbolp prefix)
       (setq prefix (symbol-value prefix)))



reply via email to

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