[Top][All Lists]

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 73e90bad58f6f274ab072

From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 73e90bad58f6f274ab0728f148e93082cb335767
Date: Fri, 8 Jan 2021 14:23:14 -0500 (EST)

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  73e90bad58f6f274ab0728f148e93082cb335767 (commit)
      from  ee00f56d8fed718d6d02b8a5a2b048e65e462c74 (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 73e90bad58f6f274ab0728f148e93082cb335767
Author: Tassilo Horn <>
Date:   Fri Jan 8 20:20:12 2021 +0100

    Declare formerly free vars accessible in TeX-translate-location-hook
    * tex-buf.el (TeX-translate-location-file,TeX-translate-location-offset)
    (TeX-translate-location-error,TeX-translate-location-context): New
    * tex-buf.el (TeX-find-display-help): Bind them before calling
    (TeX-translate-location-hook): Adapt docstring.

diff --git a/doc/changes.texi b/doc/changes.texi
index 257ac88..39cd713 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -69,6 +69,13 @@ previously undeclared variables @code{title}, @code{name}, 
 @code{done-mark}, and @code{reference}.  These variables are now
 properly declared and have the @code{ConTeXt-} prefix, e.g.,
+The functions in @code{TeX-translate-location-hook} could access and
+modify the free variables @code{file}, @code{line}, @code{error},
+@code{offset}, @code{context}, and @code{string}.  Those are now properly
+declared variables with the prefix @code{TeX-translate-location-}, e.g.,
 @end itemize
diff --git a/tex-buf.el b/tex-buf.el
index 94269ba..e4e80e5 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -2469,11 +2469,25 @@ already in an Emacs buffer) and the cursor is placed at 
the error."
 ;;; - Parsing (La)TeX
+(defvar TeX-translate-location-file nil)
+(defvar TeX-translate-location-offset nil)
+(defvar TeX-translate-location-line nil)
+(defvar TeX-translate-location-string nil)
+(defvar TeX-translate-location-error nil)
+(defvar TeX-translate-location-context nil)
 (defvar TeX-translate-location-hook nil
   "List of functions to be called before showing an error or warning.
-You might want to examine and modify the free variables `file',
-`offset', `line', `string', `error', and `context' from this hook.")
+You might want to examine and modify the dynamically bound
+  `TeX-translate-location-file',
+  `TeX-translate-location-offset',
+  `TeX-translate-location-line',
+  `TeX-translate-location-string',
+  `TeX-translate-location-error', and
+  `TeX-translate-location-context'
+from this hook.")
 ;; `ignore' flag should be the always the last one in the list of information
 ;; for each error/warning, because it can be set within `TeX-warning' by a
@@ -2657,39 +2671,51 @@ value is not used here."
         (master (with-current-buffer TeX-command-buffer
                   (expand-file-name (TeX-master-file))))
         (command-buffer TeX-command-buffer)
+        (TeX-translate-location-file file)
+        (TeX-translate-location-line line)
+        (TeX-translate-location-error error)
+        (TeX-translate-location-offset offset)
+        (TeX-translate-location-context context)
+        (TeX-translate-location-string string)
         error-file-buffer start)
     (run-hooks 'TeX-translate-location-hook)
-    (if file
+    (if TeX-translate-location-file
           (setq error-file-buffer
-                 (expand-file-name file (file-name-directory master))))
-          ;; Set the value of `TeX-command-buffer' in the next file with an
-          ;; error to be displayed to the value it has in the current buffer.
+                 (expand-file-name TeX-translate-location-file
+                                   (file-name-directory master))))
+          ;; Set the value of `TeX-command-buffer' in the next file
+          ;; with an error to be displayed to the value it has in the
+          ;; current buffer.
           (with-current-buffer error-file-buffer
-            (set (make-local-variable 'TeX-command-buffer) command-buffer))
+            (setq-local TeX-command-buffer command-buffer))
           ;; Find the location of the error or warning.
-          (when line
+          (when TeX-translate-location-line
             (goto-char (point-min))
-            (forward-line (+ offset line -1))
+            (forward-line (+ TeX-translate-location-offset
+                             TeX-translate-location-line -1))
              ;; Error.
              ((equal type 'error)
-              (if (not (string= string " "))
-                  (search-forward string nil t)))
+              (if (not (string= TeX-translate-location-string " "))
+                  (search-forward TeX-translate-location-string nil t)))
              ;; Warning or bad box.
               (beginning-of-line 0)
               (setq start (point))
               (goto-char (point-min))
-              (forward-line (+ offset line-end -1))
+              (forward-line (+ TeX-translate-location-offset
+                               line-end -1))
-              (when string
-                (search-backward string start t)
-                (search-forward string nil t))))))
-      ;; When the file cannot be determined stay here but issue a warning.
+              (when TeX-translate-location-string
+                (search-backward TeX-translate-location-string start t)
+                (search-forward TeX-translate-location-string nil t))))))
+      ;; When the file cannot be determined stay here but issue a
+      ;; warning.
       (message (concat "Could not determine file for "
                        (cond ((equal type 'error) "error")
                              (t "warning"))))
@@ -2702,11 +2728,13 @@ value is not used here."
            (TeX-pop-to-buffer error-file-buffer nil t))
-            error
-            (if (equal type 'warning) (concat "\n" context) context)
+            TeX-translate-location-error
+            (if (equal type 'warning)
+                (concat "\n" TeX-translate-location-context)
+              TeX-translate-location-context)
             runbuf type))
-           (message (concat "! " error))))))
+           (message (concat "! " TeX-translate-location-error))))))
 (defun TeX-error (&optional store)
   "Display an error.


Summary of changes:
 doc/changes.texi |  7 ++++++
 tex-buf.el       | 66 ++++++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 54 insertions(+), 19 deletions(-)


reply via email to

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