branch: externals/auctex commit a074732d46699dd26c43ad0f907abce9695ddbd1 Merge: 8fac199 a34b0fe Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Merge branch 'master' into simplify-TeX-parse-error --- ChangeLog | 45 ++++++++++++++++++++++++++++ latex.el | 2 +- preview/preview.el | 4 +- style/biblatex.el | 2 +- tex-buf.el | 84 ++++++++++++++++++++++++++++++--------------------- tex.el | 47 ++++++++++++++++++++++------- 6 files changed, 134 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index d60d2da..4162bec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,48 @@ +2014-07-14 Mos� Giordano <m...@gnu.org> + + * tex-buf.el (TeX-next-error): Do not pass `reparse' argument to + `next-error' in XEmacs as it is not supported. + (TeX-error-overview-frame, TeX-error-overview-buffer-name): Move + before their first use in order to prevent a runtime error in + XEmacs and GNU Emacs 21. Reported by Ikumi Keita. + (TeX-parse-TeX): Manually set `item' to nil when + `TeX-error-last-visited' is negative. + (TeX-error-description-error, TeX-error-description-warning) + (TeX-error-description-tex-said): Set to nil in XEmacs and GNU + Emacs 21. Reported by Ikumi Keita. + +2014-07-13 Mos� Giordano <m...@gnu.org> + + * latex.el (TeX-latex-mode): Add second argument to + `local-variable-p', mandatory in XEmacs. Suggested by Ikumi + Keita. + + * preview/preview.el (preview-dump-state): Ditto. + + * style/biblatex.el ("biblatex"): Ditto. + + * tex.el (TeX-how-many): Make the function return a number also in + XEmacs and Emacs 21. Suggested by Ikumi Keita. + +2014-07-12 Mos� Giordano <m...@gnu.org> + + * tex-buf.el (TeX-error-description-error): Do not use the + `default' display, not supported by GNU Emacs 21 and XEmacs 21.4. + (TeX-error-description-warning): Ditto. + +2014-07-11 Mos� Giordano <m...@gnu.org> + + * tex-buf.el (TeX-error-description-error): Make face definition + XEmacs compatible. + (TeX-error-description-tex-said): Ditto. + (TeX-error-description-help): Ditto. + + * tex.el (nil): Handle the case of a non-available crm.el with a + `condition-case', instead of using the third argument of + `require', not recognized by XEmacs 21.4. + (and): Check whether dbus support is available before requiring + dbus.el. + 2014-07-02 Mos� Giordano <giordano.m...@libero.it> * tex.el (TeX-expand-list): Set diff --git a/latex.el b/latex.el index fe439e5..5ba3efb 100644 --- a/latex.el +++ b/latex.el @@ -5541,7 +5541,7 @@ of `LaTeX-mode-hook'." ;; button could be wrongly set. (add-hook 'TeX-update-style-hook (lambda () - (if (local-variable-p 'LaTeX-biblatex-use-Biber) + (if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer)) (setq LaTeX-using-Biber LaTeX-biblatex-use-Biber))) nil t) (TeX-run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook) (TeX-set-mode-name) diff --git a/preview/preview.el b/preview/preview.el index 72f624d..8077af4 100644 --- a/preview/preview.el +++ b/preview/preview.el @@ -1,6 +1,6 @@ ;;; preview.el --- embed preview LaTeX images in source buffer -;; Copyright (C) 2001-2006, 2010, 2012 Free Software Foundation, Inc. +;; Copyright (C) 2001-2006, 2010-2014 Free Software Foundation, Inc. ;; Author: David Kastrup ;; Keywords: tex, wp, convenience @@ -3554,7 +3554,7 @@ In the form of yyyy.mmdd") (defun preview-dump-state (buffer) (condition-case nil (progn - (unless (local-variable-p 'TeX-command-buffer) + (unless (local-variable-p 'TeX-command-buffer (current-buffer)) (setq buffer (with-current-buffer buffer (TeX-active-buffer)))) (when (bufferp buffer) (insert "\nRun buffer contents:\n\n") diff --git a/style/biblatex.el b/style/biblatex.el index ff2d7d6..d5c3513 100644 --- a/style/biblatex.el +++ b/style/biblatex.el @@ -224,7 +224,7 @@ for citation keys." ;; the backend can be overridden by setting `LaTeX-biblatex-use-Biber' as a ;; local variable. (setq LaTeX-using-Biber - (if (local-variable-p 'LaTeX-biblatex-use-Biber) + (if (local-variable-p 'LaTeX-biblatex-use-Biber (current-buffer)) LaTeX-biblatex-use-Biber (not (or (LaTeX-provided-package-options-member "biblatex" "backend=bibtex") diff --git a/tex-buf.el b/tex-buf.el index 793b7be..0c9ff6f 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -292,7 +292,9 @@ message buffer and start at the first error." (if (or (null (TeX-active-buffer)) (eq 'compilation-mode (with-current-buffer TeX-command-buffer major-mode))) - (next-error arg reparse) + (if (featurep 'xemacs) + (next-error arg) + (next-error arg reparse)) ;; Force reparsing when the function is called with a universal-argument. (if (consp arg) (setq reparse t arg nil)) @@ -315,7 +317,7 @@ This works only with TeX commands and if the (let ((parse-function (TeX-get-parse-function))) (if (and TeX-parse-all-errors (equal parse-function 'TeX-parse-TeX)) - ;; When `TeX-parse-all-errors' and the parsing function is + ;; When `TeX-parse-all-errors' is non-nil and the parsing function is ;; `TeX-parse-TeX' we can move backward in the errors. (TeX-parse-TeX (- arg) nil) ;; XXX: moving backward in the errors hasn't yet been implemented for @@ -324,6 +326,12 @@ This works only with TeX commands and if the ;;; Command Query +(defvar TeX-error-overview-frame nil + "The frame of the error overview.") + +(defconst TeX-error-overview-buffer-name "*TeX errors*" + "Name of the buffer in which to show error list.") + (defun TeX-command (name file &optional override-confirm) "Run command NAME on the file returned by calling FILE. @@ -1550,7 +1558,10 @@ already in an Emacs buffer) and the cursor is placed at the error." (progn (setq max-index (length TeX-error-list) TeX-error-last-visited (+ (or arg 1) TeX-error-last-visited) - item (nth TeX-error-last-visited TeX-error-list)) + item (if (natnump TeX-error-last-visited) + (nth TeX-error-last-visited TeX-error-list) + ;; XEmacs doesn't support `nth' with a negative index. + nil)) (if (< TeX-error-last-visited -1) (setq TeX-error-last-visited -1)) (cond ((or (null item) @@ -1895,41 +1906,50 @@ warning." :group 'TeX-output) (defface TeX-error-description-error - ;; This is the same as `error' face in latest GNU Emacs versions. - '((default :weight bold) - (((class color) (min-colors 88) (background light)) :foreground "Red1") - (((class color) (min-colors 88) (background dark)) :foreground "Pink") - (((class color) (min-colors 16) (background light)) :foreground "Red1") - (((class color) (min-colors 16) (background dark)) :foreground "Pink") - (((class color) (min-colors 8)) :foreground "red") - (t :inverse-video t)) + (if (< emacs-major-version 22) + nil + ;; This is the same as `error' face in latest GNU Emacs versions. + '((((class color) (min-colors 88) (background light)) + :foreground "Red1" :weight bold) + (((class color) (min-colors 88) (background dark)) + :foreground "Pink" :weight bold) + (((class color) (min-colors 16) (background light)) + :foreground "Red1" :weight bold) + (((class color) (min-colors 16) (background dark)) + :foreground "Pink" :weight bold) + (((class color) (min-colors 8)) + :foreground "red" :weight bold) + (t (:inverse-video t :weight bold)))) "Face for \"Error\" string in error descriptions.") (defface TeX-error-description-warning - ;; This is the same as `warning' face in latest GNU Emacs versions. - '((default :weight bold) - (((class color) (min-colors 16)) :foreground "DarkOrange") - (((class color)) :foreground "yellow")) + (if (< emacs-major-version 22) + nil + ;; This is the same as `warning' face in latest GNU Emacs versions. + '((((class color) (min-colors 16)) :foreground "DarkOrange" :weight bold) + (((class color)) :foreground "yellow" :weight bold))) "Face for \"Warning\" string in error descriptions.") (defface TeX-error-description-tex-said - ;; This is the same as `font-lock-function-name-face' face in latest GNU Emacs - ;; versions. - '((((class color) (min-colors 88) (background light)) - :foreground "Blue1") - (((class color) (min-colors 88) (background dark)) - :foreground "LightSkyBlue") - (((class color) (min-colors 16) (background light)) - :foreground "Blue") - (((class color) (min-colors 16) (background dark)) - :foreground "LightSkyBlue") - (((class color) (min-colors 8)) - :foreground "blue" :weight bold) - (t :inverse-video t :weight bold)) + (if (< emacs-major-version 22) + nil + ;; This is the same as `font-lock-function-name-face' face in latest GNU + ;; Emacs versions. + '((((class color) (min-colors 88) (background light)) + :foreground "Blue1") + (((class color) (min-colors 88) (background dark)) + :foreground "LightSkyBlue") + (((class color) (min-colors 16) (background light)) + :foreground "Blue") + (((class color) (min-colors 16) (background dark)) + :foreground "LightSkyBlue") + (((class color) (min-colors 8)) + :foreground "blue" :weight bold) + (t (:inverse-video t :weight bold)))) "Face for \"TeX said\" string in error descriptions.") (defface TeX-error-description-help - '((t :inherit TeX-error-description-tex-said)) + '((t (:inherit TeX-error-description-tex-said))) "Face for \"Help\" string in error descriptions.") (defun TeX-help-error (error output runbuffer type) @@ -2425,9 +2445,6 @@ error." (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. @@ -2602,9 +2619,6 @@ forward, if negative)." (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") diff --git a/tex.el b/tex.el index 3cb5411..b2435e9 100644 --- a/tex.el +++ b/tex.el @@ -693,9 +693,13 @@ overlays." ;; (TeX-completing-read-multiple ...)) ;; ;; which results in a void-variable error if crm hasn't been loaded before. -(unless (require 'crm nil t) - (error "AUCTeX requires crm.el which is included in Emacs and -edit-utils >= 2.32 for XEmacs.")) +;; XEmacs 21.4 `require' doesn't have the third NOERROR argument, thus we handle +;; the file-error signal with a `condition-case' also in GNU Emacs. +(condition-case nil + (require 'crm) + (file-error + (error "AUCTeX requires crm.el which is included in Emacs and +edit-utils >= 2.32 for XEmacs."))) (if (fboundp 'completing-read-multiple) (defun TeX-completing-read-multiple @@ -1043,8 +1047,10 @@ The following built-in predicates are available: :group 'TeX-view :type '(alist :key-type symbol :value-type (group sexp))) -;; For `dbus-ignore-errors'. -(eval-when-compile (require 'dbus nil :no-error)) +;; Require dbus at compile time to prevent errors due to `dbus-ignore-errors' +;; not being defined. +(eval-when-compile (and (featurep 'dbusbind) + (require 'dbus nil :no-error))) (defun TeX-evince-dbus-p (&rest options) "Return non-nil, if evince is installed and accessible via DBUS. Additional OPTIONS may be given to extend the check. If none are @@ -5911,12 +5917,31 @@ NAME may be a package, a command, or a document." (defun TeX-how-many (regexp &optional rstart rend) "Compatibily function for `how-many'. -Supports restriction to a region where the XEmacs version doesn't." - (save-excursion - (save-restriction - (narrow-to-region rstart rend) - (goto-char (point-min)) - (how-many regexp)))) +Supports restriction to a region where the XEmacs version doesn't +and always returns the number of matches, also in XEmacs and GNU +Emacs 21." + ;; Emacs >= 22 does what we want. + (if (>= emacs-major-version 22) + (how-many regexp rstart rend) + ;; XEmacs and GNU Emacs 21 don't return the number of matches but only print + ;; it. + (let ((string + (if (featurep 'xemacs) + ;; XEmacs doesn't even support restriction to a region. + (save-excursion + (save-restriction + (when (and (integer-or-marker-p rstart) + (integer-or-marker-p rend)) + (narrow-to-region rstart rend) + (goto-char (point-min))) + (how-many regexp))) + (how-many regexp rstart rend)))) + ;; Hide the message printed by `how-many'. + (message "") + ;; Select the number of occurrences and convert it to a number. + (if (string-match "\\([0-9]+\\).*" string) + (string-to-number (replace-match "\\1" nil nil string)) + 0)))) (provide 'tex)