branch: externals/auctex commit 8fac19929e3a33ec62b5ad4a2862b675406afb4a Merge: e414cbb fe51d8e Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Merge branch 'master' into simplify-TeX-parse-error --- ChangeLog | 86 ++++++++++++++++ context.el | 4 +- doc/auctex.texi | 72 ++++++++++++-- doc/changes.texi | 24 +++-- doc/todo.texi | 40 ++------ tex-buf.el | 296 +++++++++++++++++++++++++++++++++++++++++++++++++++++- tex.el | 93 ++++++++++++------ 7 files changed, 530 insertions(+), 85 deletions(-) diff --git a/ChangeLog b/ChangeLog index f408ff7..d60d2da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,89 @@ +2014-07-02 Mos� Giordano <giordano.m...@libero.it> + + * tex.el (TeX-expand-list): Set + `TeX-source-correlate-output-page-function' when necessary, in the + "%(outpage)" expander. + (TeX-source-correlate-method): Add an alist as a possible value + and change the default. + (TeX-source-correlate-method-active): Convert to a function. + (TeX-source-correlate-expand-options): Use the + `TeX-source-correlate-method-active' function. + (TeX-source-correlate-mode): Remove setting of the + `TeX-source-correlate-output-page-function' variable and of the + now deleted `TeX-source-correlate-method-active' variable. + (TeX-source-specials-view-expand-options): Use the + `TeX-source-correlate-method-active' function. + (TeX-mode-specific-command-menu-entries): Hide "Previous Error" + and "Error Overview" entries when not available. + + * context.el: Update copyright years. + (ConTeXt-expand-options): Use the + `TeX-source-correlate-method-active' function. + + * doc/auctex.texi (I/O Correlation): Update documentation of + `TeX-source-correlate-method'. + + * doc/changes.texi: Mention change to the default value of + `TeX-source-correlate-method'. + +2014-06-29 Mos� Giordano <giordano.m...@libero.it> + + * doc/todo.texi (Mid-term Goals): Remove "More flexible option and + command handling" item: we now have `TeX-command-extra-options'. + (Wishlist): Remove "Poor man's Source Specials": AUCTeX supports + source specials and SyncTeX. + (Wishlist): Remove "multiple completion for \bibliography" item: + "\bibliography" does complete multiple arguments. + +2014-06-28 Mos� Giordano <giordano.m...@libero.it> + + * tex-buf.el (TeX-command): Kill the frame and buffer associated + to the error overview before running commands. + (TeX-TeX-sentinel): Open error overview if + `TeX-error-overview-open-after-TeX-run' is non-nil and there are + errors or warnings to show. + (TeX-LaTeX-sentinel): Ditto. + (TeX-find-display-help): Set `runbuf' to `TeX-active-buffer' since + this function may be called also from the error overview buffer. + (TeX-error-description-faces): Change group to more appropriate + `TeX-output'. + (TeX-error-overview-active-buffer): New variable. + (TeX-error-overview-orig-frame): Ditto. + (TeX-error-overview-orig-window): Ditto. + (TeX-error-overview-frame): Ditto. + (TeX-error-overview-setup): New customizable variable. + (TeX-error-overview-setup): New function. + (TeX-error-overview-goto-source): Ditto. + (TeX-error-overview-make-entries): Ditto. + (TeX-error-overview-next-error): Ditto. + (TeX-error-overview-previous-error): Ditto. + (TeX-error-overview-quit): Ditto. + (TeX-error-overview-mode-map): New variable. + (TeX-error-overview-list-entries): Ditto. + (TeX-error-overview-mode): New major mode. + (TeX-error-overview-buffer-name): New constant. + (TeX-error-overview-frame-parameters): New customizable variable. + (TeX-error-overview-open-after-TeX-run): Ditto. + (TeX-error-overview): New function. + (TeX-find-display-help): Expand the name of the file to be visited + starting from the directory of the master file. + (TeX-error-overview-make-entries): Add optional `master-dir' + argument, to shorten file names when they are relative. + (TeX-error-overview): Pass `TeX-master-directory' as argument to + `TeX-error-overview-make-entries'. + + * tex.el (TeX-error-overview): Autoload `TeX-error-overview'. + (TeX-mode-specific-command-menu-entries): Add an entry for the + error overview. + + * doc/auctex.texi (Debugging): Document error overview. + + * doc/changes.texi: Mention error overview. Add local variables + to the end of the file. + + * doc/todo.texi: Add local variables to the end of the file. + (Wishlist): Update entry about error reporting. + 2014-06-21 Mos� Giordano <giordano.m...@libero.it> * tex-buf.el (TeX-parse-TeX): Use `TeX-find-display-help' in place diff --git a/context.el b/context.el index ea333e5..3cc890f 100644 --- a/context.el +++ b/context.el @@ -1,6 +1,6 @@ ;;; context.el --- Support for ConTeXt documents. -;; Copyright (C) 2003-2006, 2008, 2010, 2012 +;; Copyright (C) 2003-2006, 2008, 2010, 2012, 2014 ;; Free Software Foundation, Inc. ;; Maintainer: Berend de Boer <ber...@pobox.com> @@ -1586,7 +1586,7 @@ else. There might be text before point." (format "--interface=%s " ConTeXt-current-interface)) (when TeX-source-correlate-mode (format "--passon=\"%s\" " - (if (eq TeX-source-correlate-method-active 'synctex) + (if (eq (TeX-source-correlate-method-active) 'synctex) TeX-synctex-tex-flags TeX-source-specials-tex-flags))) (unless TeX-interactive-mode diff --git a/doc/auctex.texi b/doc/auctex.texi index 6320543..48ffd0e 100644 --- a/doc/auctex.texi +++ b/doc/auctex.texi @@ -3041,16 +3041,26 @@ document parsing is enabled. Customize the variable @defopt TeX-source-correlate-method Method to use for enabling forward and inverse search. This can be @samp{source-specials} if source specials should be used, @samp{synctex} -if SyncTeX should be used, or @samp{auto} if @AUCTeX{} should decide, -this is the default. +if SyncTeX should be used, or @samp{auto} if @AUCTeX{} should decide. -When the variable is set to @samp{auto}, @AUCTeX{} will use SyncTeX if -your @code{latex} processor supports it, source specials otherwise. You -must make sure your viewer supports the same method. +When the variable is set to @samp{auto}, @AUCTeX{} will always use +SyncTeX if your @code{latex} processor supports it, source specials +otherwise. You must make sure your viewer supports the same method. -Setting this variable does not take effect if -@code{TeX-source-correlate-mode} has already been active. Restart Emacs -in this case. +It is also possible to specify a different method depending on the +output, either DVI or PDF, by setting the variable to an alist of the +kind +@lisp +((dvi . <source-specials or synctex>) + (pdf . <source-specials or synctex>)) +@end lisp +in which the CDR of each entry is a symbol specifying the method to be +used in the corresponding mode. The default value of the variable is +@lisp +((dvi . source-specials) + (pdf . synctex)) +@end lisp +which is compatible with the majority of viewers. @end defopt @findex TeX-view @@ -3130,7 +3140,7 @@ If t, @AUCTeX{} automatically parses the whole output log buffer right after running a @TeX{} command, in order to collect all warnings and errors. This makes it possible to navigate back and forth between the error messages using @code{TeX-next-error} and -@code{TeX-previous-error}. This is the default. If nil, @AUCTeX{} do +@code{TeX-previous-error}. This is the default. If nil, @AUCTeX{} does not parse the whole output log buffer and @code{TeX-previous-error} cannot be used. @end defopt @@ -3162,6 +3172,45 @@ terse information about the error is displayed in the echo area. If @TeX{} output. @end defopt +When the option @code{TeX-parse-all-errors} is non-nil, you will be also +able to open an overview of all errors and warnings reported by the TeX +compiler. This feature requires @code{tabulated-list-mode}, shipped +with GNU Emacs 24 or later. + +@deffn Command TeX-error-overview +Show an overview of the errors and warnings occurred in the last TeX +run. + +In this window you can visit the error on which point is on by pressing +@key{RET}, and visit the next or previous issue by pressing @key{n} or +@key{p} respectively. A prefix argument to these keys specifies how +many errors to move forward or backward. You can visit an error also by +clicking on its message. Press @key{q} to quit the overview. +@end deffn + +@defopt TeX-error-overview-open-after-TeX-run +When this boolean variable is non-nil, the error overview will be +automatically opened after running TeX if there are errors or warnings +to show. +@end defopt + +The error overview is opened in a new window of the current frame by +default, but you can change this behavior by customizing the option +@code{TeX-error-overview-setup}. + +@defopt TeX-error-overview-setup +Controls the frame setup of the error overview. The possible value is: +@code{separate-frame}; with a nil value the current frame is used +instead. + +The parameters of the separate frame can be set with the +@code{TeX-error-overview-frame-parameters} option. + +If the display does not support multi frame, the current frame +will be used regardless of the value of this variable. +@vindex TeX-error-overview-frame-parameters +@end defopt + @node Checking @section Checking for problems @cindex Checking @@ -5036,3 +5085,8 @@ used by @AUCTeX{} for sectioning. @printindex cp @bye + +@c Local Variables: +@c mode: texinfo +@c TeX-master: t +@c End: diff --git a/doc/changes.texi b/doc/changes.texi index 3c2273e..903d42e 100644 --- a/doc/changes.texi +++ b/doc/changes.texi @@ -17,8 +17,12 @@ @item Now @code{TeX-previous-error} works with @TeX{} commands if the new option @code{TeX-parse-all-errors} is non-nil, which is the default. -@code{TeX-next-error} and @code{TeX-previous-error} can take a numeric -argument to specify how many errors to move forward or backward. +When this option is non-nil, an overview of errors and warnings reported +by the TeX compiler can be opened with @kbd{M-x TeX-error-overview +@key{RET}}. +@ifclear rawfile +@xref{Debugging}, for details. +@end ifclear @item Style file authors are encouraged to distinguish common from expert @@ -43,17 +47,18 @@ Now you can insert @samp{$...$} or @samp{\(...\)} by typing a single @end ifclear @item -@kbd{C-c RET documentclass RET} completes with all available @LaTeX{} -classes, if the @code{TeX-arg-input-file-search} variable is non-nil. -Completion for class options of the standard @LaTeX{} classes is -provided as well. +@kbd{C-c @key{RET} documentclass @key{RET}} completes with all available +@LaTeX{} classes, if the @code{TeX-arg-input-file-search} variable is +non-nil. Completion for class options of the standard @LaTeX{} classes +is provided as well. @item New user options @code{LaTeX-default-author}, @code{TeX-insert-braces-alist}, @code{LaTeX-fontspec-arg-font-search}, and @code{LaTeX-fontspec-font-list-default}. A new possible value (@code{show-all-optional-args}) for -@code{TeX-insert-macro-default-style} was added. +@code{TeX-insert-macro-default-style} was added. The default value of +@code{TeX-source-correlate-method} has been changed. @item @samp{biblatex} support was greatly expanded. If parsing is enabled, @@ -933,3 +938,8 @@ Added by David Kastrup <David.Kastrup@@t-online.de>. @item Bug fixes. @end itemize + +@c Local Variables: +@c mode: texinfo +@c TeX-master: "auctex" +@c End: diff --git a/doc/todo.texi b/doc/todo.texi index b084ca5..1c78673 100644 --- a/doc/todo.texi +++ b/doc/todo.texi @@ -44,15 +44,6 @@ Further integration will happen at the backend. This involves folding of error parsing and task management of both packages which will ease development efforts and avoid redundant work. -@item More flexible option and command handling - -The current state of command handling with @code{TeX-command-list} is -not very flexible because there is no distinction between executables -and command line options to be passed to them. - -Customization of @code{TeX-command-list} by the user will interfere with -updates of @AUCTeX{}. - @item Error help catalogs Currently, the help for errors is more or less hardwired into @@ -89,12 +80,9 @@ requested yet. A special ispell dictionary for macros could be nice to have. -@item Quick error overviews +@item Improvements to error reporting -An error overview window (extract from the log file with just the error -lines, clickable like a ``grep'' buffer; @code{TeX-error-list} can be -used for this purpose) and/or fringe indicators for errors in the main -text would be nice. +Fringe indicators for errors in the main text would be nice. @item A math entry grid @@ -115,21 +103,6 @@ code of the @file{.dtx} file. For starters, @code{LaTeX-math-mode} is not very @LaTeX{}-specific in the first place, and similar holds for indentation and formatting. -@item Poor man's Source Specials -In particular in PDF mode (and where Source Specials cause problems), -alternatives would be desirable. One could implement inverse search by -something like Heiko Oberdiek's @file{vpe.sty}, and forward search by -using the @file{.aux} file info to correlate labels in the text -(possibly in cooperation with Ref@TeX{}) with previewer pages. - -In @AUCTeX{} 11.83, support for forward search with PDF files was added. -Currently this only works if you use the pdfsync @LaTeX{} package and -xpdf as your PDF viewer. -@ifclear rawfile -@xref{Viewing}. -@end ifclear - - @item Page count when compiling should (optionally) go to modeline of the window where the compilation command was invoked, instead of the output @@ -165,10 +138,6 @@ This default value for TeX-master could then be controled with mapping based on the extension. @item -Multiple argument completion for @samp{\bibliography}. In general, I -ought to make @kbd{,} special for these kind of completions. - -@item Suggest @samp{makeindex} when appropriate. @item @@ -340,3 +309,8 @@ signs and the like spilling out of the verbatim content. (XEmacs only) Folding of @LaTeX{} constructs spanning more than one line may result in overfull lines. (XEmacs only) @end itemize + +@c Local Variables: +@c mode: texinfo +@c TeX-master: "auctex" +@c End: diff --git a/tex-buf.el b/tex-buf.el index 159d576..793b7be 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -353,6 +353,13 @@ asked if it is positive, and suppressed if it is not." (read-from-minibuffer (concat name " command: ") command nil nil))) + ;; Kill the frame and buffer associated to the error overview before running + ;; the command. + (if (frame-live-p TeX-error-overview-frame) + (delete-frame TeX-error-overview-frame)) + (if (get-buffer TeX-error-overview-buffer-name) + (kill-buffer TeX-error-overview-buffer-name)) + ;; Now start the process (setq file (funcall file)) (TeX-process-set-variable file 'TeX-command-next TeX-command-Show) @@ -924,12 +931,18 @@ NAME is the name of the process.") "Cleanup TeX output buffer after running TeX. Parse the output buffer to collect errors and warnings if the -variable `TeX-parse-all-errors' is non-nil." +variable `TeX-parse-all-errors' is non-nil. + +Open the error overview if +`TeX-error-overview-open-after-TeX-run' is non-nil and there are +errors or warnings to show." (if (TeX-TeX-sentinel-check process name) () (message (concat name ": formatted " (TeX-current-pages))) (if TeX-parse-all-errors (TeX-parse-all-errors)) + (if (and TeX-error-overview-open-after-TeX-run TeX-error-list) + (TeX-error-overview)) (setq TeX-command-next TeX-command-Show))) (defun TeX-current-pages () @@ -993,9 +1006,15 @@ Warnings can be indicated by LaTeX or packages." "Cleanup TeX output buffer after running LaTeX. Parse the output buffer to collect errors and warnings if the -variable `TeX-parse-all-errors' is non-nil." +variable `TeX-parse-all-errors' is non-nil. + +Open the error overview if +`TeX-error-overview-open-after-TeX-run' is non-nil and there are +errors or warnings to show." (if TeX-parse-all-errors (TeX-parse-all-errors)) + (if (and TeX-error-overview-open-after-TeX-run TeX-error-list) + (TeX-error-overview)) (cond ((TeX-TeX-sentinel-check process name)) ((and (save-excursion (re-search-forward @@ -1700,13 +1719,15 @@ Return non-nil if an error or warning is found." (error "Could not determine file for warning")))) ;; Go back to TeX-buffer - (let ((runbuf (current-buffer)) + (let ((runbuf (TeX-active-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)) + (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. (with-current-buffer error-file-buffer @@ -1871,7 +1892,7 @@ warning." (defgroup TeX-error-description-faces nil "Faces used in error descriptions." :prefix "TeX-error-description-" - :group 'AUCTeX) + :group 'TeX-output) (defface TeX-error-description-error ;; This is the same as `error' face in latest GNU Emacs versions. @@ -2393,6 +2414,271 @@ error." (regexp :tag "Match") (string :format "Description:\n%v")))) +;;; Error Overview + +(defvar TeX-error-overview-active-buffer nil + "The active buffer for the current error overview.") + +(defvar TeX-error-overview-orig-frame nil + "Frame from which the error overview has been launched.") + +(defvar TeX-error-overview-orig-window nil + "Window from which the error overview has been launched.") + +(defvar TeX-error-overview-frame nil + "The frame of the error overview.") + +(defcustom TeX-error-overview-setup nil + "The frame setup of the error overview. + +The possible value is: `separate-frame' (error oveview in a +separate frame); with a nil value the current frame is used. + +If the display does not support multi frame, the current frame +will be used regardless of the value of this variable." + :group 'TeX-output + :type '(choice + (const :tag "Error overview in separate frame" separate-frame) + (const :tag "Use current frame" nil))) + +(defun TeX-error-overview-setup () + "Return the frame setup of the error overview for the current display." + (and (display-multi-frame-p) TeX-error-overview-setup)) + +(defun TeX-error-overview-goto-source (&optional button) + "Go to the error point in the source. +If optional argument BUTTON is non-nil, go to source associated +to the selected error." + (interactive) + (let ((index (if button (button-get button 'id) (tabulated-list-get-id))) + item window) + (if index + (progn + ;; Select the source frame/window, if still live. + (if (TeX-error-overview-setup) + (if (frame-live-p TeX-error-overview-orig-frame) + (select-frame TeX-error-overview-orig-frame) + (error "You have deleted a vital frame---\ +please restart TeX error overview")) + (if (window-live-p TeX-error-overview-orig-window) + (select-window TeX-error-overview-orig-window) + (error "You have deleted a vital window---\ +please restart TeX error overview"))) + ;; Get the error details. + (with-current-buffer TeX-error-overview-active-buffer + (setq item (nth index TeX-error-list) + TeX-error-last-visited index)) + ;; Find the error and display the help. + (with-current-buffer TeX-command-buffer + ;; For consistency with `TeX-parse-TeX', use the major mode of + ;; `TeX-command-buffer' when visiting the error point. + (let ((default-major-mode major-mode)) + ;; Find the error and display the help. + (apply 'TeX-find-display-help item))) + ;; Return to the error overview. + (if (TeX-error-overview-setup) + (select-frame TeX-error-overview-frame) + (if (setq window + (get-buffer-window TeX-error-overview-buffer-name)) + ;; If error overview window is visible just select it. + (select-window window) + ;; Otherwise, split the help window and display the error overview + ;; near to it. This should be the only reason for the error + ;; overview window not being still visible after the beginning of + ;; the function. + (select-window + (get-buffer-window (cond + ((eq TeX-display-help 'expert) + TeX-error-overview-active-buffer) + (TeX-display-help "*TeX Help*")))) + (if (window-splittable-p (selected-window) t) + (split-window-horizontally) + (split-window-vertically)) + (switch-to-buffer TeX-error-overview-buffer-name)))) + (message "No more errors.") + (beep)))) + +(defun TeX-error-overview-make-entries (&optional master-dir) + "Generate the list of errors to be printed using `tabulated-list-entries'. +Write file names relative to MASTER-DIR when they are not absolute." + (with-current-buffer TeX-error-overview-active-buffer + (let ((id 0) + type file line msg entries) + (mapc + (lambda (entry) + (setq type (nth 0 entry) + file (nth 1 entry) + line (nth 2 entry) + msg (nth 3 entry)) + (add-to-list + 'entries + (list + ;; ID. + id + (vector + ;; File. + (if (stringp file) + (if (file-name-absolute-p file) + file + (file-relative-name file master-dir)) + "") + ;; Line. + (if (numberp line) + (number-to-string line) + "") + ;; Type. + (cond + ((equal type 'error) + (propertize "Error" 'font-lock-face 'TeX-error-description-error)) + ((equal type 'warning) + (propertize "Warning" 'font-lock-face + 'TeX-error-description-warning)) + ((equal type 'bad-box) + (propertize "Bad box" 'font-lock-face + 'TeX-error-description-warning)) + (t + "")) + ;; Message. + (list (if (stringp msg) msg "") + 'face 'link + 'follow-link t + 'id id + 'action 'TeX-error-overview-goto-source) + )) t) + (setq id (1+ id))) TeX-error-list) + entries))) + +(defun TeX-error-overview-next-error (&optional arg) + "Move to the next line and find the associated error. + +A prefix ARG specifies how many error messages to move; negative +means move back to previous error messages." + (interactive "p") + (if (= (forward-line arg) 0) + (TeX-error-overview-goto-source) + ;; If there are lines left to move we are at the beginning or at the end of + ;; the buffer and there are no more errors. + (message "No more errors.") + (beep))) + +(defun TeX-error-overview-previous-error (&optional arg) + "Move to the previous line and find the associated error. + +Prefix arg N says how many error messages to move backward (or +forward, if negative)." + (interactive "p") + (TeX-error-overview-next-error (- arg))) + +(defun TeX-error-overview-quit () + "Delete the window or the frame of the error overview." + (interactive) + (if (TeX-error-overview-setup) + (delete-frame TeX-error-overview-frame) + (delete-window)) + (setq TeX-error-overview-orig-frame nil)) + +(defvar TeX-error-overview-mode-map + (let ((map (make-sparse-keymap)) + (menu-map (make-sparse-keymap))) + (define-key map "n" 'TeX-error-overview-next-error) + (define-key map "p" 'TeX-error-overview-previous-error) + (define-key map "q" 'TeX-error-overview-quit) + (define-key map "\C-m" 'TeX-error-overview-goto-source) + map) + "Local keymap for `TeX-error-overview-mode' buffers.") + +(defvar TeX-error-overview-list-entries nil + "List of errors to be used in the error overview.") + +(define-derived-mode TeX-error-overview-mode tabulated-list-mode + "TeX errors" + "Major mode for listing TeX errors." + (setq tabulated-list-format [("File" 25 nil) + ("Line" 4 nil :right-align t) + ("Type" 7 nil) + ("Message" 0 nil)] + tabulated-list-padding 1 + tabulated-list-entries TeX-error-overview-list-entries) + (tabulated-list-init-header) + (tabulated-list-print)) + +(defconst TeX-error-overview-buffer-name "*TeX errors*" + "Name of the buffer in which to show error list.") + +(defcustom TeX-error-overview-frame-parameters + '((name . "TeX errors") + (title . "TeX errors") + (height . 10) + (width . 80) + (top . (- 0)) + (left . (- 0)) + (unsplittable . t) + (minibuffer . nil) + (vertical-scroll-bars . t) + (tool-bar-lines . 0)) + "Parameters of the error overview frame." + :group 'TeX-output + :type 'alist + :options '((name string) (title string) (height integer) (width integer) + (top integer) (left integer) (unsplittable boolean) + (minibuffer boolean) (vertical-scroll-bars boolean) + (tool-bar-lines integer))) + +(defcustom TeX-error-overview-open-after-TeX-run nil + "Whether to open automatically the error overview after running TeX." + :group 'TeX-output + :type 'boolean) + +(defun TeX-error-overview () + "Show an overview of the errors occurred in the last TeX run." + (interactive) + ;; Check requirements before start. + (if (fboundp 'tabulated-list-mode) + (if (setq TeX-error-overview-active-buffer (TeX-active-buffer)) + (if (with-current-buffer TeX-error-overview-active-buffer + TeX-error-list) + (progn + (setq TeX-error-overview-list-entries + (TeX-error-overview-make-entries (TeX-master-directory)) + TeX-error-overview-orig-window (selected-window) + TeX-error-overview-orig-frame + (window-frame TeX-error-overview-orig-window)) + ;; Create the error overview buffer. This is + ;; automatically killed before running TeX commands, so if + ;; exists it is up-to-date and doesn't need to be + ;; re-created. + (unless (get-buffer TeX-error-overview-buffer-name) + (with-current-buffer + (get-buffer-create TeX-error-overview-buffer-name) + (TeX-error-overview-mode))) + ;; Move point to the line associated to the last visited + ;; error. + (with-current-buffer TeX-error-overview-buffer-name + (goto-char (point-min)) + (forward-line (with-current-buffer + TeX-error-overview-active-buffer + TeX-error-last-visited)) + ;; Create a new frame for the error overview or display the + ;; buffer in the same frame, depending on the setup. + (if (TeX-error-overview-setup) + (if (frame-live-p TeX-error-overview-frame) + ;; Do not create a duplicate frame if there is + ;; already one, just select it. + (select-frame-set-input-focus + TeX-error-overview-frame) + ;; Create a new frame and store its name. + (select-frame + (setq TeX-error-overview-frame + (make-frame + TeX-error-overview-frame-parameters))) + (set-window-buffer (selected-window) + TeX-error-overview-buffer-name) + (set-window-dedicated-p (selected-window) t)) + (TeX-pop-to-buffer TeX-error-overview-buffer-name)))) + (error "No errror or warning to show")) + (error "No process for this document")) + (error "Error overview is available only in Emacs 24 or later"))) + ;;; Output mode (if (fboundp 'special-mode) diff --git a/tex.el b/tex.el index 89b7437..3cb5411 100644 --- a/tex.el +++ b/tex.el @@ -418,15 +418,15 @@ string." ;; to handle .ps files. (defcustom TeX-expand-list - '(("%p" TeX-printer-query) ;%p must be the first entry + '(("%p" TeX-printer-query) ;%p must be the first entry ("%q" (lambda () (TeX-printer-query t))) ("%V" (lambda () (TeX-source-correlate-start-server-maybe) (TeX-view-command-raw))) ("%vv" (lambda () - (TeX-source-correlate-start-server-maybe) - (TeX-output-style-check TeX-output-view-style))) + (TeX-source-correlate-start-server-maybe) + (TeX-output-style-check TeX-output-view-style))) ("%v" (lambda () (TeX-source-correlate-start-server-maybe) (TeX-style-check TeX-view-style))) @@ -465,8 +465,16 @@ string." ("%dS" TeX-source-specials-view-expand-options) ("%cS" TeX-source-specials-view-expand-client) ("%(outpage)" (lambda () - (or (when TeX-source-correlate-output-page-function - (funcall TeX-source-correlate-output-page-function)) + ;; When `TeX-source-correlate-output-page-function' is nil + ;; and we are using synctex, fallback on + ;; `TeX-synctex-output-page'. + (and TeX-source-correlate-mode + (null TeX-source-correlate-output-page-function) + (eq (TeX-source-correlate-method-active) 'synctex) + (setq TeX-source-correlate-output-page-function + 'TeX-synctex-output-page)) + (or (if TeX-source-correlate-output-page-function + (funcall TeX-source-correlate-output-page-function)) "1"))) ;; `file' means to call `TeX-master-file' or `TeX-region-file' ("%s" file nil t) @@ -502,7 +510,7 @@ string." (setq pos (+ (length TeX-command-text) 9) TeX-command-pos (and (string-match " " - (funcall file t t)) + (funcall file t t)) "\"")) (concat TeX-command-text " \"\\input\"")) (setq TeX-command-pos nil) @@ -551,6 +559,7 @@ the name of the file being processed, with an optional extension." (autoload 'TeX-kill-job "tex-buf" nil t) (autoload 'TeX-recenter-output-buffer "tex-buf" nil t) (autoload 'TeX-next-error "tex-buf" nil t) +(autoload 'TeX-error-overview "tex-buf" nil t) (autoload 'TeX-region-file "tex-buf" nil nil) (autoload 'TeX-current-offset "tex-buf" nil nil) (autoload 'TeX-process-set-variable "tex-buf" nil nil) @@ -1399,21 +1408,39 @@ For available TYPEs, see variable `TeX-engine'." ;;; Forward and inverse search -(defcustom TeX-source-correlate-method 'auto +(defcustom TeX-source-correlate-method + '((dvi . source-specials) (pdf . synctex)) "Method to use for enabling forward and inverse search. This can be `source-specials' if source specials should be used, -`synctex' if SyncTeX should be used, or`auto' if AUCTeX should +`synctex' if SyncTeX should be used, or `auto' if AUCTeX should decide. -Setting this variable does not take effect if TeX Source -Correlate mode has already been active. Restart Emacs in this -case." - :type '(choice (const auto) (const synctex) (const source-specials)) +The previous values determine the variable for both DVI and PDF +mode. This variable can also be an alist of the kind + + ((dvi . <source-specials or synctex>) + (pdf . <source-specials or synctex>)) + +in which the CDR of each entry is a symbol specifying the method +to be used in the corresponding mode. + +Programs should not use this variable directly but the function +`TeX-source-correlate-method-active' which returns the method +actually used for forward and inverse search." + :type '(choice (const auto) + (const synctex) + (const source-specials) + (list :tag "Different method for DVI and PDF" + (cons (const dvi) + (choice :tag "Method for DVI mode" + (const synctex) + (const source-specials))) + (cons (const pdf) + (choice :tag "Method for PDF mode" + (const synctex) + (const source-specials))))) :group 'TeX-view) -(defvar TeX-source-correlate-method-active nil - "Method actually used for forward and inverse search.") - (defvar TeX-source-correlate-output-page-function nil "Symbol of function returning an output page relating to buffer position. The function should take no arguments and return the page numer @@ -1486,12 +1513,24 @@ This is the case if `TeX-source-correlate-start-server-flag' is non-nil." 'synctex 'source-specials))) +(defun TeX-source-correlate-method-active () + "Return the method actually used for forward and inverse search." + (cond + ((eq TeX-source-correlate-method 'auto) + (TeX-source-correlate-determine-method)) + ((listp TeX-source-correlate-method) + (if TeX-PDF-mode + (cdr (assoc 'pdf TeX-source-correlate-method)) + (cdr (assoc 'dvi TeX-source-correlate-method)))) + (t + TeX-source-correlate-method))) + (defun TeX-source-correlate-expand-options () "Return TeX engine command line option for forward search facilities. The return value depends on the value of `TeX-source-correlate-mode'. If this is nil, an empty string will be returned." (if TeX-source-correlate-mode - (if (eq TeX-source-correlate-method-active 'source-specials) + (if (eq (TeX-source-correlate-method-active) 'source-specials) (concat TeX-source-specials-tex-flags (if TeX-source-specials-places ;; -src-specials=WHERE: insert source specials @@ -1570,16 +1609,8 @@ SyncTeX are recognized." (dbus-register-signal :session nil "/org/gnome/evince/Window/0" "org.gnome.evince.Window" "SyncSource" - 'TeX-source-correlate-sync-source)) - (unless TeX-source-correlate-method-active - (setq TeX-source-correlate-method-active - (if (eq TeX-source-correlate-method 'auto) - (TeX-source-correlate-determine-method) - TeX-source-correlate-method))) - (when (eq TeX-source-correlate-method-active 'synctex) - (setq TeX-source-correlate-output-page-function - (when TeX-source-correlate-mode - 'TeX-synctex-output-page)))) + 'TeX-source-correlate-sync-source))) + (defalias 'TeX-source-specials-mode 'TeX-source-correlate-mode) (make-obsolete 'TeX-source-specials-mode 'TeX-source-correlate-mode "11.86") (defalias 'tex-source-correlate-mode 'TeX-source-correlate-mode) @@ -1667,7 +1698,7 @@ The return value depends on the values of `source-specials' respectively, an empty string will be returned." (if (and TeX-source-correlate-mode - (eq TeX-source-correlate-method-active 'source-specials)) + (eq (TeX-source-correlate-method-active) 'source-specials)) (concat TeX-source-specials-view-position-flags (when (TeX-source-correlate-server-enabled-p) (concat " " TeX-source-specials-view-editor-flags))) @@ -4420,7 +4451,11 @@ Brace insertion is only done if point is in a math construct and ["Next Error" TeX-next-error :help "Jump to the next error of the last TeX run"] ["Previous Error" TeX-previous-error - :help "Jump to the previous error of the last TeX run"] + :help "Jump to the previous error of the last TeX run" + :visible TeX-parse-all-errors] + ["Error Overview" TeX-error-overview + :help "Open an overview of errors occured in the last TeX run" + :visible (and TeX-parse-all-errors (fboundp 'tabulated-list-mode))] ["Quick View" TeX-view :help "Start a viewer without prompting"] "-" @@ -4448,7 +4483,7 @@ Brace insertion is only done if point is in a math construct and ["Debug Warnings" TeX-toggle-debug-warnings :style toggle :selected TeX-debug-warnings :help "Make \"Next Error\" show warnings"]))) - (let ((file 'TeX-command-on-current));; is this actually needed? + (let ((file 'TeX-command-on-current)) ;; is this actually needed? (TeX-maybe-remove-help (delq nil (mapcar 'TeX-command-menu-entry