auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] [elpa] externals/auctex 47e9216875 6/6: Merge remote-trac


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex 47e9216875 6/6: Merge remote-tracking branch 'origin/master' into externals/auctex
Date: Fri, 14 Jan 2022 04:44:37 -0500 (EST)

branch: externals/auctex
commit 47e9216875d2135f6c7f7bafd263899386b8af0b
Merge: 367b153c1a 58eda6e1f0
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Merge remote-tracking branch 'origin/master' into externals/auctex
---
 style/siunitx.el                             | 69 +++++++++++++++++++---------
 tests/latex/tabular-count-ampersands-in.tex  |  4 +-
 tests/latex/tabular-count-ampersands-out.tex |  4 +-
 tex.el                                       | 14 +++---
 4 files changed, 59 insertions(+), 32 deletions(-)

diff --git a/style/siunitx.el b/style/siunitx.el
index 9ad9aba750..b1164a1f68 100644
--- a/style/siunitx.el
+++ b/style/siunitx.el
@@ -1,4 +1,4 @@
-;;; siunitx.el --- AUCTeX style for `siunitx.sty' version 2.5s.  -*- 
lexical-binding: t; -*-
+;;; siunitx.el --- AUCTeX style for `siunitx.sty' version 3.3.36.  -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2012-2021  Free Software Foundation, Inc.
 
@@ -295,10 +295,7 @@ string."
     '("ang" [TeX-arg-key-val (LaTeX-siunitx-key-val-options)] "Angle")
 
     ;; 3.3 Units
-    '("unit"       [TeX-arg-key-val (LaTeX-siunitx-key-val-options)]
-      LaTeX-arg-siunitx-unit)
-    '("qty"        [TeX-arg-key-val (LaTeX-siunitx-key-val-options)]
-      "Number" LaTeX-arg-siunitx-unit)
+    ;; For 'qty' and 'units', see 8 Compatibility with other packages
     '("qtylist"    [TeX-arg-key-val (LaTeX-siunitx-key-val-options)]
       "Numbers" LaTeX-arg-siunitx-unit)
     '("qtyproduct" [TeX-arg-key-val (LaTeX-siunitx-key-val-options)]
@@ -312,10 +309,6 @@ string."
     '("complexqty" [TeX-arg-key-val (LaTeX-siunitx-key-val-options)]
       "Number" LaTeX-arg-siunitx-unit)
 
-    ;; These macros are deprecated with package v3: "si", "SI",
-    ;; "SIlist", "SIrange", "SendSettingsToPgf".  Hence they are
-    ;; removed.
-
     ;; 3.7 Creating new macros
     '("DeclareSIUnit" [TeX-arg-key-val (LaTeX-siunitx-key-val-options)]
       (LaTeX-arg-define-siunitx-unit) "Symbol")
@@ -331,7 +324,33 @@ string."
     '("DeclareSIQualifier" (LaTeX-arg-define-siunitx-unit "Qualifier") 
"Symbol")
 
     ;; 3.8 Tabular material
