auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, lexical-binding-attempt-1, updated. 31


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, lexical-binding-attempt-1, updated. 319dde171431ada3954b886f51a851858e25561e
Date: Sat, 5 Sep 2020 07:25:49 -0400 (EDT)

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, lexical-binding-attempt-1 has been updated
       via  319dde171431ada3954b886f51a851858e25561e (commit)
      from  220ab9ed1b45a4fe3298874af68e71cff2d7c6a5 (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 319dde171431ada3954b886f51a851858e25561e
Author: Tassilo Horn <tsdh@gnu.org>
Date:   Sat Sep 5 13:25:12 2020 +0200

    exit-mark, last-optional-rejected => TeX-{exit-mark,last-optional-rejected} 
and more

diff --git a/doc/auctex.texi b/doc/auctex.texi
index 2c5f269..1fd92e8 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -5355,8 +5355,8 @@ If you add new hooks, you can assume that point is placed 
directly after
 the previous argument, or after the macro name if this is the first
 argument.  Please leave point located after the argument you are
 inserting.  If you want point to be located somewhere else after all
-hooks have been processed, set the value of @code{exit-mark}.  It will
-point nowhere, until the argument hook sets it.
+hooks have been processed, set the value of @code{TeX-exit-mark}.  It
+will point nowhere, until the argument hook sets it.
 
 Some packages provide macros that are rarely useful to non-expert users.
 Those should be marked as expert macros using
diff --git a/latex.el b/latex.el
index 020cd1c..0f9d333 100644
--- a/latex.el
+++ b/latex.el
@@ -1316,9 +1316,9 @@ Just like array and tabular."
   (save-excursion
     (LaTeX-find-matching-begin)
     (end-of-line)
-    (let ((exit-mark (if (boundp 'exit-mark)
-                        exit-mark
-                      (make-marker))))
+    (let ((TeX-exit-mark (if (boundp 'TeX-exit-mark)
+                            TeX-exit-mark
+                          (make-marker))))
       (TeX-parse-arguments args))))
 
 (defun LaTeX-env-label-as-keyval (_optional &optional keyword keyvals 
environment)
@@ -1397,17 +1397,21 @@ out."
   "A list of environments where items have a special syntax.
 The cdr is the name of the function, used to insert this kind of items.")
 
+(defvar LaTeX-insert-item-environment nil
+  "The environment to which an item is going to be inserted.
+Dynamically bound by `LaTeX-insert-item'.")
+
 (defun LaTeX-insert-item ()
   "Insert a new item in an environment.
 You may use `LaTeX-item-list' to change the routines used to insert the item."
   (interactive "*")
-  (let ((environment (LaTeX-current-environment)))
+  (let ((LaTeX-insert-item-environment (LaTeX-current-environment)))
     (when (and (TeX-active-mark)
               (> (point) (mark)))
       (exchange-point-and-mark))
     (unless (bolp) (LaTeX-newline))
-    (if (assoc environment LaTeX-item-list)
-       (funcall (cdr (assoc environment LaTeX-item-list)))
+    (if (assoc LaTeX-insert-item-environment LaTeX-item-list)
+       (funcall (cdr (assoc LaTeX-insert-item-environment LaTeX-item-list)))
       (TeX-insert-macro "item"))
     (indent-according-to-mode)))
 
@@ -6929,7 +6933,7 @@ functions `TeX-arg-color' (style/color.el) or
                   (equal current-prefix-arg '(4)))
              (and (eq TeX-insert-macro-default-style 'mandatory-args-only)
                   (null (equal current-prefix-arg '(4))))
-             last-optional-rejected))
+             TeX-last-optional-rejected))
      ,@body))
 
 (defun LaTeX-extract-key-value-label (&optional key num)
diff --git a/style/bicaption.el b/style/bicaption.el
index 8622cd5..f29ccce 100644
--- a/style/bicaption.el
+++ b/style/bicaption.el
@@ -117,13 +117,13 @@ arguments."
     (when cap-box
       (let* ((TeX-arg-opening-brace "[")
             (TeX-arg-closing-brace "]")
-            (last-optional-rejected nil)
+            (TeX-last-optional-rejected nil)
             (width (LaTeX-check-insert-macro-default-style
                     (completing-read (TeX-argument-prompt t nil "Width")
                                      (mapcar (lambda (elt) (concat TeX-esc 
(car elt)))
                                              (LaTeX-length-list)))))
-            (last-optional-rejected (or (not width)
-                                        (and width (string= width ""))))
+            (TeX-last-optional-rejected (or (not width)
+                                            (and width (string= width ""))))
             (inpos (LaTeX-check-insert-macro-default-style
                     (if (and width (not (string-equal width "")))
                         (completing-read (TeX-argument-prompt t nil "Inner 
position")
diff --git a/style/booktabs.el b/style/booktabs.el
index 5a58b28..f4e60db 100644
--- a/style/booktabs.el
+++ b/style/booktabs.el
@@ -57,7 +57,7 @@ PROMPT is the value of the prompt to be shown."
     '("toprule" [ "Thickness" ])
     '("midrule" [ "Thickness" ])
     '("bottomrule" [ "Thickness" ])
-    ;; The `ignore' resets `last-optional-rejected' to nil so that the trim
+    ;; The `ignore' resets `TeX-last-optional-rejected' to nil so that the trim
     ;; argument is prompted also when the thickness is skipped.
     '("cmidrule" [ "Thickness" ] (ignore) [ LaTeX-booktabs-arg-paren "Trim" ]
       "Column(s)")
diff --git a/style/caption.el b/style/caption.el
index fb9ddbe..a5d325b 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -269,13 +269,13 @@ caption, insert only a caption."
     (insert TeX-grcl))
   (let* ((TeX-arg-opening-brace "[")
         (TeX-arg-closing-brace "]")
-        (last-optional-rejected nil)
+        (TeX-last-optional-rejected nil)
         (width (LaTeX-check-insert-macro-default-style
                 (completing-read (TeX-argument-prompt t nil "Width")
                                  (mapcar (lambda (elt) (concat TeX-esc (car 
elt)))
                                          (LaTeX-length-list)))))
-        (last-optional-rejected (or (not width)
-                                    (and width (string= width ""))))
+        (TeX-last-optional-rejected (or (not width)
+                                        (and width (string= width ""))))
         (inpos (LaTeX-check-insert-macro-default-style
                 (if (and width (not (string-equal width "")))
                     (completing-read (TeX-argument-prompt t nil "Inner 
position")
diff --git a/style/color.el b/style/color.el
index f8f850a..bfc91b4 100644
--- a/style/color.el
+++ b/style/color.el
@@ -131,7 +131,7 @@
   ;; `TeX-insert-macro-default-style' and if `current-prefix-arg'.
   ;; `named' is removed here from completion if package option is not
   ;; given.
-  (let* ((last-optional-rejected nil)
+  (let* ((TeX-last-optional-rejected nil)
          (model (LaTeX-check-insert-macro-default-style
                  (completing-read
                   (TeX-argument-prompt t prompt "Color model")
@@ -181,7 +181,7 @@
   ;; First, ask for <model> depending on
   ;; `TeX-insert-macro-default-style' and `current-prefix-arg'.
   ;; Remove `named' if necessary.
-  (let* ((last-optional-rejected nil)
+  (let* ((TeX-last-optional-rejected nil)
         (model (LaTeX-check-insert-macro-default-style
                  (completing-read
                   (TeX-argument-prompt t prompt "Color model")
diff --git a/style/exam.el b/style/exam.el
index 76bff4b..7a58e52 100644
--- a/style/exam.el
+++ b/style/exam.el
@@ -1,4 +1,4 @@
-;;; exam.el --- AUCTeX style for the (LaTeX) exam class
+;;; exam.el --- AUCTeX style for the (LaTeX) exam class  -*- lexical-binding: 
t; -*-
 
 ;; Copyright (C) 2016--2020 Free Software Foundation, Inc.
 
@@ -48,20 +48,24 @@
 (dolist (opt LaTeX-article-class-options)
   (add-to-list 'LaTeX-exam-class-options opt))
 
+;; Defined in latex.el and bound by `LaTeX-insert-item'.
+(defvar LaTeX-insert-item-environment)
+
 (defun LaTeX-exam-insert-item ()
-  "Insert a new item in an environment from exam class.
+  "Insert a new item in an LaTeX-insert-item-environment from exam class.
 Item inserted depends on the environment."
   (TeX-insert-macro
-   (cond ((string= environment "questions")
+   (cond ((string= LaTeX-insert-item-environment "questions")
           "question")
-         ((string= environment "parts")
+         ((string= LaTeX-insert-item-environment "parts")
           "part")
-         ((string= environment "subparts")
+         ((string= LaTeX-insert-item-environment "subparts")
           "subpart")
-         ((string= environment "subsubparts")
+         ((string= LaTeX-insert-item-environment "subsubparts")
           "subsubpart")
-        ((member environment '("choices" "oneparchoices"
-                               "checkboxes" "oneparcheckboxes"))
+        ((member LaTeX-insert-item-environment
+                  '("choices" "oneparchoices"
+                   "checkboxes" "oneparcheckboxes"))
          "choice")
          ;; Fallback
          (t "item"))))
diff --git a/style/floatrow.el b/style/floatrow.el
index 57f58c7..2411d67 100644
--- a/style/floatrow.el
+++ b/style/floatrow.el
@@ -349,21 +349,21 @@ If OPTIONAL is non-nil, indicate optional argument during 
query."
   ;; `TeX-argument-insert':
   (let* ((TeX-arg-opening-brace "[")
         (TeX-arg-closing-brace "]")
-        (last-optional-rejected nil)
+        (TeX-last-optional-rejected nil)
         (width (LaTeX-check-insert-macro-default-style
                 (completing-read
                  (TeX-argument-prompt t nil "Width")
                  (mapcar (lambda (x) (concat TeX-esc (car x)))
                          (LaTeX-length-list)))))
-        (last-optional-rejected (or (not width)
-                                    (and width (string= width ""))))
+        (TeX-last-optional-rejected (or (not width)
+                                        (and width (string= width ""))))
         (height (LaTeX-check-insert-macro-default-style
                  (completing-read
                   (TeX-argument-prompt t nil "Height")
                   (mapcar (lambda (x) (concat TeX-esc (car x)))
                           (LaTeX-length-list)))))
-        (last-optional-rejected (or (not height)
-                                    (and height (string= height ""))))
+        (TeX-last-optional-rejected (or (not height)
+                                        (and height (string= height ""))))
         (vertpos (LaTeX-check-insert-macro-default-style
                   (if (string= height "")
                       ""
diff --git a/style/ifluatex.el b/style/ifluatex.el
index 246bc22..46d59cd 100644
--- a/style/ifluatex.el
+++ b/style/ifluatex.el
@@ -34,35 +34,35 @@
                  "font-latex"
                  (keywords class))
 
-(defun LaTeX-ifluatex-set-exit-mark (_optional)
-  "Discard OPTIONAL and set exit-mark to current point."
-  (set-marker exit-mark (point)))
+(defun LaTeX-ifluatex-set-TeX-exit-mark (_optional)
+  "Discard OPTIONAL and set `TeX-exit-mark' to current point."
+  (set-marker TeX-exit-mark (point)))
 
 (TeX-add-style-hook
+ "ifluatex"
+ (lambda ()
+   (TeX-add-symbols
+    '("ifluatex"
+      (TeX-arg-literal "%\n")
+      LaTeX-ifluatex-set-TeX-exit-mark
+      (TeX-arg-literal "\n\\else%\n\\fi%"))
+    '("luatexversion" 0)
+    '("luatexrevision" 0))
+   (TeX-declare-expert-macros
     "ifluatex"
-  (lambda ()
-    (TeX-add-symbols
-     '("ifluatex"
-       (TeX-arg-literal "%\n")
-       LaTeX-ifluatex-set-exit-mark
-       (TeX-arg-literal "\n\\else%\n\\fi%"))
-     '("luatexversion" 0)
-     '("luatexrevision" 0))
-    (TeX-declare-expert-macros
-     "ifluatex"
-     "ifluatex" "luatexversion" "luatexrevision")
-
-    ;; This package is used to make it possible to compile a document with both
-    ;; LuaTeX and base TeX engines.  By setting `TeX-check-engine-list' to nil
-    ;; we ignore engine restrictions posed by other packages.
-    (setq TeX-check-engine-list nil)
-
-    (when (and (featurep 'font-latex)
-              (eq TeX-install-font-lock 'font-latex-setup))
-      (font-latex-add-keywords '(("luatexversion")
-                                ("luatexrevision"))
-                              'function)))
-  LaTeX-dialect)
+    "ifluatex" "luatexversion" "luatexrevision")
+
+   ;; This package is used to make it possible to compile a document with both
+   ;; LuaTeX and base TeX engines.  By setting `TeX-check-engine-list' to nil
+   ;; we ignore engine restrictions posed by other packages.
+   (setq TeX-check-engine-list nil)
+
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("luatexversion")
+                               ("luatexrevision"))
+                             'function)))
+ LaTeX-dialect)
 
 (defvar LaTeX-ifluatex-package-options nil
   "Package options for the ifluatex package.")
diff --git a/style/xcolor.el b/style/xcolor.el
index 43c5637..3d77b35 100644
--- a/style/xcolor.el
+++ b/style/xcolor.el
@@ -284,7 +284,7 @@ xcolor package.")
 (defun TeX-arg-xcolor-definecolor (optional)
   "Insert arguments of \\definecolor and similar macros from xcolor.sty."
   ;; \definecolor[<type>]{<name>}{<model-list>}{<spec-list>}
-  (let* ((last-optional-rejected nil)
+  (let* ((TeX-last-optional-rejected nil)
         (xcoltype  (LaTeX-check-insert-macro-default-style
                     (completing-read
                      (TeX-argument-prompt t nil "Type")
@@ -311,7 +311,7 @@ xcolor package.")
 
 (defun TeX-arg-xcolor-definecolorset (optional)
   "Insert arguments of \\definecolorset and similar macros from xcolor.sty."
-  (let* ((last-optional-rejected nil)
+  (let* ((TeX-last-optional-rejected nil)
         (xcoltype (LaTeX-check-insert-macro-default-style
                    (completing-read
                     (TeX-argument-prompt t nil "Type")
@@ -326,7 +326,7 @@ xcolor package.")
 (defun TeX-arg-xcolor (optional)
   "Insert arguments of various color commands from xcolor.sty."
   ;; \color{<name>} or \color[<model-list>]{<spec-list>}
-  (let* ((last-optional-rejected nil)
+  (let* ((TeX-last-optional-rejected nil)
         (xcolmodel (LaTeX-check-insert-macro-default-style
                     (completing-read
                      (TeX-argument-prompt t nil "Model (list)")
@@ -344,14 +344,14 @@ xcolor package.")
 (defun TeX-arg-xcolor-fcolorbox (optional)
   "Insert arguments of \\fcolorbox from xcolor.sty."
   ;;\fcolorbox[<frame model>]{<frame spec>}[<background model>]{<background 
spec>}{<text>}
-  (let* ((last-optional-rejected nil)
+  (let* ((TeX-last-optional-rejected nil)
         (xfrmodel (LaTeX-check-insert-macro-default-style
                    (completing-read
                     (TeX-argument-prompt t nil "(Frame) Color model")
                     LaTeX-xcolor-color-models)))
-        ;; Set `last-optional-rejected' acc. to `xfrmodel'
-        (last-optional-rejected (or (not xfrmodel)
-                                    (and xfrmodel (string= xfrmodel ""))))
+        ;; Set `TeX-last-optional-rejected' acc. to `xfrmodel'
+        (TeX-last-optional-rejected (or (not xfrmodel)
+                                        (and xfrmodel (string= xfrmodel ""))))
         (xfrspec  (if (or (null xfrmodel)
                           (string= xfrmodel "")
                           (string= xfrmodel "named"))
diff --git a/tex.el b/tex.el
index fd4f2da..41e4150 100644
--- a/tex.el
+++ b/tex.el
@@ -3369,6 +3369,9 @@ Space will complete and exit."
         (let ((minibuffer-local-completion-map TeX-electric-macro-map))
           (call-interactively 'TeX-insert-macro)))))
 
+(defvar TeX-exit-mark nil
+  "Dynamically bound by `TeX-parse-macro' and `LaTeX-env-args'.")
+
 (defun TeX-parse-macro (symbol args)
   "How to parse TeX macros which takes one or more arguments.
 
@@ -3392,9 +3395,10 @@ TeX macro.  What is done depend on the type of the 
element:
   after the previous argument, or after the macro name if this is
   the first argument.  Please leave point located after the
   argument you are inserting.  If you want point to be located
-  somewhere else after all hooks have been processed, set the value
-  of `exit-mark'.  It will point nowhere, until the argument hook
-  set it.  By convention, these hooks all start with `TeX-arg-'.
+  somewhere else after all hooks have been processed, set the
+  value of `TeX-exit-mark'.  It will point nowhere, until the
+  argument hook set it.  By convention, these hooks all start
+  with `TeX-arg-'.
 
   list: If the car is a string, insert it as a prompt and the next
   element as initial input.  Otherwise, call the car of the list
@@ -3418,12 +3422,12 @@ TeX macro.  What is done depend on the type of the 
element:
             (> (point) (mark)))
        (exchange-point-and-mark))
     (insert TeX-esc symbol)
-    (let ((exit-mark (make-marker))
+    (let ((TeX-exit-mark (make-marker))
          (position (point)))
       (TeX-parse-arguments args)
-      (cond ((marker-position exit-mark)
-            (goto-char (marker-position exit-mark))
-            (set-marker exit-mark nil))
+      (cond ((marker-position TeX-exit-mark)
+            (goto-char (marker-position TeX-exit-mark))
+            (set-marker TeX-exit-mark nil))
            ((let ((element (assoc symbol TeX-insert-braces-alist)))
               ;; If in `TeX-insert-braces-alist' there is an element associated
               ;; to the current macro, use its value to decide whether 
inserting
@@ -3463,11 +3467,14 @@ INITIAL-INPUT is a string to insert before reading 
input."
      (TeX-read-string (TeX-argument-prompt optional prompt "Text") 
initial-input))
    optional))
 
+(defvar TeX-last-optional-rejected nil
+  "Dynamically bound by `TeX-parse-arguments'.")
+
 (defun TeX-parse-arguments (args)
   "Parse TeX macro arguments ARGS.
 
 See `TeX-parse-macro' for details."
-  (let ((last-optional-rejected nil))
+  (let ((TeX-last-optional-rejected nil))
     (while args
       (if (vectorp (car args))
          ;; Maybe get rid of all optional arguments.  See `TeX-insert-macro'
@@ -3482,7 +3489,7 @@ See `TeX-parse-macro' for details."
                          (equal current-prefix-arg '(4)))
                     (and (eq TeX-insert-macro-default-style 
'mandatory-args-only)
                          (null (equal current-prefix-arg '(4))))
-                    last-optional-rejected))
+                    TeX-last-optional-rejected))
            (let ((TeX-arg-opening-brace LaTeX-optop)
                  (TeX-arg-closing-brace LaTeX-optcl))
              (TeX-parse-argument t (if (equal (length (car args)) 1)
@@ -3490,7 +3497,7 @@ See `TeX-parse-macro' for details."
                                      (append (car args) nil)))))
        (let ((TeX-arg-opening-brace TeX-grop)
              (TeX-arg-closing-brace TeX-grcl))
-         (setq last-optional-rejected nil)
+         (setq TeX-last-optional-rejected nil)
          (TeX-parse-argument nil (car args))))
       (setq args (cdr args)))))
 
@@ -3535,7 +3542,7 @@ See `TeX-parse-macro' for details."
           (if (and (not optional) (TeX-active-mark))
               (progn
                 (exchange-point-and-mark))
-            (set-marker exit-mark (point)))
+            (set-marker TeX-exit-mark (point)))
           (insert TeX-arg-closing-brace)
           (setq insert-flag t))
          ((symbolp arg)
@@ -3559,13 +3566,13 @@ See `TeX-parse-macro' for details."
 If OPTIONAL, only insert it if not empty, and then use square brackets.
 If PREFIX is given, insert it before NAME."
   (if (and optional (string-equal name ""))
-      (setq last-optional-rejected t)
+      (setq TeX-last-optional-rejected t)
     (insert TeX-arg-opening-brace)
     (if prefix
        (insert prefix))
     (if (and (string-equal name "")
-            (null (marker-position exit-mark)))
-       (set-marker exit-mark (point))
+            (null (marker-position TeX-exit-mark)))
+       (set-marker TeX-exit-mark (point))
       (insert name))
     (insert TeX-arg-closing-brace)))
 

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

Summary of changes:
 doc/auctex.texi    |  4 ++--
 latex.el           | 18 +++++++++++-------
 style/bicaption.el |  6 +++---
 style/booktabs.el  |  2 +-
 style/caption.el   |  6 +++---
 style/color.el     |  4 ++--
 style/exam.el      | 20 ++++++++++++--------
 style/floatrow.el  | 10 +++++-----
 style/ifluatex.el  | 52 ++++++++++++++++++++++++++--------------------------
 style/xcolor.el    | 14 +++++++-------
 tex.el             | 35 +++++++++++++++++++++--------------
 11 files changed, 93 insertions(+), 78 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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