[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex fbe0782 11/95: Add `NO-INSERT' argument to `LaTe
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex fbe0782 11/95: Add `NO-INSERT' argument to `LaTeX-label' |
Date: |
Sun, 16 Apr 2017 01:26:46 -0400 (EDT) |
branch: externals/auctex
commit fbe07828b108eaff60434713c860c1bd582a14de
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>
Add `NO-INSERT' argument to `LaTeX-label'
* doc/changes.texi: Document changes to `LaTeX-label' and
`LaTeX-label-function'.
* latex.el (LaTeX-label): Add second optional argument NO-INSERT.
This argument is passed to function bound to
`LaTeX-label-function' (usually `reftex-label' with RefTeX
enabled). If `LaTeX-label-function' is nil and NO-INSERT is
non-nil, label is read and returned as a string. Remove some
unnecessary checks.
(LaTeX-label-function): Mention in docstring that the function is
expected to take an optional argument NO-INSERT. This is an
incompatible change.
---
doc/changes.texi | 19 +++++++++++++++++++
latex.el | 34 +++++++++++++++++++---------------
2 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/doc/changes.texi b/doc/changes.texi
index 3cdc886..a102bbb 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -8,6 +8,25 @@
@end ifset
address@hidden News since 11.90
+
address@hidden @bullet
address@hidden
+The function @code{LaTeX-label} now takes a second optional argument
address@hidden When address@hidden, @code{LaTeX-label} reads a label
+and returns it as a string. This argument is also passed to any
+function bound to @code{LaTeX-label-function} (see next item).
+
address@hidden
address@hidden change:} The signature for the function passed with
+the custom variable @code{LaTeX-label-function} has changed. The
+function bound to this variable is now expected to take an optional
+second argument @code{NO-INSERT}. When this argument is address@hidden,
+the function should read and only return a label as a string; insertion
+is done by another function.
+
address@hidden itemize
+
@heading News in 11.90
@itemize @bullet
diff --git a/latex.el b/latex.el
index c2aab36..32ccbbc 100644
--- a/latex.el
+++ b/latex.el
@@ -888,9 +888,12 @@ optional argument is omitted.)"
:group 'LaTeX)
(defcustom LaTeX-label-function nil
- "*A function inserting a label at point.
-Sole argument of the function is the environment. The function has to return
-the label inserted, or nil if no label was inserted."
+ "*A function inserting a label at point or returning a label string.
+Sole mandatory argument of the function is the environment. The
+function has to return the label inserted, or nil if no label was
+inserted. If the optional argument NO-INSERT is non-nil, then
+the function has to return the label as string without any
+insertion or nil if no label was read in."
:group 'LaTeX-label
:type 'function)
@@ -987,7 +990,7 @@ corresponding entry."
(make-variable-buffer-local 'LaTeX-label-alist)
-(defun LaTeX-label (name &optional type)
+(defun LaTeX-label (name &optional type no-insert)
"Insert a label for NAME at point.
The optional TYPE argument can be either environment or section:
in the former case this function looks up `LaTeX-label-alist' to
@@ -999,7 +1002,9 @@ prefix.
If `LaTeX-label-function' is a valid function, LaTeX label will
transfer the job to this function.
-The inserted label is returned, nil if it is empty."
+If the optional NO-INSERT is non-nil, only the label is returned
+and no insertion happens. Otherwise the inserted label is
+returned, nil if it is empty."
(let ((TeX-read-label-prefix
(cond
((eq type 'environment)
@@ -1019,22 +1024,21 @@ The inserted label is returned, nil if it is empty."
(when (symbolp TeX-read-label-prefix)
(setq TeX-read-label-prefix (symbol-value TeX-read-label-prefix)))
(when TeX-read-label-prefix
- (if (and (boundp 'LaTeX-label-function)
- LaTeX-label-function
- (fboundp LaTeX-label-function))
- (setq label (funcall LaTeX-label-function name))
+ (if (and (fboundp LaTeX-label-function))
+ (funcall LaTeX-label-function name no-insert)
;; Use completing-read as we do with `C-c C-m \label RET'
(setq label (TeX-read-label t "What label" t))
;; No label or empty string entered?
(if (or (string= TeX-read-label-prefix label)
(string= "" label))
(setq label nil)
- (insert TeX-esc "label" TeX-grop label TeX-grcl))
- (if label
- (progn
- (LaTeX-add-labels label)
- label)
- nil)))))
+ ;; If NO-INSERT, return only the label for further
+ ;; utilization, otherwise insert \label{label} in the buffer
+ (if no-insert
+ label
+ (insert TeX-esc "label" TeX-grop label TeX-grcl))
+ (LaTeX-add-labels label)
+ label)))))
(defcustom LaTeX-short-caption-prompt-length 40
"The length that the caption of a figure should be before
- [elpa] externals/auctex b714739 09/95: Add \citetitle to `reftex-cite-format' in style/biblatex, (continued)
- [elpa] externals/auctex b714739 09/95: Add \citetitle to `reftex-cite-format' in style/biblatex, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex ccd67c2 17/95: ; * style/breqn.el ("breqn"): Add missing starred version of array., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex c886a1b 10/95: Check if label is defined before adding it to known labels, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 74766b4 03/95: Remove also a gitignore, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 7230fec 07/95: * latex.el (LaTeX-newline): Make interactive. See bug#24412., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex a77e75a 15/95: ; * doc/changes.texi: Improve wording., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 76a2b5f 18/95: * tex-ispell.el: Add support for enviroments from breqn.sty., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 558da5f 24/95: * latex/preview.dtx: Fix example for \PreviewMacro* macro., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 73ccc38 22/95: Simplify addition of entirely skipped environments, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 4f2a322 16/95: Fix plain-TeX-auto-regexp-list docstring, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex fbe0782 11/95: Add `NO-INSERT' argument to `LaTeX-label',
Tassilo Horn <=
- [elpa] externals/auctex d54e747 19/95: Fix font-latex-after-hacking-local-variables on XEmacs, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 1b3f6e8 13/95: Update style/listings.el to use `LaTeX-env-label-as-keyval', Tassilo Horn, 2017/04/16
- [elpa] externals/auctex ec7caff 14/95: Add new style/breqn.el, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 5708567 26/95: Improve parsing process in style/color.el, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex c21aff6 31/95: ; Add `LaTeX-equation-label' as symbol to `LaTeX-label-alist', Tassilo Horn, 2017/04/16
- [elpa] externals/auctex c0f3659 21/95: Fix TeX-view-predicate-list-builtin predicates wrt class opts, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 6c91dba 20/95: Fix number of arguments of local-variable-p in XEmacs, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex e18e46e 32/95: * latex.el (LaTeX-label): Eliminate premature returning of label., Tassilo Horn, 2017/04/16
- [elpa] externals/auctex f12dbb2 27/95: Improve parsing process in style/xcolor.el, Tassilo Horn, 2017/04/16
- [elpa] externals/auctex 85c4656 12/95: Add function to put labels in opt. argument of environments, Tassilo Horn, 2017/04/16