auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] [elpa] externals/auctex a21c10a 29/34: Check for `auto-fi


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex a21c10a 29/34: Check for `auto-fill-function' before filling
Date: Sun, 6 Jun 2021 11:40:06 -0400 (EDT)

branch: externals/auctex
commit a21c10a076734b710145df5950459351025b8723
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>

    Check for `auto-fill-function' before filling
    
    * style/algorithm.el (LaTeX-env-algorithm):
    * style/beamer.el ("beamer"):
    * style/bicaption.el (LaTeX-arg-bicaption-bicaption):
    * style/caption.el (LaTeX-arg-caption-captionbox)
    (LaTeX-arg-caption-captionof):
    * style/currvita.el (LaTeX-currvita-env-with-label):
    * style/enumitem.el (LaTeX-enumitem-env-with-opts):
    * style/longtable.el (LaTeX-env-longtable):
    * style/moodle.el (LaTeX-moodle-question-env-with-args):
    * style/subcaption.el (LaTeX-arg-subcaption-subcaption)
    (LaTeX-arg-subcaption-subcaptionbox):
    * style/tcolorboxlib-raster.el (LaTeX-tcolorbox-lib-raster-env-item):
    * style/xltabular.el (LaTeX-env-xltabular): Fill the paragraph if
    `auto-fill-function' is non-nil.
---
 style/algorithm.el           | 2 +-
 style/beamer.el              | 5 +++--
 style/bicaption.el           | 4 ++--
 style/caption.el             | 4 ++--
 style/currvita.el            | 3 ++-
 style/enumitem.el            | 3 ++-
 style/longtable.el           | 2 +-
 style/moodle.el              | 5 +++--
 style/subcaption.el          | 4 ++--
 style/tcolorboxlib-raster.el | 3 ++-
 style/xltabular.el           | 2 +-
 11 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/style/algorithm.el b/style/algorithm.el
index e18e19d..8500f44 100644
--- a/style/algorithm.el
+++ b/style/algorithm.el
@@ -59,7 +59,7 @@
       ;; Add } to close `\caption{'
       (insert TeX-grcl)
       ;; fill the caption
-      (LaTeX-fill-paragraph)
+      (when auto-fill-function (LaTeX-fill-paragraph))
       ;; Insert a new line and indent
       (LaTeX-newline)
       (indent-according-to-mode)
diff --git a/style/beamer.el b/style/beamer.el
index 942d807..36f15d7 100644
--- a/style/beamer.el
+++ b/style/beamer.el
@@ -155,8 +155,9 @@
                        (insert (format "\\frametitle{%s}" title))
                        ;; This works because \frametitle is a
                        ;; paragraph command.
-                       (backward-char)
-                       (LaTeX-fill-paragraph))))))
+                       (when auto-fill-function
+                         (backward-char)
+                         (LaTeX-fill-paragraph)))))))
     '("onlyenv" (lambda (env &rest ignore)
                   (LaTeX-insert-environment
                    env
diff --git a/style/bicaption.el b/style/bicaption.el
index b8d6cb7..245b454 100644
--- a/style/bicaption.el
+++ b/style/bicaption.el
@@ -106,7 +106,7 @@ arguments."
     (when (and label-inside (not star))
       (LaTeX-label currenv 'environment))
     (insert TeX-grcl)
-    (LaTeX-fill-paragraph)
+    (when auto-fill-function (LaTeX-fill-paragraph))
     (LaTeX-newline)
     (indent-according-to-mode)
     ;; Insert short & regular 2. caption
@@ -131,7 +131,7 @@ arguments."
                        ""))))
         (and width (TeX-argument-insert width t))
         (and inpos (TeX-argument-insert inpos t))))
-    (LaTeX-fill-paragraph)
+    (when auto-fill-function (LaTeX-fill-paragraph))
     ;; 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)))
diff --git a/style/caption.el b/style/caption.el
index 346b84d..988a9bb 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -287,7 +287,7 @@ caption, insert only a caption."
   ;; `LaTeX-fill-paragraph' without messing up the code since
   ;; \caption starts a new paragraph with AUCTeX
   ;; (cf. `paragraph-start').
-  (LaTeX-fill-paragraph))
+  (when auto-fill-function (LaTeX-fill-paragraph)))
 
 (defun LaTeX-arg-caption-captionof (optional &optional star)
   "Query for the arguments of \"\\captionof\" macro and insert them.
@@ -311,7 +311,7 @@ STAR is non-nil, do not query for a short-caption and a 
label."
     (when (and short-caption (not (string= short-caption "")))
       (insert LaTeX-optop short-caption LaTeX-optcl))
     (TeX-argument-insert caption optional)
-    (LaTeX-fill-paragraph)
+    (when auto-fill-function (LaTeX-fill-paragraph))
     (when (and (not star)
                ;; Check if `envtype' is a figure or a table, also
                ;; consult `LaTeX-label-alist' for additions from user
diff --git a/style/currvita.el b/style/currvita.el
index 03a099a..62aa51f 100644
--- a/style/currvita.el
+++ b/style/currvita.el
@@ -58,7 +58,8 @@
   (LaTeX-insert-item)
   ;; The inserted \item may have outdented the first line to the
   ;; right.  Fill it, if appropriate.
-  (when (and (not (looking-at "$"))
+  (when (and auto-fill-function
+             (not (looking-at "$"))
              (not (assoc env LaTeX-indent-environment-list))
              (> (- (line-end-position) (line-beginning-position))
                 (current-fill-column)))
diff --git a/style/enumitem.el b/style/enumitem.el
index efb8aa3..1a858b1 100644
--- a/style/enumitem.el
+++ b/style/enumitem.el
@@ -246,7 +246,8 @@ key-val and the first item."
   (LaTeX-insert-item)
   ;; The inserted \item may have outdented the first line to the
   ;; right.  Fill it, if appropriate.
-  (when (and (not (looking-at "$"))
+  (when (and auto-fill-function
+             (not (looking-at "$"))
              (not (assoc env LaTeX-indent-environment-list))
              (> (- (line-end-position) (line-beginning-position))
                 (current-fill-column)))
diff --git a/style/longtable.el b/style/longtable.el
index 4e7ea30..2646e33 100644
--- a/style/longtable.el
+++ b/style/longtable.el
@@ -83,7 +83,7 @@ insert line break macro."
       ;; close `\caption{'
       (insert TeX-grcl "\\\\")
       ;; fill the caption
-      (LaTeX-fill-paragraph)
+      (when auto-fill-function (LaTeX-fill-paragraph))
       ;; Insert a new line and indent
       (LaTeX-newline)
       (indent-according-to-mode))
diff --git a/style/moodle.el b/style/moodle.el
index b61310e..ac5f286 100644
--- a/style/moodle.el
+++ b/style/moodle.el
@@ -129,11 +129,12 @@
       (newline)
       (indent-according-to-mode)
       (insert qtext)
-      (LaTeX-fill-paragraph)))
+      (when auto-fill-function (LaTeX-fill-paragraph))))
   (LaTeX-insert-item)
   ;; The inserted \item may have outdented the first line to the
   ;; right.  Fill it, if appropriate.
