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. 5179308ed7eae182e1ff6


From: Mosè Giordano
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 5179308ed7eae182e1ff6cfe5bbc596097fba31b
Date: Tue, 10 Nov 2015 22:43:18 +0000

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  5179308ed7eae182e1ff6cfe5bbc596097fba31b (commit)
      from  3aa4bdba0672da89761ffa6ced551f2a4d84a56f (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 5179308ed7eae182e1ff6cfe5bbc596097fba31b
Author: Mosè Giordano <address@hidden>
Date:   Tue Nov 10 23:41:47 2015 +0100

    Change default value of LaTeX-fill-break-at-separators
    
    * latex.el (LaTeX-fill-break-at-separators): Change default value
    to opening only inline and display math switches.
    
    * tests/latex/latex-filling-in.tex: New test file.
    
    * tests/latex/latex-filling-out.tex: Ditto.
    
    * tests/latex/latex-test.el (LaTeX-indent-tabular-test/in)
    (LaTeX-indent-tabular-test/out): Remove variables defined with
    `defvar'.
    (AUCTeX-set-ert-path): New function for setting the path of the
    ERT test files.
    (LaTeX-filling): New ERT test.

diff --git a/ChangeLog b/ChangeLog
index 48ac03b..1b94fca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2015-11-10  Mosè Giordano  <address@hidden>
+
+       * latex.el (LaTeX-fill-break-at-separators): Change default value
+       to opening only inline and display math switches.
+
+       * tests/latex/latex-filling-in.tex: New test file.
+
+       * tests/latex/latex-filling-out.tex: Ditto.
+
+       * tests/latex/latex-test.el (LaTeX-indent-tabular-test/in)
+       (LaTeX-indent-tabular-test/out): Remove variables defined with
+       `defvar'.
+       (AUCTeX-set-ert-path): New function for setting the path of the
+       ERT test files.
+       (LaTeX-filling): New ERT test.
+
 2015-11-10  Tassilo Horn  <address@hidden>
 
        * tex-buf.el (TeX-revert-document-buffer): New function.
diff --git a/latex.el b/latex.el
index be466b8..f702f90 100644
--- a/latex.el
+++ b/latex.el
@@ -3357,7 +3357,9 @@ recognized."
 
 ;;; Filling
 
-(defcustom LaTeX-fill-break-at-separators nil
+;; The default value should try not to break formulae across lines (this is
+;; useful for preview-latex) and give a meaningful filling.
+(defcustom LaTeX-fill-break-at-separators '(\\\( \\\[)
   "List of separators before or after which respectively a line
 break will be inserted if they do not fit into one line."
   :group 'LaTeX
diff --git a/tests/latex/latex-filling-in.tex b/tests/latex/latex-filling-in.tex
new file mode 100644
index 0000000..4cc184b
--- /dev/null
+++ b/tests/latex/latex-filling-in.tex
@@ -0,0 +1 @@
+Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod \(0 = 1\) 
tempor incidunt ut $a^{2} + b^{2} = c^{2}$ labore et dolore magna aliqua.  Ut 
enim ad minim veniam, quis nostrum exercitationem ullam corporis suscipit 
laboriosam, nisi ut aliquid ex ea commodi consequatur.
diff --git a/tests/latex/latex-filling-out.tex 
b/tests/latex/latex-filling-out.tex
new file mode 100644
index 0000000..cdb767a
--- /dev/null
+++ b/tests/latex/latex-filling-out.tex
@@ -0,0 +1,5 @@
+Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod
+\(0 = 1\) tempor incidunt ut $a^{2} + b^{2} = c^{2}$ labore et dolore
+magna aliqua.  Ut enim ad minim veniam, quis nostrum exercitationem
+ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi
+consequatur.
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index ac662db..0ca942a 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -1,6 +1,6 @@
 ;;; latex-test.el --- tests for LaTeX mode
 
-;; Copyright (C) 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
 
 ;; This file is part of AUCTeX.
 
@@ -24,14 +24,27 @@
 (require 'ert)
 (require 'latex)
 
-(defvar LaTeX-indent-tabular-test/in
-  (expand-file-name "tabular-in.tex"
-                   (when load-file-name
-                     (file-name-directory load-file-name))))
-(defvar LaTeX-indent-tabular-test/out
-  (expand-file-name "tabular-out.tex"
-                   (when load-file-name
-                     (file-name-directory load-file-name))))
+(defun AUCTeX-set-ert-path (&rest sym-val)
+  "Set first element of SYM-VAL to the next one, and so on.
+
+The value is the path to the test file, make sure it is expanded
+in the right directory even when the ERT test from the command
+line and from another directory."
+  (while sym-val
+    (set (pop sym-val)
+        (expand-file-name (pop sym-val)
+                          (when load-file-name
+                            (file-name-directory load-file-name))))))
+
+(AUCTeX-set-ert-path
+ 'LaTeX-indent-tabular-test/in
+ "tabular-in.tex"
+ 'LaTeX-indent-tabular-test/out
+ "tabular-out.tex"
+ 'LaTeX-filling/in
+ "latex-filling-in.tex"
+ 'LaTeX-filling/out
+ "latex-filling-out.tex")
 
 (ert-deftest LaTeX-indent-tabular ()
   (should (string=
@@ -44,4 +57,20 @@
              (insert-file-contents LaTeX-indent-tabular-test/out)
              (buffer-string)))))
 
+;; Test LaTeX code with math modes is indented as expected.  This has mostly to
+;; do with the value of `LaTeX-fill-break-at-separators' and how
+;; `LaTeX-fill-move-to-break-point' handles it.  If the test fails, try to look
+;; there.
+(ert-deftest LaTeX-filling ()
+  (should (string=
+           (with-temp-buffer
+             (insert-file-contents LaTeX-filling/in)
+             (LaTeX-mode)
+            (let ((fill-column 70))
+              (fill-paragraph))
+             (buffer-string))
+           (with-temp-buffer
+             (insert-file-contents LaTeX-filling/out)
+             (buffer-string)))))
+
 ;;; latex-test.el ends here

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

Summary of changes:
 ChangeLog                         |   16 ++++++++++++
 latex.el                          |    4 ++-
 tests/latex/latex-filling-in.tex  |    1 +
 tests/latex/latex-filling-out.tex |    5 ++++
 tests/latex/latex-test.el         |   47 +++++++++++++++++++++++++++++-------
 5 files changed, 63 insertions(+), 10 deletions(-)
 create mode 100644 tests/latex/latex-filling-in.tex
 create mode 100644 tests/latex/latex-filling-out.tex


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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