-    '("tablenum" [TeX-arg-key-val (LaTeX-siunitx-key-val-options)] "Number"))
+    '("tablenum" [TeX-arg-key-val (LaTeX-siunitx-key-val-options)] "Number")
+
+    ;; 5 Upgrading from version 2
+    ;; The next set of macros are still available in siunitx.sty v3
+    ;; but are not recommended for use in new documents.  We provide
+    ;; them in this file anyway since they are also needed when other
+    ;; packages like physics or units are loaded:
+    '("si" [TeX-arg-key-val (LaTeX-siunitx-package-options)] 
LaTeX-arg-siunitx-unit)
+    '("SI" [TeX-arg-key-val (LaTeX-siunitx-package-options)]
+      "Value" ["Pre-unit"] LaTeX-arg-siunitx-unit)
+    '("SIlist" [TeX-arg-key-val (LaTeX-siunitx-package-options)]
+      "Values" LaTeX-arg-siunitx-unit)
+    '("SIrange" [TeX-arg-key-val (LaTeX-siunitx-package-options)]
+      "Value 1" "Value 2" LaTeX-arg-siunitx-unit))
+
+   ;; 8 Compatibility with other packages
+   ;; Avoid clash with other packages which define macros with the
+   ;; same name:
+   (let ((styles (TeX-style-list)))
+     (unless (member "physics" styles)
+       (TeX-add-symbols
+        '("qty"  [TeX-arg-key-val (LaTeX-siunitx-key-val-options)]
+          "Number" LaTeX-arg-siunitx-unit)))
+     (unless (member "units" styles)
+       (TeX-add-symbols
+        '("unit" [TeX-arg-key-val (LaTeX-siunitx-key-val-options)]
+          LaTeX-arg-siunitx-unit))))
 
    ;; The unit macros
    (LaTeX-add-siunitx-units
@@ -446,9 +465,11 @@ string."
    (when (member "cancel" (TeX-style-list))
      (LaTeX-add-siunitx-units "cancel"))
 
-   ;; `siunitx.sty' add new column specification letter 'S'
+   ;; FIXME: 'siunitx.sty' adds only one new column specification
+   ;; letter 'S' in v3 and 's' is removed.  We keep 's' for older
+   ;; documents and remove it sometimes later.
    (set (make-local-variable 'LaTeX-array-column-letters)
-        (concat LaTeX-array-column-letters "S"))
+        (concat LaTeX-array-column-letters "S" "s"))
 
    (TeX-run-style-hooks "l3keys2e"
                         "array"
@@ -464,8 +485,6 @@ string."
                                 ("numproduct"          "[{")
                                 ("numrange"            "[{{")
                                 ("ang"                 "[{")
-                                ("unit"                "[{")
-                                ("qty"                 "[{{")
                                 ("qtylist"             "[{{")
                                 ("qtyrange"            "[{{{")
                                 ("complexnum"          "[{")
@@ -477,14 +496,20 @@ string."
                                 ("tablenum"            "[{")
                                 ("highlight"           "{")
                                 ("sisetup"             "{")
-                                ;; These macros are deprecated in v3, we
-                                ;; leave the fontification support
-                                ;; here for older documents:
-                                ("si"       "[{")
-                                ("SI"       "[{[{")
-                                ("SIlist"   "[{{")
-                                ("SIrange"  "[{{{"))
-                              'function)))
+                                ;; These macros are deprecated in v3 but
+                                ;; still available:
+                                ("si"                  "[{")
+                                ("SI"                  "[{[{")
+                                ("SIlist"              "[{{")
+                                ("SIrange"             "[{{{"))
+                              'function)
+     (let ((styles (TeX-style-list)))
+       (unless (member "physics" styles)
+         (font-latex-add-keywords '(("qty"  "[{{"))
+                                  'function))
+       (unless (member "units" styles)
+         (font-latex-add-keywords '(("unit" "[{"))
+                                  'function)))))
  TeX-dialect)
 
 (defun LaTeX-siunitx-package-options nil
diff --git a/tests/latex/tabular-count-ampersands-in.tex 
b/tests/latex/tabular-count-ampersands-in.tex
index 28c9bc6538..2c18435f4e 100644
--- a/tests/latex/tabular-count-ampersands-in.tex
+++ b/tests/latex/tabular-count-ampersands-in.tex
@@ -73,9 +73,9 @@ dcolumn:
 
 siunitx:
 \begin{tabular}{%
-  s
+  S
   S[table-number-alignment = center]
-  s[table-number-alignment = left]
+  S[table-number-alignment = left]
   S[table-number-alignment = right]
   }
   1 & 2 & 3 & LaTeX-insert-item
diff --git a/tests/latex/tabular-count-ampersands-out.tex 
b/tests/latex/tabular-count-ampersands-out.tex
index add9fd8056..01ff1e2404 100644
--- a/tests/latex/tabular-count-ampersands-out.tex
+++ b/tests/latex/tabular-count-ampersands-out.tex
@@ -88,9 +88,9 @@ dcolumn:
 
 siunitx:
 \begin{tabular}{%
-  s
+  S
   S[table-number-alignment = center]
-  s[table-number-alignment = left]
+  S[table-number-alignment = left]
   S[table-number-alignment = right]
   }
   1 & 2 & 3 & LaTeX-insert-item \\
diff --git a/tex.el b/tex.el
index 3cf8f65ec2..03027d699b 100644
--- a/tex.el
+++ b/tex.el
@@ -6169,14 +6169,16 @@ With prefix argument FORCE, always inserts \" 
characters."
                        ?\")
                       ((= (preceding-char) ?\")
                        ?\")
-                      ((save-excursion
-                         (forward-char (- (length open-quote)))
-                         (looking-at (regexp-quote open-quote)))
+                      ((and (<= (length open-quote) (- (point) (point-min)))
+                            (save-excursion
+                              (forward-char (- (length open-quote)))
+                              (looking-at (regexp-quote open-quote))))
                        (delete-char (- (length open-quote)))
                        ?\")
-                      ((save-excursion
-                         (forward-char (- (length close-quote)))
-                         (looking-at (regexp-quote close-quote)))
+                      ((and (<= (length open-quote) (- (point) (point-min)))
+                            (save-excursion
+                              (forward-char (- (length close-quote)))
+                              (looking-at (regexp-quote close-quote))))
                        (delete-char (- (length close-quote)))
                        ?\")
                       ((save-excursion




reply via email to

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