-  (when (and (not (looking-at "$"))
+  (when (and auto-fill-function
+             (not (looking-at "$"))
              (not (assoc env LaTeX-indent-environment-list))
              (> (- (line-end-position) (line-beginning-position))
                 (current-fill-column)))
diff --git a/style/subcaption.el b/style/subcaption.el
index 370a5dc..5f3122f 100644
--- a/style/subcaption.el
+++ b/style/subcaption.el
@@ -69,7 +69,7 @@ caption, insert only a caption."
       (insert LaTeX-optop short-caption LaTeX-optcl))
     (insert TeX-grop caption TeX-grcl)
     ;; Fill the \subcaption paragraph before inserting the \label:
-    (LaTeX-fill-paragraph)
+    (when auto-fill-function (LaTeX-fill-paragraph))
     (when (and (not star)
                (save-excursion (LaTeX-label currenv 'environment)))
       ;; Move \label into next line if we have one:
@@ -109,7 +109,7 @@ caption, insert only a caption."
   ;; Fill the paragraph before inserting {}.  We use this function
   ;; since we add \subcaption to `paragraph-start' in the style hook
   ;; below.
-  (LaTeX-fill-paragraph))
+  (when auto-fill-function (LaTeX-fill-paragraph)))
 
 (TeX-add-style-hook
  "subcaption"
diff --git a/style/tcolorboxlib-raster.el b/style/tcolorboxlib-raster.el
index bcb93d0..912f3c2 100644
--- a/style/tcolorboxlib-raster.el
+++ b/style/tcolorboxlib-raster.el
@@ -119,7 +119,8 @@
   (LaTeX-insert-item)
   ;; The inserted \item may have outdented the first line to the
   ;; right.  Fill it, if appropriate.
-  (when (and (not (looking-at "$"))
+  (when (and auto-fill-function
+             (not (looking-at "$"))
              (not (assoc environment LaTeX-indent-environment-list))
              (> (- (line-end-position) (line-beginning-position))
                 (current-fill-column)))
diff --git a/style/xltabular.el b/style/xltabular.el
index 72c46df..09c5a97 100644
--- a/style/xltabular.el
+++ b/style/xltabular.el
@@ -79,7 +79,7 @@ nested curly brace pair nor escaped \"}\".")
       ;; close `\caption{'
       (insert TeX-grcl "\\\\")
       ;; fill the caption
-      (LaTeX-fill-paragraph)
+      (when auto-fill-function (LaTeX-fill-paragraph))
       ;; Insert a new line and indent
       (LaTeX-newline)
       (indent-according-to-mode))




reply via email to

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