auctex-devel
[Top][All Lists]
Advanced

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

[AUCTeX-devel] [elpa] externals/auctex e414cbb 13/69: Merge branch 'mast


From: Tassilo Horn
Subject: [AUCTeX-devel] [elpa] externals/auctex e414cbb 13/69: Merge branch 'master' into simplify-TeX-parse-error
Date: Sat, 26 Mar 2016 21:36:32 +0000

branch: externals/auctex
commit e414cbbdfb152634385bc2b2a8f376ca8a558040
Merge: 8cee4a7 d8f06a7
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Merge branch 'master' into simplify-TeX-parse-error
---
 ChangeLog          |   16 +++++
 preview/ChangeLog  |    5 ++
 preview/preview.el |    2 +-
 tex-buf.el         |  163 +++++++++++++++++++++------------------------------
 4 files changed, 89 insertions(+), 97 deletions(-)

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/preview/ChangeLog b/preview/ChangeLog
index e443453..5ad7682 100644
--- a/preview/ChangeLog
+++ b/preview/ChangeLog
@@ -1,3 +1,8 @@
+2014-06-24  Tassilo Horn  <address@hidden>
+
+       * preview.el (preview-gs-command): Don't run the mgs command if
+       mgs is not installed.
+
 2013-09-05  Tassilo Horn  <address@hidden>
 
        * preview.el (preview-lispdir): New defvar.
diff --git a/preview/preview.el b/preview/preview.el
index 7b5aef6..72f624d 100644
--- a/preview/preview.el
+++ b/preview/preview.el
@@ -351,7 +351,7 @@ LIST consists of TeX dimensions in sp (1/65536 TeX point)."
       (let ((gs (executable-find "mgs")))
        ;; Check if mgs is functional for external non-MikTeX apps.
        ;; See 
http://blog.miktex.org/post/2005/04/07/Starting-mgsexe-at-the-DOS-Prompt.aspx
-       (when (= 0 (shell-command (concat gs " -q -dNODISPLAY -c quit")))
+       (when (and gs (= 0 (shell-command (concat gs " -q -dNODISPLAY -c 
quit"))))
          gs))
       ;; Windows ghostscript
       (executable-find "GSWIN32C.EXE")
diff --git a/tex-buf.el b/tex-buf.el
index b7b9d01..159d576 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -1542,7 +1542,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 "
" 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 "
" 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
 



reply via email to

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