branch: externals/auctex commit 0eabe75a8d5be0a83e8787911285013561c69832 Merge: ab09ac9 73e90ba Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Merge remote-tracking branch 'origin/master' into externals/auctex --- bib-cite.el | 16 +++++------- doc/changes.texi | 14 ++++++++++- doc/preview-latex.texi | 6 ++--- latex.el | 6 ++--- preview.el | 24 +++++++++++++++--- style/baskervaldx.el | 9 +++---- style/eso-pic.el | 13 ++++------ tex-buf.el | 66 +++++++++++++++++++++++++++++++++++--------------- tex.el | 4 +-- 9 files changed, 102 insertions(+), 56 deletions(-) diff --git a/bib-cite.el b/bib-cite.el index 095ccf5..bcf57ed 100644 --- a/bib-cite.el +++ b/bib-cite.el @@ -1,8 +1,7 @@ ;;; bib-cite.el --- test ;; bib-cite.el - Display \cite, \ref or \label / Extract refs from BiBTeX file. -;; Copyright (C) 1994-1999, 2001, 2003-2005, 2014, 2020 -;; Free Software Foundation, Inc. +;; Copyright (C) 1994-1999, 2001, 2003-2005, 2014-2021 Free Software Foundation, Inc. ;; Author: Peter S. Galbraith <p...@debian.org> ;; Created: 06 July 1994 @@ -983,14 +982,11 @@ documents, and the Emacs command `find-tag' doesn't allow to interactively find the next occurrence of a regexp." (interactive "P") (if (bib-master-file) ;Multi-file document - ;; FIXME: This check for `xref-find-definitions' should be - ;; removed once AUCTeX requires Emacs >= 25.1 - (let ((func (if (fboundp 'xref-find-definitions) - 'xref-find-definitions - 'find-tag))) - (if prev-p - (funcall func t '- t) - (funcall func t t t))) + ;; FIXME: `find-tag' is replaced by `xref-find-definitions' in + ;; Emacs 25.1. AUCTeX should track this change, sometime ... + (if prev-p + (find-tag t '- t) + (find-tag t t t)) (if bib-cite-search-ring ;;FIXME: Should first make sure I move off initial \ref{}. (let ((regexp (concat bib-ref-regexpc bib-cite-search-ring "}"))) diff --git a/doc/changes.texi b/doc/changes.texi index cc0156f..39cd713 100644 --- a/doc/changes.texi +++ b/doc/changes.texi @@ -1,5 +1,5 @@ @c This is part of the AUCTeX manual. -@c Copyright (C) 1994-2002, 2004-2010, 2012-2020 Free Software +@c Copyright (C) 1994-2002, 2004-2010, 2012-2021 Free Software @c Foundation, Inc. @c See file auctex.texi for copying conditions. @include macros.texi @@ -12,6 +12,11 @@ @itemize @bullet @item +Since @AUCTeX{} 12.2, @kbd{C-x C-w} accidentally disabled the parse on +save in that buffer, even when you enabled @code{TeX-auto-save} option. +This bug was fixed. + +@item @AUCTeX{} now requires GNU Emacs 24.3 or higher. @item @@ -64,6 +69,13 @@ previously undeclared variables @code{title}, @code{name}, @code{level}, @code{done-mark}, and @code{reference}. These variables are now properly declared and have the @code{ConTeXt-} prefix, e.g., @code{ConTeXt-title}. + +@item +The functions in @code{TeX-translate-location-hook} could access and +modify the free variables @code{file}, @code{line}, @code{error}, +@code{offset}, @code{context}, and @code{string}. Those are now properly +declared variables with the prefix @code{TeX-translate-location-}, e.g., +@code{TeX-translate-location-file}. @end itemize @item diff --git a/doc/preview-latex.texi b/doc/preview-latex.texi index b0c682a..b398ee1 100644 --- a/doc/preview-latex.texi +++ b/doc/preview-latex.texi @@ -10,7 +10,7 @@ This manual is for preview-latex, a @LaTeX{} preview mode for @AUCTeX{} (version @value{VERSION} from @value{UPDATED}). Copyright @copyright{} 2001, 2002, 2003, -2004, 2005, 2006, 2017, 2018 Free Software Foundation, Inc. +2004, 2005, 2006, 2017-2019, 2021 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -430,7 +430,7 @@ less correct. If you have a certain macro or environment that you want to preview, first check if it can be chosen by cutomizing -@code{preview-default-options-list} in the @code{Preview Latex} group. +@code{preview-default-option-list} in the @code{Preview Latex} group. If it is not available there, you can add it to @code{preview-default-preamble} also in the @code{Preview Latex} group, @@ -684,7 +684,7 @@ in @code{preview-gs-image-type-alist}. @code{preview-image-type} defaults to @code{png}. For this to work, your version of Ghostscript needs to support the @option{png16m} device. If you are experiencing problems here, you might want to reconfigure -@code{gs-image-type-alist} or @code{preview-image-type}. Reconfiguring +@code{preview-gs-image-type-alist} or @code{preview-image-type}. Reconfiguring @code{preview-image-creators} is only necessary for adding additional image types. diff --git a/latex.el b/latex.el index 2a21802..3639bf6 100644 --- a/latex.el +++ b/latex.el @@ -1,6 +1,6 @@ ;;; latex.el --- Support for LaTeX documents. -*- lexical-binding: t; -*- -;; Copyright (C) 1991, 1993-2020 Free Software Foundation, Inc. +;; Copyright (C) 1991, 1993-2021 Free Software Foundation, Inc. ;; Maintainer: auctex-de...@gnu.org ;; Keywords: tex @@ -831,7 +831,7 @@ environment just inserted, the buffer position just before (concat TeX-esc "end" TeX-grop environment TeX-grcl)) (match-beginning 0))) - (run-hook-with-args 'LaTeX-after-insert-env-hooks + (run-hook-with-args 'LaTeX-after-insert-env-hook environment env-start env-end))) (defun LaTeX-environment-name-regexp () @@ -1988,7 +1988,7 @@ The value is actually the tail of the list of options given to PACKAGE." It will setup BibTeX to store keys in an auto file." ;; We want this to be early in the list, so we do not ;; add it before we enter BibTeX mode the first time. - (add-hook 'write-file-functions #'TeX-safe-auto-write nil t) + (add-hook 'write-contents-functions #'TeX-safe-auto-write nil t) (TeX-bibtex-set-BibTeX-dialect) (set (make-local-variable 'TeX-auto-update) 'BibTeX) (set (make-local-variable 'TeX-auto-untabify) nil) diff --git a/preview.el b/preview.el index 2150a44..e8e57b4 100644 --- a/preview.el +++ b/preview.el @@ -3603,6 +3603,25 @@ name(\\([^)]+\\))\\)\\|\ snippet)) "Parser")))))))) (preview-call-hook 'close (car open-data) close-data)))))) +(defun preview-get-dpi () + ;; TODO: Remove false-case when required emacs version is bumped to + ;; 24.4 or newer as this is the version where + ;; `frame-monitor-attributes' has been introduced. + (if (fboundp 'frame-monitor-attributes) + (let* ((monitor-attrs (frame-monitor-attributes)) + (mm-dims (cdr (assoc 'mm-size monitor-attrs))) + (mm-width (nth 0 mm-dims)) + (mm-height (nth 1 mm-dims)) + (pixel-dims (cdddr (assoc 'geometry monitor-attrs))) + (pixel-width (nth 0 pixel-dims)) + (pixel-height (nth 1 pixel-dims))) + (cons (/ (* 25.4 pixel-width) mm-width) + (/ (* 25.4 pixel-height) mm-height))) + (cons (/ (* 25.4 (display-pixel-width)) + (display-mm-width)) + (/ (* 25.4 (display-pixel-height)) + (display-mm-height))))) + (defun preview-get-geometry () "Transfer display geometry parameters from current display. Returns list of scale, resolution and colors. Calculation @@ -3610,10 +3629,7 @@ is done in current buffer." (condition-case err (let* ((geometry (list (preview-hook-enquiry preview-scale-function) - (cons (/ (* 25.4 (display-pixel-width)) - (display-mm-width)) - (/ (* 25.4 (display-pixel-height)) - (display-mm-height))) + (preview-get-dpi) (preview-get-colors))) (preview-min-spec (* (cdr (nth 1 geometry)) diff --git a/style/baskervaldx.el b/style/baskervaldx.el index dce6c5f..a4cba48 100644 --- a/style/baskervaldx.el +++ b/style/baskervaldx.el @@ -1,6 +1,6 @@ ;;; baskervaldx.el --- AUCTeX style for `baskervaldx.sty' (v1.07) -*- lexical-binding: t; -*- -;; Copyright (C) 2014, 2015, 2018, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2014--2021 Free Software Foundation, Inc. ;; Author: Arash Esbati <ar...@gnu.org> ;; Maintainer: auctex-de...@gnu.org @@ -61,8 +61,7 @@ '("texttlf" t) ; tabular lining figures '("textosf" t) ; proportional oldstyle figures '("texttosf" t) ; tabular oldstyle figures - '("textsu" t) ; superior figures - '("swshape" -1)) ; italic shape with ligatures activated + '("textsu" t)) ; superior figures ;; Fontification (when (and (featurep 'font-latex) @@ -78,9 +77,7 @@ ("osfstyle" "") ("tosfstyle" "") ("sufigures" "")) - 'type-declaration) - (font-latex-add-keywords '(("swshape" "")) - 'bold-declaration))) + 'type-declaration))) TeX-dialect) (defvar LaTeX-baskervaldx-package-options diff --git a/style/eso-pic.el b/style/eso-pic.el index 1136fad..2ee93d0 100644 --- a/style/eso-pic.el +++ b/style/eso-pic.el @@ -1,6 +1,6 @@ -;;; eso-pic.el --- AUCTeX style for `eso-pic.sty' (v2.0d) -*- lexical-binding: t; -*- +;;; eso-pic.el --- AUCTeX style for `eso-pic.sty' (v3.0a) -*- lexical-binding: t; -*- -;; Copyright (C) 2014, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2014, 2020, 2021 Free Software Foundation, Inc. ;; Author: Arash Esbati <ar...@gnu.org> ;; Maintainer: auctex-de...@gnu.org @@ -26,7 +26,7 @@ ;;; Commentary: -;; This file adds support for `eso-pic.sty' (v2.0d) from 2013/10/06. +;; This file adds support for `eso-pic.sty' (v3.0a) from 2020/10/14. ;; `eso-pic.sty' is part of TeXLive. ;;; Code: @@ -38,12 +38,7 @@ "eso-pic" (lambda () - ;; Run style hook for eso-pic - (TeX-run-style-hooks "atbegshi") - - ;; New symbols (TeX-add-symbols - ;; Basic commands '("AddToShipoutPictureBG" t) '("AddToShipoutPictureBG*" t) @@ -79,10 +74,12 @@ '(("pscoord" ("true" "false")) ("texcoord" ("true" "false")) ("grid" ("true" "false")) + ("gridBG" ("true" "false")) ("gridunit" ("mm" "in" "bp" "pt")) ("gridcolor") ("subgridcolor") ("subgridstyle" ("solid" "dotted")) + ("colorgrid" ("true" "false")) ("dvips" ("true" "false"))) "Package options for the eso-pic package.") diff --git a/tex-buf.el b/tex-buf.el index 94269ba..e4e80e5 100644 --- a/tex-buf.el +++ b/tex-buf.el @@ -2469,11 +2469,25 @@ already in an Emacs buffer) and the cursor is placed at the error." ;;; - Parsing (La)TeX +(defvar TeX-translate-location-file nil) +(defvar TeX-translate-location-offset nil) +(defvar TeX-translate-location-line nil) +(defvar TeX-translate-location-string nil) +(defvar TeX-translate-location-error nil) +(defvar TeX-translate-location-context nil) + (defvar TeX-translate-location-hook nil "List of functions to be called before showing an error or warning. -You might want to examine and modify the free variables `file', -`offset', `line', `string', `error', and `context' from this hook.") +You might want to examine and modify the dynamically bound +variables + `TeX-translate-location-file', + `TeX-translate-location-offset', + `TeX-translate-location-line', + `TeX-translate-location-string', + `TeX-translate-location-error', and + `TeX-translate-location-context' +from this hook.") ;; `ignore' flag should be the always the last one in the list of information ;; for each error/warning, because it can be set within `TeX-warning' by a @@ -2657,39 +2671,51 @@ value is not used here." (master (with-current-buffer TeX-command-buffer (expand-file-name (TeX-master-file)))) (command-buffer TeX-command-buffer) + (TeX-translate-location-file file) + (TeX-translate-location-line line) + (TeX-translate-location-error error) + (TeX-translate-location-offset offset) + (TeX-translate-location-context context) + (TeX-translate-location-string string) error-file-buffer start) + (run-hooks 'TeX-translate-location-hook) - (if file + (if TeX-translate-location-file (progn (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. + (expand-file-name TeX-translate-location-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 - (set (make-local-variable 'TeX-command-buffer) command-buffer)) + (setq-local TeX-command-buffer command-buffer)) ;; Find the location of the error or warning. - (when line + (when TeX-translate-location-line (goto-char (point-min)) - (forward-line (+ offset line -1)) + (forward-line (+ TeX-translate-location-offset + TeX-translate-location-line -1)) (cond ;; Error. ((equal type 'error) - (if (not (string= string " ")) - (search-forward string nil t))) + (if (not (string= TeX-translate-location-string " ")) + (search-forward TeX-translate-location-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)) + (forward-line (+ TeX-translate-location-offset + line-end -1)) (end-of-line) - (when string - (search-backward string start t) - (search-forward string nil t)))))) - ;; When the file cannot be determined stay here but issue a warning. + (when TeX-translate-location-string + (search-backward TeX-translate-location-string start t) + (search-forward TeX-translate-location-string nil t)))))) + ;; When the file cannot be determined stay here but issue a + ;; warning. (message (concat "Could not determine file for " (cond ((equal type 'error) "error") (t "warning")))) @@ -2702,11 +2728,13 @@ value is not used here." (TeX-pop-to-buffer error-file-buffer nil t)) (TeX-display-help (TeX-help-error - error - (if (equal type 'warning) (concat "\n" context) context) + TeX-translate-location-error + (if (equal type 'warning) + (concat "\n" TeX-translate-location-context) + TeX-translate-location-context) runbuf type)) (t - (message (concat "! " error)))))) + (message (concat "! " TeX-translate-location-error)))))) (defun TeX-error (&optional store) "Display an error. diff --git a/tex.el b/tex.el index 936671a..8469dd0 100644 --- a/tex.el +++ b/tex.el @@ -1,6 +1,6 @@ ;;; tex.el --- Support for TeX documents. -*- lexical-binding: t; -*- -;; Copyright (C) 1985-2020 Free Software Foundation, Inc. +;; Copyright (C) 1985-2021 Free Software Foundation, Inc. ;; Maintainer: auctex-de...@gnu.org ;; Keywords: tex @@ -3715,7 +3715,7 @@ The algorithm is as follows: ;; We want this to be early in the list, so we do not add it before ;; we enter TeX mode the first time. - (add-hook 'write-file-functions #'TeX-safe-auto-write nil t) + (add-hook 'write-contents-functions #'TeX-safe-auto-write nil t) (set (make-local-variable 'TeX-auto-update) t) (define-key TeX-mode-map "\C-xng" 'TeX-narrow-to-group)