monnier pushed a commit to branch externals/auctex in repository elpa. commit bf5ac536ba17424dfbd87effb23730b0c75d4ed1 Author: Mosè Giordano <m...@gnu.org> Date: Sun Jul 13 16:42:04 2014 +0200
Fix some runtime issues in XEmacs. * 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. --- ChangeLog | 13 +++++++++++++ latex.el | 2 +- preview/preview.el | 4 ++-- style/biblatex.el | 2 +- tex.el | 31 +++++++++++++++++++++++++------ 5 files changed, 42 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index cfcbe41..4aeeee5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +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 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.el b/tex.el index db801d7..b2435e9 100644 --- a/tex.el +++ b/tex.el @@ -5917,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)