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. bc9e5d622852c09d9f8d2


From: Mosè Giordano
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. bc9e5d622852c09d9f8d20a54db601c48cd99c4c
Date: Sat, 21 Jun 2014 16:59:45 +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  bc9e5d622852c09d9f8d20a54db601c48cd99c4c (commit)
      from  c2bdd117cc7fa70e22cabeddc9bee00ee6af83b0 (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 bc9e5d622852c09d9f8d20a54db601c48cd99c4c
Author: Mosè Giordano <address@hidden>
Date:   Sat Jun 21 18:57:23 2014 +0200

    Simplify error finding and help displaying functions.
    
    * tex-buf.el (TeX-parse-TeX): Use `TeX-find-display-help' in place
    of `TeX-error-list-find-display-help'.
    (TeX-error-list-find-display-help): Removed, replaced by more
    general `TeX-find-display-help'.
    (TeX-find-display-help): New function.
    (TeX-error): Append nils to the `TeX-error-list' entry to make
    each entry of the same lenght for both errors and warnings.
    Append also `TeX-error-point'.  This fixes a bug occurring when
    `TeX-display-help' is set to `expert'.  Use
    `TeX-find-display-help' to display the help.
    (TeX-warning): Append `TeX-error-point' to the `TeX-error-list'
    entry to fix the above mentioned bug.  Use `TeX-find-display-help'
    to display the help.

diff --git a/ChangeLog b/ChangeLog
index c663758..f408ff7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2014-06-21  Mosè Giordano  <address@hidden>
+
+       * tex-buf.el (TeX-parse-TeX): Use `TeX-find-display-help' in place
+       of `TeX-error-list-find-display-help'.
+       (TeX-error-list-find-display-help): Removed, replaced by more
+       general `TeX-find-display-help'.
+       (TeX-find-display-help): New function.
+       (TeX-error): Append nils to the `TeX-error-list' entry to make
+       each entry of the same lenght for both errors and warnings.
+       Append also `TeX-error-point'.  This fixes a bug occurring when
+       `TeX-display-help' is set to `expert'.  Use
+       `TeX-find-display-help' to display the help.
+       (TeX-warning): Append `TeX-error-point' to the `TeX-error-list'
+       entry to fix the above mentioned bug.  Use `TeX-find-display-help'
+       to display the help.
+
 2014-06-04  Mosè Giordano  <address@hidden>
 
        * tex-buf.el (TeX-parse-TeX): Use
diff --git a/tex-buf.el b/tex-buf.el
index e006ea6..61f5aa7 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -1539,7 +1539,7 @@ already in an Emacs buffer) and the cursor is placed at 
the error."
                   (beep)
                   (TeX-pop-to-buffer old-buffer))
                  (t
-                  (TeX-error-list-find-display-help item))))
+                  (apply 'TeX-find-display-help item))))
 
        (goto-char TeX-error-point)
        (TeX-parse-error old-buffer)))))
@@ -1688,19 +1688,62 @@ Return non-nil if an error or warning is found."
          t)))
     error-found))
 
-(defun TeX-error-list-find-display-help (item)
-  "Find the error and display the help associated to it.
-ITEM is an element of `TeX-error-list' with all relevant
-information about the error or warning."
-  (let ((type (car item)))
-    (apply (intern (concat "TeX-"
-                          (cond
-                           ((equal type 'error)
-                            "error")
-                           ((or (equal type 'warning) (equal type 'bad-box))
-                            "warning"))
-                          "--find-display-help"))
-          (cdr item))))
+(defun TeX-find-display-help (type file line error offset context string
+                                  line-end bad-box error-point)
+  "Find the error and display the help."
+  (unless file
+    (cond
+     ;; XXX: error messages have to be different?
+     ((equal type 'error)
+      (error "Error occurred after last TeX file closed"))
+     (t
+      (error "Could not determine file for warning"))))
+
+  ;; Go back to TeX-buffer
+  (let ((runbuf (current-buffer))
+       (master (with-current-buffer TeX-command-buffer
+                 (expand-file-name (TeX-master-file))))
+       (command-buffer TeX-command-buffer)
+       error-file-buffer start)
+    (run-hooks 'TeX-translate-location-hook)
+    (setq error-file-buffer (find-file file))
+    ;; 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))
+
+    ;; Find the location of the error or warning.
+    (when line
+      (goto-char (point-min))
+      (forward-line (+ offset line -1))
+      (cond
+       ;; Error.
+       ((equal type 'error)
+       (if (not (string= string " "))
+           (search-forward 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))
+       (end-of-line)
+       (when string
+         (search-backward string start t)
+         (search-forward string nil t)))))
+
+    ;; Display the help.
+    (cond ((eq TeX-display-help 'expert)
+          (TeX-pop-to-buffer runbuf nil t)
+          (goto-char error-point)
+          (TeX-pop-to-buffer error-file-buffer nil t))
+         (TeX-display-help
+          (TeX-help-error
+           error
+           (if (equal type 'warning) (concat "\n" context) context)
+           runbuf type))
+         (t
+          (message (concat "! " error))))))
 
 (defun TeX-error (&optional store)
   "Display an error.
@@ -1755,43 +1798,11 @@ information in `TeX-error-list' instead of displaying 
the error."
     (if store
        ;; Store the error information.
        (add-to-list 'TeX-error-list
-                    (list 'error file line error offset context string) t)
+                    (list 'error file line error offset context string nil nil
+                          TeX-error-point) t)
       ;; Find the error point and display the help.
-      (TeX-error--find-display-help
-       file line error offset context string))))
-
-(defun TeX-error--find-display-help (file line error offset context
-                                         string)
-  "Find the error and display the help."
-  ;; Find the error.
-  (if (null file)
-      (error "Error occurred after last TeX file closed"))
-  (let ((runbuf (current-buffer))
-       (master (with-current-buffer
-                   TeX-command-buffer
-                 (expand-file-name (TeX-master-file))))
-       (command-buffer TeX-command-buffer)
-       error-file-buffer)
-    (run-hooks 'TeX-translate-location-hook)
-    (setq error-file-buffer (find-file file))
-    ;; 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))
-    (goto-char (point-min))
-    (forward-line (+ offset line -1))
-    (if (not (string= string " "))
-       (search-forward string nil t))
-
-    ;; Explain the error.
-    (cond ((eq TeX-display-help 'expert)
-          (TeX-pop-to-buffer runbuf nil t)
-          (goto-char TeX-error-point)
-          (TeX-pop-to-buffer error-file-buffer nil t))
-         (TeX-display-help
-          (TeX-help-error error context runbuf 'error))
-         (t
-          (message (concat "! " error))))))
+      (TeX-find-display-help
+       'error file line error offset context string nil nil TeX-error-point))))
 
 (defun TeX-warning (warning &optional store)
   "Display a warning for WARNING.
@@ -1800,7 +1811,7 @@ If optional argument STORE is non-nil, store the warning
 information in `TeX-error-list' instead of displaying the
 warning."
 
-  (let* (;; bad-box is nil if this is a "LaTeX Warning"
+  (let* ( ;; bad-box is nil if this is a "LaTeX Warning"
         (bad-box (string-match "\\\\[vh]box.*[0-9]*--[0-9]*" warning))
         ;; line-string: match 1 is beginning line, match 2 is end line
         (line-string (if bad-box " \\([0-9]*\\)--\\([0-9]*\\)"
@@ -1848,52 +1859,12 @@ warning."
        ;; Store the warning information.
        (add-to-list 'TeX-error-list
                     (list (if bad-box 'bad-box 'warning) file line warning
-                          offset context string line-end bad-box) t)
+                          offset context string line-end bad-box
+                          TeX-error-point) t)
       ;; Find the warning point and display the help.
-      (TeX-warning--find-display-help
-       file line warning offset context string line-end bad-box))))
-
-(defun TeX-warning--find-display-help (file line error offset context
-                                           string line-end bad-box)
-  "Find the warning and display the help."
-  (unless file
-    (error "Could not determine file for warning"))
-
-  ;; Go back to TeX-buffer
-  (let ((runbuf (current-buffer))
-       (master (with-current-buffer
-                   TeX-command-buffer
-                 (expand-file-name (TeX-master-file))))
-       (command-buffer TeX-command-buffer)
-       error-file-buffer)
-    (run-hooks 'TeX-translate-location-hook)
-    (setq error-file-buffer (find-file file))
-    ;; 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))
-    ;; Find line and string
-    (when line
-      (goto-char (point-min))
-      (forward-line (+ offset line -1))
-      (beginning-of-line 0)
-      (let ((start (point)))
-       (goto-char (point-min))
-       (forward-line (+ offset line-end -1))
-       (end-of-line)
-       (when string
-         (search-backward string start t)
-         (search-forward string nil t))))
-    ;; Display help
-    (cond ((eq TeX-display-help 'expert)
-          (TeX-pop-to-buffer runbuf nil t)
-          (goto-char TeX-error-point)
-          (TeX-pop-to-buffer error-file-buffer nil t))
-         (TeX-display-help
-          (TeX-help-error error (if bad-box context (concat "\n" context))
-                          runbuf (if bad-box 'bad-box 'warning)))
-         (t
-          (message (concat "! " error))))))
+      (TeX-find-display-help (if bad-box 'bad-box 'warning) file line warning
+                            offset context string line-end bad-box
+                            TeX-error-point))))
 
 ;;; - Help
 

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

Summary of changes:
 ChangeLog  |   16 ++++++
 tex-buf.el |  163 +++++++++++++++++++++++++-----------------------------------
 2 files changed, 83 insertions(+), 96 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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