branch: main commit a2a6ab9f2211c77c991a649d04a7591627696ebb Merge: ebd714ef 38d8561a Author: Tassilo Horn <t...@gnu.org> Commit: Tassilo Horn <t...@gnu.org>
Merge remote-tracking branch 'origin/master' into externals/auctex --- doc/auctex.texi | 9 ++++ latex/preview.dtx | 23 ++++------ multi-prompt.el | 8 ++-- preview.el | 26 ++++-------- style/inputenc.el | 23 +++++----- style/multibib.el | 11 +++-- style/multido.el | 10 ++--- style/nameref.el | 4 +- tex.el | 123 +++++++++++++++++++++--------------------------------- 9 files changed, 101 insertions(+), 136 deletions(-) diff --git a/doc/auctex.texi b/doc/auctex.texi index a74489c2..1e06650f 100644 --- a/doc/auctex.texi +++ b/doc/auctex.texi @@ -4160,6 +4160,15 @@ list of manuals of the given package among to choose. The command can be invoked by the key binding mentioned above as well as the @samp{Find Documentation...} entry in the mode menu. + +Note that this command assumes @url{https://tug.org/texlive/, +@w{@TeX{} Live}}, not @url{https://miktex.org/,MiK@TeX{}}; according to +@url{https://tug.org/texdoc/, @samp{Texdoc} site}, +@quotation +A command named @command{texdoc} is also available in MiK@TeX{}, but it is +merely a shortcut for an independent program, @command{mthelp}. +@end quotation +Thus it isn't sure whether this command works for MiK@TeX{} or not. @end deffn @node Customization diff --git a/latex/preview.dtx b/latex/preview.dtx index de4675e9..f95de98a 100644 --- a/latex/preview.dtx +++ b/latex/preview.dtx @@ -20,7 +20,7 @@ % Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, % Boston, MA 02110-1301 USA % \fi -% \CheckSum{1794} +% \CheckSum{1758} % \GetFileInfo{preview.sty} % \date{\filedate} % \author{David Kastrup\thanks{\texttt{bug-auc...@gnu.org}}} @@ -429,27 +429,20 @@ % % \StopEventually{} % \section{The Implementation} -% Here we go: the start is somewhat obtuse since we figure out version -% number and date from RCS strings. This should really be done at +% We provide version and date manually. This should really be done at % docstrip time instead. Takers? % \begin{macro}{\pr@version} +% \begin{macro}{\pr@date} % \begin{macrocode} %<*style> %<*!active> -\NeedsTeXFormat{LaTeX2e} \def\reserved@a #1#2$#3: -#4${\xdef#1{\reserved@c #2#4 $}} \def\reserved@c #1 #2${#1} -\begingroup \catcode`\_=12 -\reserved@a\pr@version $Name: release_13_1 $ \ifx\pr@version\@empty -\reserved@a\pr@version CVS-$Revision: 1.126 $ \endgroup \else - \def\next release_{} \lccode`\_=`. - \edef\next{\lowercase{\endgroup - \def\noexpand\pr@version{\expandafter\next\pr@version}}} \next \fi -\reserved@a\next $Date: 2017/04/24 13:20:00 $ -\edef\next{\noexpand\ProvidesPackage{preview}% - [\next\space \pr@version\space (AUCTeX/preview-latex)]} -\next +\NeedsTeXFormat{LaTeX2e} +\def\pr@version{13.2} +\def\pr@date{2023/01/17} +\ProvidesPackage{preview}[\pr@date\space \pr@version\space (AUCTeX/preview-latex)] % \end{macrocode} % \end{macro} +% \end{macro} % Since many parts here will not be needed as long as the package is % inactive, we will include them enclosed with |<*active>| and % |</active>| guards. That way, we can append all of this stuff at a diff --git a/multi-prompt.el b/multi-prompt.el index 5ce11d51..d4ef5180 100644 --- a/multi-prompt.el +++ b/multi-prompt.el @@ -1,6 +1,6 @@ ;;; multi-prompt.el --- Completing read of multiple strings -*- lexical-binding: t; -*- -;; Copyright (C) 1996-2021 Free Software Foundation, Inc. +;; Copyright (C) 1996-2023 Free Software Foundation, Inc. ;; Author: Per Abrahamsen <abra...@dina.kvl.dk> ;; Maintainer: auctex-devel@gnu.org @@ -147,9 +147,9 @@ The value of FLAG is used to specify the type of completion operation. A value of nil specifies `try-completion'. A value of t specifies `all-completions'. A value of lambda specifes a test for an exact match. -For more information on STRING, PREDICATE, and FLAG, see the Elisp -Reference sections on 'Programmed Completion' and 'Basic Completion -Functions'." +For more information on STRING, PREDICATE, and FLAG, see the +Elisp Reference Info node `(elisp)Programmed Completion' and Info node +`(elisp)Basic Completion'." (let ((beg 0) (last 0) matched) (while (string-match multi-prompt-key-value-sep string beg) (setq matched t diff --git a/preview.el b/preview.el index 7796fcb4..758c7cfa 100644 --- a/preview.el +++ b/preview.el @@ -3628,23 +3628,15 @@ name(\\([^)]+\\))\\)\\|\ (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 (cl-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))))) + (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 (cl-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)))) (defun preview-get-geometry () "Transfer display geometry parameters from current display. diff --git a/style/inputenc.el b/style/inputenc.el index 14ff61c6..e2e28cd7 100644 --- a/style/inputenc.el +++ b/style/inputenc.el @@ -1,6 +1,6 @@ ;;; inputenc.el --- AUCTeX style for `inputenc.sty' -*- lexical-binding: t; -*- -;; Copyright (C) 2005-2021 Free Software Foundation, Inc. +;; Copyright (C) 2005-2023 Free Software Foundation, Inc. ;; Author: Arne Jørgensen <a...@arnested.dk> ;; Keywords: tex @@ -53,18 +53,17 @@ ;; if necessary offer to set the coding system for saving ;; this buffer based on the selected input encoding - (when (and (null - (coding-system-equal - (coding-system-base - (or coding-system-for-write - buffer-file-coding-system)) - (coding-system-base - (latexenc-inputenc-to-coding-system selected)))) - (y-or-n-p "Set coding system for saving this buffer? ") - (set-buffer-file-coding-system + (and (null (coding-system-equal + (coding-system-base + (or coding-system-for-write + buffer-file-coding-system)) (coding-system-base - (latexenc-inputenc-to-coding-system selected))) - (message nil))) + (latexenc-inputenc-to-coding-system selected)))) + (y-or-n-p "Set coding system for saving this buffer? ") + (set-buffer-file-coding-system + (coding-system-base + (latexenc-inputenc-to-coding-system selected))) + (message nil)) ;; return selected input encoding selected))) diff --git a/style/multibib.el b/style/multibib.el index f3afa5c0..3ee593ce 100644 --- a/style/multibib.el +++ b/style/multibib.el @@ -60,7 +60,7 @@ "Matches the arguments of \\newcites from multibib package.") (defun LaTeX-multibib-auto-prepare () - "Clear `LaTeX-auto-multibib-newcite' variables before parsing." + "Clear `LaTeX-auto-multibib-newcite' variable before parsing." (setq LaTeX-auto-multibib-newcite nil)) (defun LaTeX-multibib-auto-cleanup () @@ -107,14 +107,13 @@ (TeX-auto-add-regexp LaTeX-multibib-newcites-regexp) (TeX-add-symbols - '("newcites" - (TeX-arg-eval - (lambda () + `("newcites" + ,(lambda (optional) (let ((suf (TeX-read-string - (TeX-argument-prompt nil nil "Suffix")))) + (TeX-argument-prompt optional nil "Suffix")))) (LaTeX-add-multibib-newcites suf) (LaTeX-multibib-auto-cleanup) - (format "%s" suf)))) + (TeX-argument-insert suf optional))) "Heading") '("setbiblabelwidth" "Label")) diff --git a/style/multido.el b/style/multido.el index ec92edc6..61f84ae2 100644 --- a/style/multido.el +++ b/style/multido.el @@ -1,6 +1,6 @@ ;;; multido.el --- AUCTeX style for `multido.sty' -*- lexical-binding: t; -*- -;; Copyright (C) 2007, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2007--2023 Free Software Foundation, Inc. ;; Author: Holger Sparr <holger.sp...@gmx.net> ;; Created: 21 Jun 2007 @@ -41,10 +41,10 @@ "multido" (lambda () (TeX-add-symbols - '("multido" "\var=<start value>+-<inc>" "Repititions" t) - '("Multido" "\var=<start value>+-<inc>" "Repititions" t) - '("mmultido" "\var=<start value>+-<inc>" "Repititions" t) - '("MMultido" "\var=<start value>+-<inc>" "Repititions" t) + '("multido" "\\<var>=<start value>+<inc>" "Repititions" t) + '("Multido" "\\<var>=<start value>+<inc>" "Repititions" t) + '("mmultido" "\\<var>=<start value>+<inc>" "Repititions" t) + '("MMultido" "\\<var>=<start value>+<inc>" "Repititions" t) "multidostop" "multidocount" '("fpAdd" "Summand 1" "Summand 2" "Register") diff --git a/style/nameref.el b/style/nameref.el index ffbb9286..d4c7b10e 100644 --- a/style/nameref.el +++ b/style/nameref.el @@ -1,6 +1,6 @@ ;;; nameref.el --- AUCTeX style for `nameref.sty' -*- lexical-binding: t; -*- -;; Copyright (C) 2013, 2015, 2018, 2020 Free Software Foundation, Inc. +;; Copyright (C) 2013--2023 Free Software Foundation, Inc. ;; Author: Mads Jensen <m...@inducks.org> ;; Maintainer: auctex-devel@gnu.org @@ -49,7 +49,7 @@ '(("\\\\\\(?:N\\|n\\)ameref\\*?{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")) TeX-complete-list)) - ;, Fontification + ;; Fontification (when (and (fboundp 'font-latex-add-keywords) (fboundp 'font-latex-set-syntactic-keywords) (eq TeX-install-font-lock 'font-latex-setup)) diff --git a/tex.el b/tex.el index 456c0310..9328c525 100644 --- a/tex.el +++ b/tex.el @@ -6382,7 +6382,7 @@ tracker. Visit ") ;;; Documentation (defun TeX-documentation-texdoc (&optional arg) - "Run texdoc to read documentation. + "Run Texdoc to read documentation. Prompt for selection of the package of which to show the documentation. @@ -6390,81 +6390,54 @@ If called with a prefix argument ARG, after selecting the package, prompt for selection of the manual of that package to show." (interactive "P") - (let ((pkg (thing-at-point 'symbol)) - buffer list doc) - ;; Strip off properties. XXX: XEmacs doesn't have - ;; `substring-no-properties'. - (set-text-properties 0 (length pkg) nil pkg) - (setq pkg (TeX-read-string "View documentation for: " pkg)) - (unless (zerop (length pkg)) - (if arg - ;; Called with prefix argument: run "texdoc --list --nointeract <pkg>" - (progn - ;; Create the buffer, insert the result of the command, and - ;; accumulate the list of manuals. - (with-current-buffer (get-buffer-create - (setq buffer (format "*texdoc: %s*" pkg))) - (erase-buffer) - (insert (shell-command-to-string - (concat "texdoc --list --nointeract " pkg))) - (goto-char 1) ; No need to use `point-min' here. - (save-excursion + (if (not (executable-find "texdoc")) + (message "texdoc not found") + (let ((pkg (thing-at-point 'symbol t)) + buffer list doc) + (setq pkg (TeX-read-string "View documentation for: " pkg)) + (unless (zerop (length pkg)) + (if arg + ;; Called with prefix argument: + ;; run "texdoc --list --nointeract <pkg>" + (progn + ;; Create the buffer, insert the result of the command, + ;; and accumulate the list of manuals. + (with-current-buffer + (setq buffer (get-buffer-create (format "*texdoc: %s*" pkg))) + (erase-buffer) + (call-process "texdoc" nil t nil + "--list" "--nointeract" pkg) + (goto-char 1) ; No need to use `point-min' here. (while (re-search-forward - ;; XXX: XEmacs doesn't support character classes in - ;; regexps, like "[:alnum:]". - "^ *\\([0-9]+\\) +\\([-~/a-zA-Z0-9_.${}#%,:\\ ()]+\\)" nil t) - (push (cons (match-string 1) (match-string 2)) list)))) - (unwind-protect - (cond - ((null (executable-find "texdoc")) - ;; Note: `shell-command-to-string' uses shell, only - ;; `call-process' looks at `exec-path', thus only here makes - ;; sense to use `executable-find' to test whether texdoc is - ;; available. - (message "texdoc not found")) - (list - ;; Go on if there are manuals listed: show the buffer, prompt - ;; for the number of the manual, then run - ;; texdoc --just-view <doc> - (TeX-pop-to-buffer (get-buffer buffer)) - (condition-case nil - (when (setq doc - (cdr (assoc (TeX-read-string "Please enter \ -the number of the file to view, anything else to skip: ") list))) - (call-process "texdoc" nil 0 nil "--just-view" doc)) - ;; Exit gently if a `quit' signal is thrown. - (quit nil))) - (t (message "No documentation found for %s" pkg))) - ;; In any case quit-and-kill the window. - (when (get-buffer-window buffer) - (quit-window t (get-buffer-window buffer))))) - ;; Called without prefix argument: just run "texdoc --view <pkg>" and - ;; show the output, so that the user is warned in case it doesn't find - ;; the documentation or "texdoc" is not available. - (message "%s" - ;; The folowing code to the end of `defun' used to be - ;; just - ;; (shell-command-to-string (concat "texdoc --view " pkg)) - ;; , but in some cases it blocks emacs until the user - ;; quits the viewer (bug#28905). - (with-output-to-string - (let* (;; Use pipe rather than pty because the - ;; latter causes atril (evince variant - ;; viewer) to exit before showing anything. - (process-connection-type nil) - (process (start-process-shell-command - "Doc view" standard-output - (concat "texdoc --view " pkg)))) - ;; Suppress the message "Process Doc view - ;; finished". - (set-process-sentinel process #'ignore) - ;; Kill temp buffer without query. This is - ;; necessary, at least for some environment, if - ;; the underlying shell can't find the texdoc - ;; executable. - (set-process-query-on-exit-flag process nil) - ;; Don't discard shell output. - (accept-process-output process)))))))) + "^ *\\([0-9]+\\) +\\([-~/a-zA-Z0-9_.${}#%,:\\ ()]+\\)" + nil t) + (push (cons (match-string 1) (match-string 2)) list))) + (unwind-protect + (cond + (list + ;; Go on if there are manuals listed: show the + ;; buffer, prompt for the number of the manual, + ;; then run + ;; texdoc --just-view <doc> + (TeX-pop-to-buffer buffer) + (condition-case nil + (when (setq doc + (cdr (assoc (TeX-read-string "Please \ +enter the number of the file to view, anything else to skip: ") list))) + (call-process "texdoc" nil 0 nil "--just-view" doc)) + ;; Exit gently if a `quit' signal is thrown. + (quit nil))) + (t (message "No documentation found for %s" pkg))) + ;; In any case quit-and-kill the window. + (when (get-buffer-window buffer) + (quit-window t (get-buffer-window buffer))))) + ;; Called without prefix argument: + ;; just run "texdoc --view <pkg>". + ;; Recent Texdoc returns exit code 3 when it can't find the + ;; specified document, according to + ;; <URL:https://tug.org/texdoc/doc/texdoc.man1.pdf> + (if (= (call-process "texdoc" nil nil nil "--view" pkg) 3) + (message "No documentation found for %s" pkg))))))) (defun TeX-goto-info-page () "Read documentation for AUCTeX in the info system."