auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 69fc320c6f713806616b9


From: Arash Esbati
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 69fc320c6f713806616b9722adcb12fa8fc4b297
Date: Tue, 3 Jan 2017 12:09:35 +0000 (UTC)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  69fc320c6f713806616b9722adcb12fa8fc4b297 (commit)
      from  890163e3bd40b7f2ca6007050b0db31cddfde378 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 69fc320c6f713806616b9722adcb12fa8fc4b297
Author: Arash Esbati <address@hidden>
Date:   Tue Jan 3 13:08:28 2017 +0100

    Add a newline only if \label is inserted
    
    * style/caption.el (LaTeX-arg-caption-captionof):
    * style/bicaption.el (LaTeX-arg-bicaption-bicaption): Save the
    position before asking for a label.  Add a newline only if a label
    is inserted.

diff --git a/style/bicaption.el b/style/bicaption.el
index b361393..ad3b0ca 100644
--- a/style/bicaption.el
+++ b/style/bicaption.el
@@ -110,11 +110,12 @@ arguments."
        (TeX-argument-insert width t)
        (TeX-argument-insert inpos t)))
     (LaTeX-fill-paragraph)
-    ;; Insert label
-    (when (and (not label-inside) (not star))
+    ;; Insert label -- a new line is inserted only if label is there:
+    (when (and (not label-inside) (not star)
+              (save-excursion (LaTeX-label currenv 'environment)))
       (LaTeX-newline)
       (indent-according-to-mode)
-      (LaTeX-label currenv 'environment))))
+      (end-of-line))))
 
 (defun LaTeX-arg-bicaption-captionsetup (optional)
   "Query for 2 arguments for \"\\captionsetup\" with bicaption.sty loaded.
@@ -143,7 +144,7 @@ square brackets."
    (TeX-add-symbols
     '("bicaption"        (LaTeX-arg-bicaption-bicaption))
     '("bicaption*"       (LaTeX-arg-bicaption-bicaption  nil    t))
-    '("bicaptionbox"     (LaTeX-arg-bicaption-bicaption  nil   nil  t t)   t)
+    '("bicaptionbox"     (LaTeX-arg-bicaption-bicaption  nil   nil  t   t) t)
     '("bicaptionbox*"    (LaTeX-arg-bicaption-bicaption  nil    t   t)     t)
     '("bisubcaption"     (LaTeX-arg-bicaption-bicaption "sub-"))
     '("bisubcaption*"    (LaTeX-arg-bicaption-bicaption "sub-"  t))
diff --git a/style/caption.el b/style/caption.el
index f4b2ab0..f955c27 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -294,21 +294,24 @@ STAR is non-nil, do not query for a short-caption and a 
label."
     (TeX-argument-insert caption optional)
     (LaTeX-fill-paragraph)
     (unless star
-      (LaTeX-newline)
-      (indent-according-to-mode)
       ;; Check if `envtype' is a figure or a table, also consult
       ;; `LaTeX-label-alist' for additions from user or newfloat.el,
       ;; then run `LaTeX-label' w/ 'environment arg, otherwise w/o.
-      (if (or (member envtype figtypes)
-             (member envtype tabtypes)
-             (assoc envtype LaTeX-label-alist))
-         (LaTeX-label (cond ((member envtype figtypes)
-                             "figure")
-                            ((member envtype tabtypes)
-                             "table")
-                            (t envtype))
-                      'environment)
-       (LaTeX-label envtype)))))
+      (save-excursion
+       (if (or (member envtype figtypes)
+               (member envtype tabtypes)
+               (assoc envtype LaTeX-label-alist))
+           (LaTeX-label (cond ((member envtype figtypes)
+                               "figure")
+                              ((member envtype tabtypes)
+                               "table")
+                              (t envtype))
+                        'environment)
+         (LaTeX-label envtype)))
+      (when (looking-at-p "\\\\label{")
+       (LaTeX-newline)
+       (indent-according-to-mode)
+       (end-of-line)))))
 
 (TeX-add-style-hook
  "caption"

-----------------------------------------------------------------------

Summary of changes:
 style/bicaption.el |    9 +++++----
 style/caption.el   |   27 +++++++++++++++------------
 2 files changed, 20 insertions(+), 16 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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