[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 73e90ba 09/11: Declare formerly f
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 73e90ba 09/11: Declare formerly free vars accessible in TeX-translate-location-hook |
Date: |
Fri, 8 Jan 2021 14:24:31 -0500 (EST) |
branch: externals/auctex
commit 73e90bad58f6f274ab0728f148e93082cb335767
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>
Declare formerly free vars accessible in TeX-translate-location-hook
* tex-buf.el (TeX-translate-location-file,TeX-translate-location-offset)
(TeX-translate-location-line,TeX-translate-location-string)
(TeX-translate-location-error,TeX-translate-location-context): New
defvars.
* tex-buf.el (TeX-find-display-help): Bind them before calling
TeX-translate-location-hook.
(TeX-translate-location-hook): Adapt docstring.
---
doc/changes.texi | 7 ++++++
tex-buf.el | 66 ++++++++++++++++++++++++++++++++++++++++----------------
2 files changed, 54 insertions(+), 19 deletions(-)
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{level},
@code{done-mark}, and @code{reference}. These variables are now
properly declared and have the @code{ConTeXt-} prefix, e.g.,
@code{ConTeXt-title}.
+
+@item
+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.,
+@code{TeX-translate-location-file}.
@end itemize
@item
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
+variables
+ `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
(progn
(setq error-file-buffer
(find-file
- (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))
(cond
;; 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.
(t
(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))
(end-of-line)
- (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))
(TeX-display-help
(TeX-help-error
- 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))
(t
- (message (concat "! " error))))))
+ (message (concat "! " TeX-translate-location-error))))))
(defun TeX-error (&optional store)
"Display an error.
- [AUCTeX-diffs] [elpa] externals/auctex updated (ab09ac9 -> eb98493), Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex eb117f2 01/11: Remove support for \swshape, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex 67bd5ff 02/11: Use frame-monitor-attributes for computing DPI if avail (bug#45596), Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex c5cd145 04/11: ; Fix typo., Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex db2236e 06/11: ; Revert silencing the compiler (commit 07b79fca8b), Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex 98ff870 05/11: ; Update copyright year, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex ee00f56 08/11: Use proper name rather than obsolete alias, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex fcb1aec 07/11: Update style/eso-pic.el to package version 3.0a, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex 9100b87 03/11: Use `write-contents-functions' instead of `write-file-functions', Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex 73e90ba 09/11: Declare formerly free vars accessible in TeX-translate-location-hook,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex 0eabe75 10/11: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2021/01/08
- [AUCTeX-diffs] [elpa] externals/auctex eb98493 11/11: Regenerate info docs, Tassilo Horn, 2021/01/08