[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex a98121b 3/7: Untabify tex.el.
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex a98121b 3/7: Untabify tex.el. |
Date: |
Tue, 29 Dec 2020 12:13:42 -0500 (EST) |
branch: externals/auctex
commit a98121bf1f39e593b01e53966eb8b3e0b448d093
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>
Untabify tex.el.
---
tex.el | 4374 ++++++++++++++++++++++++++++++++--------------------------------
1 file changed, 2187 insertions(+), 2187 deletions(-)
diff --git a/tex.el b/tex.el
index 6c66f28..b255d39 100644
--- a/tex.el
+++ b/tex.el
@@ -29,8 +29,8 @@
;;; Code:
(when (or (< emacs-major-version 24)
- (and (= emacs-major-version 24)
- (< emacs-minor-version 3)))
+ (and (= emacs-major-version 24)
+ (< emacs-minor-version 3)))
(error "AUCTeX requires Emacs 24.3 or later"))
(require 'custom)
@@ -41,24 +41,24 @@
;; Silence the compiler for functions:
(declare-function dbus-ignore-errors "ext:dbus"
- (&rest body))
+ (&rest body))
(declare-function dbus-get-unique-name "ext:dbusbind.c"
- (bus))
+ (bus))
(declare-function dbus-ping "ext:dbus"
- (bus service &optional timeout))
+ (bus service &optional timeout))
(declare-function dbus-introspect-get-method "ext:dbus"
- (bus service path interface method))
+ (bus service path interface method))
(declare-function dbus-call-method "ext:dbus"
- (bus service path interface method &rest args))
+ (bus service path interface method &rest args))
(declare-function dbus-register-signal "ext:dbus"
- (bus service path interface signal handler &rest args))
+ (bus service path interface signal handler &rest args))
(declare-function LaTeX-environment-list "latex"
- nil)
+ nil)
(declare-function tex--prettify-symbols-compose-p "ext:tex-mode"
- (start end match))
+ (start end match))
;; spell-buffer was removed in 2008 in favor of ispell
(declare-function spell-buffer "ext:text-mode"
- t)
+ t)
;; Silence the compiler for variables:
;; tex.el: Variables defined somewhere in this file:
@@ -98,8 +98,8 @@
;; graphicx.el
(defvar LaTeX-includegraphics-global-files)
;; Others:
-(defvar tex--prettify-symbols-alist) ; tex-mode.el
-(defvar Info-file-list-for-emacs) ; info.el
+(defvar tex--prettify-symbols-alist) ; tex-mode.el
+(defvar Info-file-list-for-emacs) ; info.el
(defvar dbus-debug) ; dbus.el
(defgroup TeX-file nil
@@ -134,8 +134,8 @@
"Command to run plain TeX on Omega."
:group 'TeX-command
:type '(choice (const :tag "Aleph" "aleph")
- (const :tag "Omega" "omega")
- (string :tag "Other command")))
+ (const :tag "Omega" "omega")
+ (string :tag "Other command")))
(defcustom LaTeX-command "latex"
"Command to run LaTeX."
@@ -146,8 +146,8 @@
"Command to run LaTeX on Omega."
:group 'TeX-command
:type '(choice (const :tag "Lamed" "lamed")
- (const :tag "Lambda" "lambda")
- (string :tag "Other command")))
+ (const :tag "Lambda" "lambda")
+ (string :tag "Other command")))
(defcustom TeX-file-line-error t
"Whether to have TeX produce file:line:error style error messages."
@@ -159,14 +159,14 @@
If nil, none is specified."
:group 'TeX-command
:type '(choice (const :tag "Unspecified" nil)
- string))
+ string))
(defcustom ConTeXt-Omega-engine TeX-Omega-command
"Engine to use for --engine in the texexec command in Omega mode.
If nil, none is specified."
:group 'TeX-command
:type '(choice (const :tag "Unspecified" nil)
- string))
+ string))
;; At least in TeXLive 2009 ConTeXt does not support an omega option anymore.
(make-obsolete-variable 'ConTeXt-Omega-engine 'TeX-engine-alist "11.86")
@@ -204,7 +204,7 @@ If nil, none is specified."
(context-mode) :help "Run ConTeXt until completion")
("BibTeX" "bibtex %s" TeX-run-BibTeX nil
(plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode
- context-mode)
+ context-mode)
:help "Run BibTeX")
("Biber" "biber %s" TeX-run-Biber nil
(plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode)
@@ -315,40 +315,40 @@ the respective mode names.
Any additional elements get just transferred to the respective menu entries."
:group 'TeX-command
:type '(repeat (group :value ("" "" TeX-run-command nil t)
- (string :tag "Name")
- (string :tag "Command")
- (choice :tag "How"
- :value TeX-run-command
- (function-item TeX-run-command)
- (function-item TeX-run-format)
- (function-item TeX-run-TeX)
- (function-item TeX-run-interactive)
- (function-item TeX-run-BibTeX)
- (function-item TeX-run-Biber)
- (function-item TeX-run-compile)
- (function-item TeX-run-shell)
- (function-item TeX-run-discard)
- (function-item TeX-run-background)
- (function-item TeX-run-silent)
- (function-item TeX-run-discard-foreground)
- (function-item TeX-run-function)
- (function-item TeX-run-discard-or-function)
- (function :tag "Other"))
- (boolean :tag "Prompt")
- (choice :tag "Modes"
- (const :tag "All" t)
- (set (const :tag "Plain TeX" plain-tex-mode)
- (const :tag "LaTeX" latex-mode)
- (const :tag "DocTeX" doctex-mode)
- (const :tag "ConTeXt" context-mode)
- (const :tag "Texinfo" texinfo-mode)
- (const :tag "AmSTeX" ams-tex-mode)))
- (repeat :tag "Menu elements" :inline t sexp))))
+ (string :tag "Name")
+ (string :tag "Command")
+ (choice :tag "How"
+ :value TeX-run-command
+ (function-item TeX-run-command)
+ (function-item TeX-run-format)
+ (function-item TeX-run-TeX)
+ (function-item TeX-run-interactive)
+ (function-item TeX-run-BibTeX)
+ (function-item TeX-run-Biber)
+ (function-item TeX-run-compile)
+ (function-item TeX-run-shell)
+ (function-item TeX-run-discard)
+ (function-item TeX-run-background)
+ (function-item TeX-run-silent)
+ (function-item TeX-run-discard-foreground)
+ (function-item TeX-run-function)
+ (function-item TeX-run-discard-or-function)
+ (function :tag "Other"))
+ (boolean :tag "Prompt")
+ (choice :tag "Modes"
+ (const :tag "All" t)
+ (set (const :tag "Plain TeX" plain-tex-mode)
+ (const :tag "LaTeX" latex-mode)
+ (const :tag "DocTeX" doctex-mode)
+ (const :tag "ConTeXt" context-mode)
+ (const :tag "Texinfo" texinfo-mode)
+ (const :tag "AmSTeX" ams-tex-mode)))
+ (repeat :tag "Menu elements" :inline t sexp))))
(defcustom TeX-command-output-list
'(
- ; Add the following line if you want to
use htlatex (tex4ht)
- ; ("\\`htlatex" ("html"))
+ ; Add the following line if you want
to use htlatex (tex4ht)
+ ; ("\\`htlatex" ("html"))
)
"List of regexps and file extensions.
@@ -370,22 +370,22 @@ Extensions must be given without the \".\"."
:group 'TeX-command
:type '(repeat (group (regexp :tag "Command Regexp")
- (choice (string :tag "Default Extension")
- (group (string :tag "Fixed Extension"))))))
+ (choice (string :tag "Default Extension")
+ (group (string :tag "Fixed Extension"))))))
;; You may want to change the default LaTeX version for your site.
(defcustom LaTeX-version "2e"
"Default LaTeX version. Currently recognized is \"2\" and \"2e\"."
:group 'LaTeX
:type '(radio (const :format "%v\n%h"
- :doc "\
+ :doc "\
The executable `latex' is LaTeX version 2."
- "2")
- (const :format "%v\n%h"
- :doc "\
+ "2")
+ (const :format "%v\n%h"
+ :doc "\
The executable `latex' is LaTeX version 2e."
- "2e")
- (string :tag "Other")))
+ "2e")
+ (string :tag "Other")))
;; Use different compilation commands depending on style.
@@ -403,7 +403,7 @@ match is used, if no match is found the `%l' is replaced
with the empty
string."
:group 'TeX-command
:type '(repeat (group :value ("" "")
- regexp (string :tag "Style"))))
+ regexp (string :tag "Style"))))
;; Printing: If you want to print, TeX-print-command must be non-nil
;; (if it is nil, you'll get a complaint when using the print menu).
@@ -428,7 +428,7 @@ performed as specified in `TeX-expand-list'. If it is nil,
then customization is requested."
:group 'TeX-command
:type '(choice (string :tag "Print command")
- (const :tag "No print command customized" nil)))
+ (const :tag "No print command customized" nil)))
(defcustom TeX-queue-command "lpq -P%p"
"Command used to show the status of a printer queue.
@@ -438,7 +438,7 @@ performed as specified in `TeX-expand-list'. If this is
nil,
the printer has no corresponding command."
:group 'TeX-command
:type '(choice (string :tag "Queue check command")
- (const :tag "No such command" nil)))
+ (const :tag "No such command" nil)))
;; Enter the names of the printers available at your site, or nil if
;; you only have one printer.
@@ -469,22 +469,22 @@ If this list is empty, only `TeX-print-command' and
`TeX-queue-command'
get consulted."
:group 'TeX-command
:type '(repeat (group (string :tag "Name")
- (option (group :inline t
- :extra-offset -4
- (choice :tag "Print"
- (const :tag "default")
- (string :format "%v"))
- (option (choice :tag "Queue"
- (const :tag "default")
- (string
- :format "%v"))))))))
+ (option (group :inline t
+ :extra-offset -4
+ (choice :tag "Print"
+ (const :tag "default")
+ (string :format "%v"))
+ (option (choice :tag "Queue"
+ (const :tag "default")
+ (string
+ :format "%v"))))))))
;; The name of the most used printer.
(defcustom TeX-printer-default (or (getenv "PRINTER")
- (and TeX-printer-list
- (car (car TeX-printer-list)))
- "lp")
+ (and TeX-printer-list
+ (car (car TeX-printer-list)))
+ "lp")
"Default printer to use with `TeX-command'."
:group 'TeX-command
:type 'string)
@@ -520,41 +520,41 @@ string."
(defvar TeX-expand-list-builtin
'(("%q" (lambda ()
- (TeX-printer-query t)))
+ (TeX-printer-query t)))
("%V" (lambda ()
- (TeX-source-correlate-start-server-maybe)
- (TeX-view-command-raw)))
+ (TeX-source-correlate-start-server-maybe)
+ (TeX-view-command-raw)))
("%r" (lambda ()
- (TeX-style-check TeX-print-style)))
+ (TeX-style-check TeX-print-style)))
("%l" (lambda ()
- (TeX-style-check LaTeX-command-style)))
+ (TeX-style-check LaTeX-command-style)))
("%(PDF)" (lambda ()
- (if (and (eq TeX-engine 'default)
- (if TeX-PDF-mode
- (not (TeX-PDF-from-DVI))
- TeX-DVI-via-PDFTeX))
- "pdf"
- "")))
+ (if (and (eq TeX-engine 'default)
+ (if TeX-PDF-mode
+ (not (TeX-PDF-from-DVI))
+ TeX-DVI-via-PDFTeX))
+ "pdf"
+ "")))
("%(PDFout)" (lambda ()
- (cond ((eq major-mode 'ams-tex-mode)
- (if TeX-PDF-mode
- " -output-format=pdf"
- " -output-format=dvi"))
- ((and (eq TeX-engine 'xetex)
- (not TeX-PDF-mode))
- " -no-pdf")
- ((and (eq TeX-engine 'luatex)
- (not TeX-PDF-mode))
- " --output-format=dvi")
- ((and (eq TeX-engine 'default)
- (not TeX-PDF-mode)
- TeX-DVI-via-PDFTeX)
- " \"\\pdfoutput=0 \"")
- (t ""))))
+ (cond ((eq major-mode 'ams-tex-mode)
+ (if TeX-PDF-mode
+ " -output-format=pdf"
+ " -output-format=dvi"))
+ ((and (eq TeX-engine 'xetex)
+ (not TeX-PDF-mode))
+ " -no-pdf")
+ ((and (eq TeX-engine 'luatex)
+ (not TeX-PDF-mode))
+ " --output-format=dvi")
+ ((and (eq TeX-engine 'default)
+ (not TeX-PDF-mode)
+ TeX-DVI-via-PDFTeX)
+ " \"\\pdfoutput=0 \"")
+ (t ""))))
("%(mode)" (lambda ()
- (if TeX-interactive-mode
- ""
- " -interaction=nonstopmode")))
+ (if TeX-interactive-mode
+ ""
+ " -interaction=nonstopmode")))
("%(file-line-error)"
(lambda () (if TeX-file-line-error " -file-line-error" "")))
("%(o?)" (lambda () (if (eq TeX-engine 'omega) "o" "")))
@@ -567,17 +567,17 @@ string."
("%dS" TeX-source-specials-view-expand-options)
("%cS" TeX-source-specials-view-expand-client)
("%(outpage)" (lambda ()
- ;; 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")))
+ ;; 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")))
;; `TeX-active-master-with-quotes' calls either `TeX-master-file'
;; or `TeX-region-file' returning the master or region file, and
;; adds suitable quotes for use in shell command line.
@@ -594,37 +594,37 @@ string."
;; 3. Each TeX codes between %` and %' must be enclosed in
;; double quotes and preceded by a space.
("%`" (lambda nil
- (setq TeX-command-pos t TeX-command-text nil)
- ""))
+ (setq TeX-command-pos t TeX-command-text nil)
+ ""))
(" \"\\" (lambda nil
- (if (eq TeX-command-pos t)
- (setq TeX-command-pos TeX-expand-pos
- TeX-expand-pos (+ 3 TeX-expand-pos))
- (setq TeX-expand-pos (1+ TeX-expand-pos)))))
+ (if (eq TeX-command-pos t)
+ (setq TeX-command-pos TeX-expand-pos
+ TeX-expand-pos (+ 3 TeX-expand-pos))
+ (setq TeX-expand-pos (1+ TeX-expand-pos)))))
("\"" (lambda nil (if (numberp TeX-command-pos)
- (setq TeX-command-text
- (concat
- TeX-command-text
- (substring TeX-expand-command
- TeX-command-pos
- (1+ TeX-expand-pos)))
- TeX-expand-command
- (concat
- (substring TeX-expand-command
- 0
- TeX-command-pos)
- (substring TeX-expand-command
- (1+ TeX-expand-pos)))
- TeX-expand-pos TeX-command-pos
- TeX-command-pos t)
- (setq TeX-expand-pos (1+ TeX-expand-pos)))))
+ (setq TeX-command-text
+ (concat
+ TeX-command-text
+ (substring TeX-expand-command
+ TeX-command-pos
+ (1+ TeX-expand-pos)))
+ TeX-expand-command
+ (concat
+ (substring TeX-expand-command
+ 0
+ TeX-command-pos)
+ (substring TeX-expand-command
+ (1+ TeX-expand-pos)))
+ TeX-expand-pos TeX-command-pos
+ TeX-command-pos t)
+ (setq TeX-expand-pos (1+ TeX-expand-pos)))))
("%'" (lambda nil
- (setq TeX-command-pos nil)
- (if (stringp TeX-command-text)
- (progn
- (setq TeX-expand-pos (+ TeX-expand-pos (length
TeX-command-text) 9))
- (concat TeX-command-text " \"\\input\""))
- "")))
+ (setq TeX-command-pos nil)
+ (if (stringp TeX-command-text)
+ (progn
+ (setq TeX-expand-pos (+ TeX-expand-pos (length
TeX-command-text) 9))
+ (concat TeX-command-text " \"\\input\""))
+ "")))
;; The fourth argument of t directs to supply "\detokenize{}" when
;; necessary. See doc string and comment of
;; `TeX-active-master-with-quotes'.
@@ -668,10 +668,10 @@ Programs should not use these variables directly but the
function
`TeX-expand-list'."
:group 'TeX-command
:type '(repeat (group (string :tag "Key")
- (sexp :tag "Expander")
- (repeat :inline t
- :tag "Arguments"
- (sexp :format "%v")))))
+ (sexp :tag "Expander")
+ (repeat :inline t
+ :tag "Arguments"
+ (sexp :format "%v")))))
(defun TeX-expand-list ()
"Complete list of expansion strings for TeX command names.
@@ -733,7 +733,7 @@ emacs 24.1 and is then later run by emacs 24.5."
(if (fboundp name) ;If macro exists at compile-time, just use it.
then
`(if (fboundp ',name) ;Else, check if it exists at run-time.
- (eval ',then) ;If it does, then run the then code.
+ (eval ',then) ;If it does, then run the then code.
,@else))) ;Otherwise, run the else code.
(require 'easymenu)
@@ -741,20 +741,20 @@ emacs 24.1 and is then later run by emacs 24.5."
;;; Documentation for Info-goto-emacs-command-node and similar
(eval-after-load 'info '(dolist (elt '("TeX" "LaTeX" "ConTeXt" "Texinfo"
- "docTeX"))
- (add-to-list 'Info-file-list-for-emacs
- (cons elt "AUCTeX"))))
+ "docTeX"))
+ (add-to-list 'Info-file-list-for-emacs
+ (cons elt "AUCTeX"))))
(defadvice hack-one-local-variable (after TeX-hack-one-local-variable-after
- activate)
+ activate)
"Call minor mode function if minor mode variable is found."
(let ((var (ad-get-arg 0))
- (val (ad-get-arg 1)))
+ (val (ad-get-arg 1)))
;; Instead of checking for each mode explicitely `minor-mode-list'
;; could be used. But this may make the byte compiler pop up.
(when (memq var '(TeX-PDF-mode
- TeX-source-correlate-mode TeX-interactive-mode
- TeX-fold-mode LaTeX-math-mode))
+ TeX-source-correlate-mode TeX-interactive-mode
+ TeX-fold-mode LaTeX-math-mode))
(if (symbol-value val) (funcall var 1) (funcall var 0)))))
(defvar TeX-overlay-priority-step 16
@@ -771,51 +771,51 @@ overlays between two existing ones.")
(require 'crm)
(if (or (and (= emacs-major-version 24) (>= emacs-minor-version 4))
- (>= emacs-major-version 25))
+ (>= emacs-major-version 25))
;; For GNU Emacs 24.4 or later, based on `completing-read-multiple' of
;; git commit b14abca9476cba2f500b5eda89441d593dd0f12b
;; 2013-01-10 * lisp/emacs-lisp/crm.el: Allow any regexp for separators.
(defun TeX-completing-read-multiple
- (prompt table &optional predicate require-match initial-input
- hist def inherit-input-method)
+ (prompt table &optional predicate require-match initial-input
+ hist def inherit-input-method)
"Like `completing-read-multiple' which see.
Retain zero-length substrings but ensure that empty input results
in nil across different emacs versions."
(unwind-protect
- (progn
- (add-hook 'choose-completion-string-functions
- 'crm--choose-completion-string)
- (let* ((minibuffer-completion-table #'crm--collection-fn)
- (minibuffer-completion-predicate predicate)
- ;; see completing_read in src/minibuf.c
- (minibuffer-completion-confirm
- (unless (eq require-match t) require-match))
- (crm-completion-table table)
- (map (if require-match
- crm-local-must-match-map
- crm-local-completion-map))
- ;; If the user enters empty input, `read-from-minibuffer'
- ;; returns the empty string, not DEF.
- (input (read-from-minibuffer
- prompt initial-input map
- nil hist def inherit-input-method))
- result)
- (and def (string-equal input "") (setq input def))
- (if (equal (setq result (split-string input crm-separator))
- '(""))
- nil
- result)))
- (remove-hook 'choose-completion-string-functions
- 'crm--choose-completion-string)))
+ (progn
+ (add-hook 'choose-completion-string-functions
+ 'crm--choose-completion-string)
+ (let* ((minibuffer-completion-table #'crm--collection-fn)
+ (minibuffer-completion-predicate predicate)
+ ;; see completing_read in src/minibuf.c
+ (minibuffer-completion-confirm
+ (unless (eq require-match t) require-match))
+ (crm-completion-table table)
+ (map (if require-match
+ crm-local-must-match-map
+ crm-local-completion-map))
+ ;; If the user enters empty input, `read-from-minibuffer'
+ ;; returns the empty string, not DEF.
+ (input (read-from-minibuffer
+ prompt initial-input map
+ nil hist def inherit-input-method))
+ result)
+ (and def (string-equal input "") (setq input def))
+ (if (equal (setq result (split-string input crm-separator))
+ '(""))
+ nil
+ result)))
+ (remove-hook 'choose-completion-string-functions
+ 'crm--choose-completion-string)))
;; For GNU Emacs <= 24.3.
(defun TeX-completing-read-multiple
(prompt table &optional predicate require-match initial-input
- hist def inherit-input-method)
+ hist def inherit-input-method)
"Like `completing-read-multiple' which see.
Ensures that empty input results in nil across different emacs versions."
(let ((result (completing-read-multiple prompt table predicate
- require-match initial-input
- hist def inherit-input-method)))
+ require-match initial-input
+ hist def inherit-input-method)))
(if (equal result '("")) nil result))))
(defun TeX-read-string (prompt &optional initial-input history default-value)
@@ -836,20 +836,20 @@ overlays."
(let (outer-priority inner-priority ov-priority)
(dolist (ov (overlays-in start end))
(when (or (eq (overlay-get ov 'category) 'TeX-fold)
- (overlay-get ov 'preview-state))
- (setq ov-priority (overlay-get ov 'priority))
- (if (>= (overlay-start ov) start)
- (setq inner-priority (max ov-priority (or inner-priority
- ov-priority)))
- (setq outer-priority (min ov-priority (or outer-priority
- ov-priority))))))
+ (overlay-get ov 'preview-state))
+ (setq ov-priority (overlay-get ov 'priority))
+ (if (>= (overlay-start ov) start)
+ (setq inner-priority (max ov-priority (or inner-priority
+ ov-priority)))
+ (setq outer-priority (min ov-priority (or outer-priority
+ ov-priority))))))
(cond ((and inner-priority (not outer-priority))
- (+ inner-priority TeX-overlay-priority-step))
- ((and (not inner-priority) outer-priority)
- (/ outer-priority 2))
- ((and inner-priority outer-priority)
- (+ (/ (- outer-priority inner-priority) 2) inner-priority))
- (t TeX-overlay-priority-step))))
+ (+ inner-priority TeX-overlay-priority-step))
+ ((and (not inner-priority) outer-priority)
+ (/ outer-priority 2))
+ ((and inner-priority outer-priority)
+ (+ (/ (- outer-priority inner-priority) 2) inner-priority))
+ (t TeX-overlay-priority-step))))
(defun TeX-delete-dups-by-car (alist &optional keep-list)
"Return a list of all elements in ALIST, but each car only once.
@@ -857,15 +857,15 @@ Elements of KEEP-LIST are not removed even if duplicate."
;; Copy of `reftex-uniquify-by-car' (written by David Kastrup).
(setq keep-list (TeX-sort-strings keep-list))
(setq alist (sort (copy-sequence alist)
- #'TeX-car-string-lessp))
+ #'TeX-car-string-lessp))
(let ((new alist) elt)
(while (cdr new)
(setq elt (caar new))
(while (and keep-list (string< (car keep-list) elt))
- (setq keep-list (cdr keep-list)))
+ (setq keep-list (cdr keep-list)))
(unless (and keep-list (string= elt (car keep-list)))
- (while (string= elt (car (cadr new)))
- (setcdr new (cddr new))))
+ (while (string= elt (car (cadr new)))
+ (setcdr new (cddr new))))
(setq new (cdr new))))
alist)
@@ -876,7 +876,7 @@ Elements of KEEP-LIST are not removed even if duplicate."
(while (cdr new)
(setq elt (car new))
(while (string= elt (cadr new))
- (setcdr new (cddr new)))
+ (setcdr new (cddr new)))
(setq new (cdr new))))
list)
@@ -902,8 +902,8 @@ If t display help buffer. If nil display message about
error in
echo area. If `expert' display output buffer with raw processor output."
:group 'TeX-output
:type '(choice (const :tag "Help buffer" t)
- (const :tag "Echo area" nil)
- (const :tag "Output buffer" expert)))
+ (const :tag "Echo area" nil)
+ (const :tag "Output buffer" expert)))
(defcustom TeX-debug-bad-boxes nil
"Non-nil means also find overfull/underfull box warnings with
\\[TeX-next-error]."
@@ -927,8 +927,8 @@ If you want to use the custom function, see how it is used
in the
code of `TeX-warning'."
:group 'TeX-command
:type '(choice (const :tag "Do not ignore anything" nil)
- (string :tag "Regexp")
- (symbol :tag "Function name")))
+ (string :tag "Regexp")
+ (symbol :tag "Function name")))
(defcustom TeX-suppress-ignored-warnings nil
"Whether to actually show ignored warnings.
@@ -942,14 +942,14 @@ Note that `TeX-debug-warnings' always takes the
precedence."
(interactive)
(setq TeX-debug-bad-boxes (not TeX-debug-bad-boxes))
(message (concat "TeX-debug-bad-boxes: "
- (if TeX-debug-bad-boxes "on" "off"))))
+ (if TeX-debug-bad-boxes "on" "off"))))
(defun TeX-toggle-debug-warnings ()
"Toggle if the debugger should display warnings too."
(interactive)
(setq TeX-debug-warnings (not TeX-debug-warnings))
(message (concat "TeX-debug-warnings: "
- (if TeX-debug-warnings "on" "off"))))
+ (if TeX-debug-warnings "on" "off"))))
(defun TeX-toggle-suppress-ignored-warnings ()
"Toggle if the debugger should display ignored warnings too.
@@ -959,7 +959,7 @@ more details."
(interactive)
(setq TeX-suppress-ignored-warnings (not TeX-suppress-ignored-warnings))
(message (concat "TeX-suppress-ignored-warnings: "
- (if TeX-suppress-ignored-warnings "on" "off"))))
+ (if TeX-suppress-ignored-warnings "on" "off"))))
;;; Mode names.
@@ -984,38 +984,38 @@ name is to be updated.
If RESET is non-nil, `TeX-command-next' is reset to
`TeX-command-default' in updated buffers."
(if (and changed
- (not (and local (local-variable-p changed (current-buffer)))))
+ (not (and local (local-variable-p changed (current-buffer)))))
(dolist (buffer (buffer-list))
- (and (local-variable-p 'TeX-mode-p buffer)
- (not (local-variable-p changed buffer))
- (with-current-buffer buffer (TeX-set-mode-name nil nil reset))))
+ (and (local-variable-p 'TeX-mode-p buffer)
+ (not (local-variable-p changed buffer))
+ (with-current-buffer buffer (TeX-set-mode-name nil nil reset))))
(if TeX-mode-p
- (let ((trailing-flags
- (concat
- (and (boundp 'TeX-fold-mode) TeX-fold-mode "F")
- (and (boundp 'LaTeX-math-mode) LaTeX-math-mode "M")
- (and TeX-PDF-mode "P")
- (and TeX-interactive-mode "I")
- (and TeX-source-correlate-mode "S"))))
- (setq mode-name (concat TeX-base-mode-name
- (when (> (length trailing-flags) 0)
- (concat "/" trailing-flags))))
- (when reset
- (TeX-process-set-variable (TeX-master-file)
- 'TeX-command-next TeX-command-default)
- (TeX-process-set-variable (TeX-region-file)
- 'TeX-command-next TeX-command-default))
- (set-buffer-modified-p (buffer-modified-p))))))
+ (let ((trailing-flags
+ (concat
+ (and (boundp 'TeX-fold-mode) TeX-fold-mode "F")
+ (and (boundp 'LaTeX-math-mode) LaTeX-math-mode "M")
+ (and TeX-PDF-mode "P")
+ (and TeX-interactive-mode "I")
+ (and TeX-source-correlate-mode "S"))))
+ (setq mode-name (concat TeX-base-mode-name
+ (when (> (length trailing-flags) 0)
+ (concat "/" trailing-flags))))
+ (when reset
+ (TeX-process-set-variable (TeX-master-file)
+ 'TeX-command-next TeX-command-default)
+ (TeX-process-set-variable (TeX-region-file)
+ 'TeX-command-next TeX-command-default))
+ (set-buffer-modified-p (buffer-modified-p))))))
(defun TeX-mode-prefix (&optional mode)
"Return the prefix for the symbol MODE as string.
If no mode is given the current major mode is used."
(cdr (assoc (or mode major-mode) '((plain-tex-mode . "plain-TeX")
- (latex-mode . "LaTeX")
- (ams-tex-mode . "AmSTeX")
- (doctex-mode . "docTeX")
- (texinfo-mode . "Texinfo")
- (context-mode . "ConTeXt")))))
+ (latex-mode . "LaTeX")
+ (ams-tex-mode . "AmSTeX")
+ (doctex-mode . "docTeX")
+ (texinfo-mode . "Texinfo")
+ (context-mode . "ConTeXt")))))
;;; Viewing
@@ -1042,32 +1042,32 @@ If no mode is given the current major mode is used."
TeX-source-correlate-mode)
(paper-landscape
(and (fboundp 'LaTeX-match-class-option)
- (LaTeX-match-class-option "\\`landscape\\'")))
+ (LaTeX-match-class-option "\\`landscape\\'")))
(paper-portrait
(not (and (fboundp 'LaTeX-match-class-option)
- (LaTeX-match-class-option "\\`landscape\\'"))))
+ (LaTeX-match-class-option "\\`landscape\\'"))))
(paper-a4
(let ((regex "\\`\\(?:a4paper\\|a4dutch\\|a4wide\\|sem-a4\\)\\'"))
(or (TeX-match-style regex)
- (and (fboundp 'LaTeX-match-class-option)
- (LaTeX-match-class-option regex)))))
+ (and (fboundp 'LaTeX-match-class-option)
+ (LaTeX-match-class-option regex)))))
(paper-a5
(let ((regex "\\`\\(?:a5paper\\|a5comb\\)\\'"))
(or (TeX-match-style regex)
- (and (fboundp 'LaTeX-match-class-option)
- (LaTeX-match-class-option regex)))))
+ (and (fboundp 'LaTeX-match-class-option)
+ (LaTeX-match-class-option regex)))))
(paper-b5
(and (fboundp 'LaTeX-match-class-option)
- (LaTeX-match-class-option "\\`b5paper\\'")))
+ (LaTeX-match-class-option "\\`b5paper\\'")))
(paper-letter
(and (fboundp 'LaTeX-match-class-option)
- (LaTeX-match-class-option "\\`letterpaper\\'")))
+ (LaTeX-match-class-option "\\`letterpaper\\'")))
(paper-legal
(and (fboundp 'LaTeX-match-class-option)
- (LaTeX-match-class-option "\\`legalpaper\\'")))
+ (LaTeX-match-class-option "\\`legalpaper\\'")))
(paper-executive
(and (fboundp 'LaTeX-match-class-option)
- (LaTeX-match-class-option "\\`executivepaper\\'"))))
+ (LaTeX-match-class-option "\\`executivepaper\\'"))))
"Alist of built-in predicates for viewer selection and invocation.
See the doc string of `TeX-view-predicate-list' for a short
description of each predicate.")
@@ -1110,7 +1110,7 @@ The following built-in predicates are available:
;; 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)))
+ (require 'dbus nil :no-error)))
(defun TeX-evince-dbus-p (de app &rest options)
"Return non-nil, if an evince-compatible reader is accessible via DBUS.
Additional OPTIONS may be given to extend the check. If none are
@@ -1122,26 +1122,26 @@ search are checked, too.
DE is the name of the desktop environment, APP is the name of viewer."
(let ((dbus-debug nil))
(and (featurep 'dbusbind)
- (require 'dbus nil :no-error)
- (dbus-ignore-errors (dbus-get-unique-name :session))
- (dbus-ping :session (format "org.%s.%s.Daemon" de app))
- (or (not (memq :forward options))
- (let ((spec (dbus-introspect-get-method
- :session (format "org.%s.%s.Daemon" de app)
- (format "/org/%s/%s/Daemon" de app)
- (format "org.%s.%s.Daemon" de app)
- "FindDocument")))
- ;; FindDocument must exist, and its signature must be (String,
- ;; Boolean, String). Evince versions between 2.30 and 2.91.x
- ;; didn't have the Boolean spawn argument we need to start evince
- ;; initially.
- (and spec
- (equal '("s" "b" "s")
- (delq nil (mapcar (lambda (elem)
- (when (and (listp elem)
- (eq (car elem) 'arg))
- (cdr (caar (cdr elem)))))
- spec)))))))))
+ (require 'dbus nil :no-error)
+ (dbus-ignore-errors (dbus-get-unique-name :session))
+ (dbus-ping :session (format "org.%s.%s.Daemon" de app))
+ (or (not (memq :forward options))
+ (let ((spec (dbus-introspect-get-method
+ :session (format "org.%s.%s.Daemon" de app)
+ (format "/org/%s/%s/Daemon" de app)
+ (format "org.%s.%s.Daemon" de app)
+ "FindDocument")))
+ ;; FindDocument must exist, and its signature must be (String,
+ ;; Boolean, String). Evince versions between 2.30 and 2.91.x
+ ;; didn't have the Boolean spawn argument we need to start
evince
+ ;; initially.
+ (and spec
+ (equal '("s" "b" "s")
+ (delq nil (mapcar (lambda (elem)
+ (when (and (listp elem)
+ (eq (car elem) 'arg))
+ (cdr (caar (cdr elem)))))
+ spec)))))))))
(defun TeX-pdf-tools-sync-view ()
"Focus the focused page/paragraph in `pdf-view-mode'.
@@ -1156,16 +1156,16 @@ entry in `TeX-view-program-list-builtin'."
(unless TeX-PDF-mode
(error "PDF Tools only work with PDF output"))
(add-hook 'pdf-sync-backward-redirect-functions
- #'TeX-source-correlate-handle-TeX-region)
+ #'TeX-source-correlate-handle-TeX-region)
(if (and TeX-source-correlate-mode
- (fboundp 'pdf-sync-forward-search))
+ (fboundp 'pdf-sync-forward-search))
(with-current-buffer (or (when TeX-current-process-region-p
- (get-file-buffer (TeX-region-file t)))
- (current-buffer))
- (pdf-sync-forward-search))
+ (get-file-buffer (TeX-region-file t)))
+ (current-buffer))
+ (pdf-sync-forward-search))
(let ((pdf (TeX-active-master (TeX-output-extension))))
(pop-to-buffer (or (find-buffer-visiting pdf)
- (find-file-noselect pdf))))))
+ (find-file-noselect pdf))))))
(defcustom TeX-view-evince-keep-focus nil
"Whether Emacs retains the focus when viewing PDF files with Evince.
@@ -1187,34 +1187,34 @@ viewer."
(require 'url-util)
(let* ((uri (concat "file://"
(url-encode-url
- (expand-file-name
- (TeX-active-master (TeX-output-extension))))))
- (owner (dbus-call-method
- :session (format "org.%s.%s.Daemon" de app)
- (format "/org/%s/%s/Daemon" de app)
- (format "org.%s.%s.Daemon" de app)
- "FindDocument"
- uri
- t)))
+ (expand-file-name
+ (TeX-active-master (TeX-output-extension))))))
+ (owner (dbus-call-method
+ :session (format "org.%s.%s.Daemon" de app)
+ (format "/org/%s/%s/Daemon" de app)
+ (format "org.%s.%s.Daemon" de app)
+ "FindDocument"
+ uri
+ t)))
(if owner
- (with-current-buffer (or (when TeX-current-process-region-p
- (get-file-buffer (TeX-region-file t)))
- (current-buffer))
- (dbus-call-method
- :session owner
- (format "/org/%s/%s/Window/0" de app)
- (format "org.%s.%s.Window" de app)
- "SyncView"
- (buffer-file-name)
- (list :struct :int32 (1+ (TeX-current-offset))
- ;; FIXME: Using `current-column' here is dubious.
- ;; Most of CJK letters count as occupying 2 columns,
- ;; so the column number is not equal to the number of
- ;; the characters counting from the beginning of a
- ;; line. What is the right number to specify here?
- ;; number of letters? bytes in UTF8? or other?
- :int32 (1+ (current-column)))
- :uint32 0)
+ (with-current-buffer (or (when TeX-current-process-region-p
+ (get-file-buffer (TeX-region-file t)))
+ (current-buffer))
+ (dbus-call-method
+ :session owner
+ (format "/org/%s/%s/Window/0" de app)
+ (format "org.%s.%s.Window" de app)
+ "SyncView"
+ (buffer-file-name)
+ (list :struct :int32 (1+ (TeX-current-offset))
+ ;; FIXME: Using `current-column' here is dubious.
+ ;; Most of CJK letters count as occupying 2 columns,
+ ;; so the column number is not equal to the number of
+ ;; the characters counting from the beginning of a
+ ;; line. What is the right number to specify here?
+ ;; number of letters? bytes in UTF8? or other?
+ :int32 (1+ (current-column)))
+ :uint32 0)
(when TeX-view-evince-keep-focus
(select-frame-set-input-focus (selected-frame))))
(error "Couldn't find the %s instance for %s" (capitalize app) uri))))
@@ -1239,36 +1239,36 @@ viewer."
(if (TeX-evince-dbus-p de app :forward)
(intern (format "TeX-%s-sync-view" app))
`(,app (mode-io-correlate
- ;; With evince 3, -p N opens the page *labeled* N,
- ;; and -i,--page-index the physical page N.
- ,(if (string-match "--page-index"
- (shell-command-to-string (concat app " --help")))
- " -i %(outpage)"
- " -p %(outpage)")) " %o")))
+ ;; With evince 3, -p N opens the page *labeled* N,
+ ;; and -i,--page-index the physical page N.
+ ,(if (string-match "--page-index"
+ (shell-command-to-string (concat app "
--help")))
+ " -i %(outpage)"
+ " -p %(outpage)")) " %o")))
(defvar TeX-view-program-list-builtin
(cond
((eq system-type 'windows-nt)
'(("Yap" ("yap -1" (mode-io-correlate " -s %n%b") " %o") "yap")
("dviout" ("dviout -1 "
- ((paper-a4 paper-portrait) "-y=A4 ")
- ((paper-a4 paper-landscape) "-y=A4L ")
- ((paper-a5 paper-portrait) "-y=A5 ")
- ((paper-a5 paper-landscape) "-y=A5L ")
- ((paper-b5 paper-portrait) "-y=E5 ")
- ((paper-b5 paper-landscape) "-y=E5L ")
- ((paper-b4jis paper-portrait) "-y=B4 ")
- ((paper-b4jis paper-landscape) "-y=B4L ")
- ((paper-b5jis paper-portrait) "-y=B5 ")
- ((paper-b5jis paper-landscape) "-y=B5L ")
- (paper-legal "-y=Legal ")
- (paper-letter "-y=Letter ")
- (paper-executive "-y=Executive ")
- "%d" (mode-io-correlate " \"# %n '%b'\"")) "dviout")
+ ((paper-a4 paper-portrait) "-y=A4 ")
+ ((paper-a4 paper-landscape) "-y=A4L ")
+ ((paper-a5 paper-portrait) "-y=A5 ")
+ ((paper-a5 paper-landscape) "-y=A5L ")
+ ((paper-b5 paper-portrait) "-y=E5 ")
+ ((paper-b5 paper-landscape) "-y=E5L ")
+ ((paper-b4jis paper-portrait) "-y=B4 ")
+ ((paper-b4jis paper-landscape) "-y=B4L ")
+ ((paper-b5jis paper-portrait) "-y=B5 ")
+ ((paper-b5jis paper-landscape) "-y=B5L ")
+ (paper-legal "-y=Legal ")
+ (paper-letter "-y=Letter ")
+ (paper-executive "-y=Executive ")
+ "%d" (mode-io-correlate " \"# %n '%b'\"")) "dviout")
("PDF Tools" TeX-pdf-tools-sync-view)
("SumatraPDF"
("SumatraPDF -reuse-instance"
- (mode-io-correlate " -forward-search \"%b\" %n") " %o")
+ (mode-io-correlate " -forward-search \"%b\" %n") " %o")
"SumatraPDF")
("dvips and start" "dvips %d -o && start \"\" %f" "dvips")
("start" "start \"\" %o")))
@@ -1281,16 +1281,16 @@ viewer."
(t
`(("dvi2tty" ("dvi2tty -q -w 132 %o"))
("xdvi" ("%(o?)xdvi"
- (mode-io-correlate " -sourceposition \"%n %b\" -editor \"%cS\"")
- ((paper-a4 paper-portrait) " -paper a4")
- ((paper-a4 paper-landscape) " -paper a4r")
- ((paper-a5 paper-portrait) " -paper a5")
- ((paper-a5 paper-landscape) " -paper a5r")
- (paper-b5 " -paper b5")
- (paper-letter " -paper us")
- (paper-legal " -paper legal")
- (paper-executive " -paper 7.25x10.5in")
- " %d") "%(o?)xdvi")
+ (mode-io-correlate " -sourceposition \"%n %b\" -editor \"%cS\"")
+ ((paper-a4 paper-portrait) " -paper a4")
+ ((paper-a4 paper-landscape) " -paper a4r")
+ ((paper-a5 paper-portrait) " -paper a5")
+ ((paper-a5 paper-landscape) " -paper a5r")
+ (paper-b5 " -paper b5")
+ (paper-letter " -paper us")
+ (paper-legal " -paper legal")
+ (paper-executive " -paper 7.25x10.5in")
+ " %d") "%(o?)xdvi")
("dvips and gv" "%(o?)dvips %d -o && gv %f" ,(list "%(o?)dvips" "gv"))
("gv" "gv %o" "gv")
("xpdf" ("xpdf -remote %s -raise %o" (mode-io-correlate " %(outpage)"))
"xpdf")
@@ -1302,8 +1302,8 @@ viewer."
("PDF Tools" TeX-pdf-tools-sync-view)
("Zathura"
("zathura %o"
- (mode-io-correlate
- " --synctex-forward %n:0:\"%b\" -x \"emacsclient +%{line} %{input}\""))
+ (mode-io-correlate
+ " --synctex-forward %n:0:\"%b\" -x \"emacsclient +%{line}
%{input}\""))
"zathura"))))
"Alist of built-in viewer specifications.
This variable should not be changed by the user who can use
@@ -1353,33 +1353,33 @@ restarting Emacs."
(choice
(group :tag "Command" (string :tag "Command"))
(group :inline t :tag "Command parts"
- (repeat
- :tag "Command parts"
- (choice
- (string :tag "Command part")
- (list :tag "Predicate and command part"
- ,(let (list)
- ;; Build the list of available predicates.
- (mapc (lambda (spec)
- (add-to-list 'list `(const ,(car spec))))
- (append TeX-view-predicate-list
- TeX-view-predicate-list-builtin))
- ;; Sort the list alphabetically.
- (setq list (sort list
- (lambda (a b)
- (string<
- (downcase (symbol-name (cadr a)))
- (downcase (symbol-name (cadr
b)))))))
- `(choice
- (choice :tag "Predicate" ,@list)
- (repeat :tag "List of predicates"
- (choice :tag "Predicate" ,@list))))
- (string :tag "Command part")))))
+ (repeat
+ :tag "Command parts"
+ (choice
+ (string :tag "Command part")
+ (list :tag "Predicate and command part"
+ ,(let (list)
+ ;; Build the list of available predicates.
+ (mapc (lambda (spec)
+ (add-to-list 'list `(const ,(car spec))))
+ (append TeX-view-predicate-list
+ TeX-view-predicate-list-builtin))
+ ;; Sort the list alphabetically.
+ (setq list (sort list
+ (lambda (a b)
+ (string<
+ (downcase (symbol-name (cadr a)))
+ (downcase (symbol-name (cadr
b)))))))
+ `(choice
+ (choice :tag "Predicate" ,@list)
+ (repeat :tag "List of predicates"
+ (choice :tag "Predicate" ,@list))))
+ (string :tag "Command part")))))
(group :tag "Function" function))
(choice :tag "Viewer executable(s)"
- (string :tag "One executable")
- (repeat :tag "List of executables" (string :tag "Name"))
- (const :tag "No executable" nil)))))
+ (string :tag "One executable")
+ (repeat :tag "List of executables" (string :tag "Name"))
+ (const :tag "No executable" nil)))))
(defcustom TeX-view-program-selection
(cond
@@ -1414,33 +1414,33 @@ and the viewer related to the first entry all
predicates of which
are evaluated positively is chosen."
:group 'TeX-view
:type `(alist :key-type
- ;; Offer list of defined predicates.
- ,(let (list)
- (mapc (lambda (spec)
- (add-to-list 'list `(const ,(car spec))))
- (append TeX-view-predicate-list
- TeX-view-predicate-list-builtin))
- (setq list (sort list
- (lambda (a b)
- (string<
- (downcase (symbol-name (cadr a)))
- (downcase (symbol-name (cadr b)))))))
- `(choice (choice :tag "Single predicate" ,@list)
- (repeat :tag "Multiple predicates"
- (choice ,@list))))
- :value-type
- ;; Offer list of defined viewers.
- (group (choice :tag "Viewer"
- ,@(let (list)
- (mapc (lambda (spec)
- (add-to-list 'list
- `(const ,(car spec))))
- (append TeX-view-program-list
- TeX-view-program-list-builtin))
- (sort list
- (lambda (a b)
- (string< (downcase (cadr a))
- (downcase (cadr b))))))))))
+ ;; Offer list of defined predicates.
+ ,(let (list)
+ (mapc (lambda (spec)
+ (add-to-list 'list `(const ,(car spec))))
+ (append TeX-view-predicate-list
+ TeX-view-predicate-list-builtin))
+ (setq list (sort list
+ (lambda (a b)
+ (string<
+ (downcase (symbol-name (cadr a)))
+ (downcase (symbol-name (cadr b)))))))
+ `(choice (choice :tag "Single predicate" ,@list)
+ (repeat :tag "Multiple predicates"
+ (choice ,@list))))
+ :value-type
+ ;; Offer list of defined viewers.
+ (group (choice :tag "Viewer"
+ ,@(let (list)
+ (mapc (lambda (spec)
+ (add-to-list 'list
+ `(const ,(car spec))))
+ (append TeX-view-program-list
+
TeX-view-program-list-builtin))
+ (sort list
+ (lambda (a b)
+ (string< (downcase (cadr a))
+ (downcase (cadr b))))))))))
(defun TeX-match-style (regexp)
"Check if a style matching REGEXP is active."
@@ -1454,67 +1454,67 @@ In case of a single symbol, return t if the predicate
is true,
nil otherwise. In case of a list of symbols, return t if all
predicates are true, nil otherwise."
(let ((pred-symbols (if (listp predicate) predicate (list predicate)))
- (pred-defs (append TeX-view-predicate-list
- TeX-view-predicate-list-builtin))
- (result t)
- elt)
+ (pred-defs (append TeX-view-predicate-list
+ TeX-view-predicate-list-builtin))
+ (result t)
+ elt)
(while (and (setq elt (pop pred-symbols)) result)
(unless (eval (cadr (assq elt pred-defs)))
- (setq result nil)))
+ (setq result nil)))
result))
(defun TeX-view-command-raw ()
"Choose a viewer and return its unexpanded command string."
(let ((selection TeX-view-program-selection)
- entry viewer item executable spec command)
+ entry viewer item executable spec command)
;; Find the appropriate viewer.
(while (and (setq entry (pop selection)) (not viewer))
(when (TeX-view-match-predicate (car entry))
- (setq viewer (cadr entry))))
+ (setq viewer (cadr entry))))
(unless viewer
(error "No matching viewer found"))
(setq item (assoc viewer (append TeX-view-program-list
- TeX-view-program-list-builtin))
- ;; Get the command line or function spec.
- spec (cadr item)
- ;; Get the name of the executable(s) associated to the viewer.
- executable (nth 2 item))
+ TeX-view-program-list-builtin))
+ ;; Get the command line or function spec.
+ spec (cadr item)
+ ;; Get the name of the executable(s) associated to the viewer.
+ executable (nth 2 item))
;; Check the executable exists.
(unless (or (null executable)
- (cond
- ((stringp executable)
- (executable-find (TeX-command-expand executable)))
- ((listp executable)
- (catch 'notfound
- (dolist (exec executable t)
- (unless (executable-find (TeX-command-expand exec))
- (throw 'notfound nil)))))))
+ (cond
+ ((stringp executable)
+ (executable-find (TeX-command-expand executable)))
+ ((listp executable)
+ (catch 'notfound
+ (dolist (exec executable t)
+ (unless (executable-find (TeX-command-expand exec))
+ (throw 'notfound nil)))))))
(error (format "Cannot find %S viewer. \
Select another one in `TeX-view-program-selection'" viewer)))
(cond ((functionp spec)
- ;; Converting the function call to a string is ugly, but
- ;; the backend currently only supports strings.
- (prin1-to-string spec))
- ((stringp spec)
- spec)
- ((null spec)
- (error
- (format "Unknown %S viewer. \
+ ;; Converting the function call to a string is ugly, but
+ ;; the backend currently only supports strings.
+ (prin1-to-string spec))
+ ((stringp spec)
+ spec)
+ ((null spec)
+ (error
+ (format "Unknown %S viewer. \
Check the `TeX-view-program-selection' variable" viewer)))
- (t
- ;; Build the unexpanded command line. Pieces with predicates are
- ;; only added if the predicate is evaluated positively.
- (dolist (elt spec)
- (cond ((stringp elt)
- (setq command (concat command elt)))
- ((listp elt)
- (when (TeX-view-match-predicate (car elt))
- (setq command (concat command (cadr elt)))))))
- (if (stringp command)
- command
- ;; Signal an error if `command' isn't a string. This prevents an
- ;; infinite loop in `TeX-command-expand' if `command' is nil.
- (error "Wrong viewer specification in
`TeX-view-program-list'"))))))
+ (t
+ ;; Build the unexpanded command line. Pieces with predicates are
+ ;; only added if the predicate is evaluated positively.
+ (dolist (elt spec)
+ (cond ((stringp elt)
+ (setq command (concat command elt)))
+ ((listp elt)
+ (when (TeX-view-match-predicate (car elt))
+ (setq command (concat command (cadr elt)))))))
+ (if (stringp command)
+ command
+ ;; Signal an error if `command' isn't a string. This prevents an
+ ;; infinite loop in `TeX-command-expand' if `command' is nil.
+ (error "Wrong viewer specification in
`TeX-view-program-list'"))))))
;;; Engine
@@ -1544,10 +1544,10 @@ You can override a built-in engine defined in the
variable
same symbol as the built-in entry to `TeX-engine-alist'."
:group 'TeX-command
:type '(repeat (group symbol
- (string :tag "Name")
- (choice :tag "Plain TeX command" string variable)
- (choice :tag "LaTeX command" string variable)
- (choice :tag "ConTeXt command" string variable))))
+ (string :tag "Name")
+ (choice :tag "Plain TeX command" string variable)
+ (choice :tag "LaTeX command" string variable)
+ (choice :tag "ConTeXt command" string variable))))
(defun TeX-engine-alist ()
"Return an alist of TeX engines.
@@ -1564,19 +1564,19 @@ Throw an error if `engine' is not present in the alist."
(or
(assq engine (TeX-engine-alist))
(error "`%s' is not a known engine. Valid values are: %s." engine
- (mapconcat
- (lambda (x) (prin1-to-string (car x)))
- (TeX-engine-alist) ", "))))
+ (mapconcat
+ (lambda (x) (prin1-to-string (car x)))
+ (TeX-engine-alist) ", "))))
(defcustom TeX-engine 'default
(concat "Type of TeX engine to use.
It should be one of the following symbols:\n\n"
- (mapconcat (lambda (x) (format "* `%s'" (car x)))
- (TeX-engine-alist) "\n"))
+ (mapconcat (lambda (x) (format "* `%s'" (car x)))
+ (TeX-engine-alist) "\n"))
:group 'TeX-command
:type `(choice ,@(mapcar (lambda (x)
- `(const :tag ,(nth 1 x) ,(car x)))
- (TeX-engine-alist))))
+ `(const :tag ,(nth 1 x) ,(car x)))
+ (TeX-engine-alist))))
(make-variable-buffer-local 'TeX-engine)
(put 'TeX-engine 'safe-local-variable
(lambda (arg) (memq arg (mapcar 'car TeX-engine-alist-builtin))))
@@ -1585,18 +1585,18 @@ It should be one of the following symbols:\n\n"
"Set TeX engine to TYPE.
For available TYPEs, see variable `TeX-engine'."
(interactive (list (completing-read "Engine: "
- (mapcar (lambda (x)
- (symbol-name (car x)))
- (TeX-engine-alist))
- nil t)))
+ (mapcar (lambda (x)
+ (symbol-name (car x)))
+ (TeX-engine-alist))
+ nil t)))
(when (stringp type)
(setq type (intern type)))
(setq TeX-engine type)
;; Automatically enable or disable TeX PDF mode as a convenience
(cond ((eq type 'xetex)
- (TeX-PDF-mode 1)
- (setq TeX-PDF-from-DVI nil))
- ((eq type 'omega) (TeX-PDF-mode 0))))
+ (TeX-PDF-mode 1)
+ (setq TeX-PDF-from-DVI nil))
+ ((eq type 'omega) (TeX-PDF-mode 0))))
(define-minor-mode TeX-Omega-mode
"Minor mode for using the Omega engine."
@@ -1629,17 +1629,17 @@ 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)))))
+ (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-output-page-function nil
@@ -1651,8 +1651,8 @@ as a string.")
(defcustom TeX-source-correlate-start-server 'ask
"Control if server should be started for inverse search."
:type '(choice (const :tag "Always" t)
- (const :tag "Never" nil)
- (const :tag "Ask" ask))
+ (const :tag "Never" nil)
+ (const :tag "Ask" ask))
:group 'TeX-view)
(when (fboundp 'defvaralias)
(defvaralias 'TeX-source-specials-view-start-server
@@ -1669,48 +1669,48 @@ search, can set the variable.")
(defun TeX-source-correlate-gnuserv-p ()
"Guess whether to use gnuserv when a server is requested."
(cond ((and (boundp 'gnuserv-process)
- (processp gnuserv-process)))
- ((and (boundp 'server-process)
- (processp server-process))
- nil)))
+ (processp gnuserv-process)))
+ ((and (boundp 'server-process)
+ (processp server-process))
+ nil)))
(defun TeX-source-correlate-server-enabled-p ()
"Return non-nil if Emacs server or gnuserv is enabled."
(let* ((gnuserv-p (TeX-source-correlate-gnuserv-p))
- (process (if gnuserv-p 'gnuserv-process 'server-process)))
+ (process (if gnuserv-p 'gnuserv-process 'server-process)))
(and (boundp process) (processp (symbol-value process)))))
(defun TeX-source-correlate-start-server-maybe ()
"Start Emacs server or gnuserv if a feature using it is enabled.
This is the case if `TeX-source-correlate-start-server-flag' is non-nil."
(when (and TeX-source-correlate-start-server-flag
- (not (TeX-source-correlate-server-enabled-p)))
+ (not (TeX-source-correlate-server-enabled-p)))
(let* ((gnuserv-p (TeX-source-correlate-gnuserv-p))
- (start (if gnuserv-p 'gnuserv-start 'server-start)))
+ (start (if gnuserv-p 'gnuserv-start 'server-start)))
(cond
;; Server should be started unconditionally
((eq TeX-source-correlate-start-server t)
- (funcall start))
+ (funcall start))
;; Ask user if server is to be started
((and (eq TeX-source-correlate-start-server 'ask)
- (not TeX-source-correlate-start-server-asked)
- (prog1
- (y-or-n-p (format "Start %s for inverse search in viewer? "
- (if gnuserv-p
- "gnuserv"
- "Emacs server")))
- (setq TeX-source-correlate-start-server-asked t)))
- (funcall start))))))
+ (not TeX-source-correlate-start-server-asked)
+ (prog1
+ (y-or-n-p (format "Start %s for inverse search in viewer? "
+ (if gnuserv-p
+ "gnuserv"
+ "Emacs server")))
+ (setq TeX-source-correlate-start-server-asked t)))
+ (funcall start))))))
(defun TeX-source-correlate-determine-method ()
"Determine which method is available for forward and inverse search."
(let ((help (condition-case nil
- (with-output-to-string
- (call-process LaTeX-command
- nil (list standard-output nil) nil "--help"))
- (error ""))))
+ (with-output-to-string
+ (call-process LaTeX-command
+ nil (list standard-output nil) nil "--help"))
+ (error ""))))
(if (string-match "^[ ]*-?-synctex" help)
- 'synctex
+ 'synctex
'source-specials)))
(defun TeX-source-correlate-method-active ()
@@ -1720,7 +1720,7 @@ This is the case if
`TeX-source-correlate-start-server-flag' is non-nil."
(TeX-source-correlate-determine-method))
((listp TeX-source-correlate-method)
(if TeX-PDF-mode
- (cdr (assoc 'pdf TeX-source-correlate-method))
+ (cdr (assoc 'pdf TeX-source-correlate-method))
(cdr (assoc 'dvi TeX-source-correlate-method))))
(t
TeX-source-correlate-method)))
@@ -1731,15 +1731,15 @@ 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)
- (concat TeX-source-specials-tex-flags
- (if TeX-source-specials-places
- ;; -src-specials=WHERE: insert source specials
- ;; in certain places of the DVI file. WHERE is a
- ;; comma-separated value list: cr display hbox
- ;; math par parend vbox
- (concat "=" (mapconcat 'identity
- TeX-source-specials-places ","))))
- TeX-synctex-tex-flags)
+ (concat TeX-source-specials-tex-flags
+ (if TeX-source-specials-places
+ ;; -src-specials=WHERE: insert source specials
+ ;; in certain places of the DVI file. WHERE is a
+ ;; comma-separated value list: cr display hbox
+ ;; math par parend vbox
+ (concat "=" (mapconcat 'identity
+ TeX-source-specials-places ","))))
+ TeX-synctex-tex-flags)
""))
(defvar TeX-source-correlate-map (make-sparse-keymap)
@@ -1751,17 +1751,17 @@ You could use this for unusual mouse bindings.")
That is, if FILE is `TeX-region', update FILE to the real tex
file and LINE to (+ LINE offset-of-region). Else, return nil."
(when (string-equal TeX-region (file-name-sans-extension
- (file-name-nondirectory file)))
+ (file-name-nondirectory file)))
(with-current-buffer (or (find-buffer-visiting file)
- (find-file-noselect file))
+ (find-file-noselect file))
(goto-char 0)
;; Same regexp used in `preview-parse-messages'. XXX: XEmacs doesn't
;; support regexp classes, so we can't use "[:digit:]" here.
(when (re-search-forward "!offset(\\([---0-9]+\\))" nil t)
- (let ((offset (string-to-number (match-string-no-properties 1))))
- (when TeX-region-orig-buffer
- (list (expand-file-name (buffer-file-name TeX-region-orig-buffer))
- (+ line offset) col)))))))
+ (let ((offset (string-to-number (match-string-no-properties 1))))
+ (when TeX-region-orig-buffer
+ (list (expand-file-name (buffer-file-name TeX-region-orig-buffer))
+ (+ line offset) col)))))))
(defcustom TeX-raise-frame-function #'raise-frame
"A function which will be called to raise the Emacs frame.
@@ -1803,34 +1803,34 @@ If the Emacs frame isn't raised, customize
;; absolute file:// URL. In the former case, the tex file has to be already
;; opened.
(let* ((file (progn
- (require 'url-parse)
- (require 'url-util)
- (url-unhex-string (aref (url-generic-parse-url file) 6))))
- (flc (or (apply #'TeX-source-correlate-handle-TeX-region file linecol)
- (apply #'list file linecol)))
- (file (car flc))
- (line (cadr flc))
- (col (nth 2 flc)))
+ (require 'url-parse)
+ (require 'url-util)
+ (url-unhex-string (aref (url-generic-parse-url file) 6))))
+ (flc (or (apply #'TeX-source-correlate-handle-TeX-region file linecol)
+ (apply #'list file linecol)))
+ (file (car flc))
+ (line (cadr flc))
+ (col (nth 2 flc)))
(pop-to-buffer (or (find-buffer-visiting file)
(find-file-noselect file)))
(push-mark nil 'nomsg)
(let ((pos
- (when (> line 0)
- (save-excursion
- (save-restriction
- (widen)
- (goto-char 1)
- (forward-line (1- line))
- (when (> col 0)
- (forward-char (1- col)))
- (point))))))
+ (when (> line 0)
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char 1)
+ (forward-line (1- line))
+ (when (> col 0)
+ (forward-char (1- col)))
+ (point))))))
(when pos
- (when (or (< pos (point-min))
- (> pos (point-max)))
- (widen))
- (goto-char pos))
+ (when (or (< pos (point-min))
+ (> pos (point-max)))
+ (widen))
+ (goto-char pos))
(when TeX-raise-frame-function
- (funcall TeX-raise-frame-function)))))
+ (funcall TeX-raise-frame-function)))))
(define-minor-mode TeX-source-correlate-mode
"Minor mode for forward and inverse search.
@@ -1850,7 +1850,7 @@ SyncTeX are recognized."
;; buffer-local.
:global t
(set-keymap-parent TeX-mode-map (and TeX-source-correlate-mode
- TeX-source-correlate-map))
+ TeX-source-correlate-map))
(TeX-set-mode-name 'TeX-source-correlate-mode t t)
(setq TeX-source-correlate-start-server-flag TeX-source-correlate-mode)
;; Register Emacs for the SyncSource DBUS signal emitted by
@@ -1869,7 +1869,7 @@ SyncTeX are recognized."
(put 'TeX-source-correlate-mode 'safe-local-variable #'booleanp)
(setq minor-mode-map-alist
(delq (assq 'TeX-source-correlate-mode minor-mode-map-alist)
- minor-mode-map-alist))
+ minor-mode-map-alist))
;;; Source Specials
@@ -1884,18 +1884,18 @@ SyncTeX are recognized."
If nil, use (La)TeX's defaults."
:group 'TeX-view
:type '(list (set :inline t
- ;; :tag "Options known to work"
- ;; cr display hbox math par parend vbox
- (const "cr")
- (const "display")
- (const "hbox")
- (const "math")
- (const "par")
- (const "parend")
- (const "vbox"))
- (repeat :inline t
- :tag "Other options"
- (string))))
+ ;; :tag "Options known to work"
+ ;; cr display hbox math par parend vbox
+ (const "cr")
+ (const "display")
+ (const "hbox")
+ (const "math")
+ (const "par")
+ (const "parend")
+ (const "vbox"))
+ (repeat :inline t
+ :tag "Other options"
+ (string))))
(defcustom TeX-source-specials-view-position-flags
"-sourceposition \"%n %b\""
@@ -1926,17 +1926,17 @@ If nil, use (La)TeX's defaults."
"Return gnuclient or emacslient executable with options.
Return the full path to the executable if possible."
(let* ((gnuserv-p (TeX-source-correlate-gnuserv-p))
- (client-base (if gnuserv-p
- "gnuclient"
- "emacsclient"))
- (client-full (and invocation-directory
- (expand-file-name client-base
- invocation-directory)))
- (options (if gnuserv-p
- TeX-source-specials-view-gnuclient-flags
- TeX-source-specials-view-emacsclient-flags)))
+ (client-base (if gnuserv-p
+ "gnuclient"
+ "emacsclient"))
+ (client-full (and invocation-directory
+ (expand-file-name client-base
+ invocation-directory)))
+ (options (if gnuserv-p
+ TeX-source-specials-view-gnuclient-flags
+ TeX-source-specials-view-emacsclient-flags)))
(if (and client-full (file-executable-p client-full))
- (concat client-full " " options)
+ (concat client-full " " options)
(concat client-base " " options))))
(defun TeX-source-specials-view-expand-options (&optional _viewer)
@@ -1947,10 +1947,10 @@ 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)))
+ (when (TeX-source-correlate-server-enabled-p)
+ (concat " " TeX-source-specials-view-editor-flags)))
""))
;;; SyncTeX
@@ -1963,15 +1963,15 @@ returned."
This method assumes that the document was compiled with SyncTeX
enabled and the `synctex' binary is available."
(let ((synctex-output
- (with-output-to-string
- (call-process "synctex" nil (list standard-output nil) nil "view"
- "-i" (format "%s:%s:%s" (1+ (TeX-current-offset))
- ;; FIXME: Using `current-column'
- ;; here is dubious. See comment in
- ;; `TeX-evince-sync-view-1'.
- (1+ (current-column))
- file)
- "-o" (TeX-active-master (TeX-output-extension))))))
+ (with-output-to-string
+ (call-process "synctex" nil (list standard-output nil) nil "view"
+ "-i" (format "%s:%s:%s" (1+ (TeX-current-offset))
+ ;; FIXME: Using `current-column'
+ ;; here is dubious. See comment in
+ ;; `TeX-evince-sync-view-1'.
+ (1+ (current-column))
+ file)
+ "-o" (TeX-active-master (TeX-output-extension))))))
(when (string-match "^Page:\\([0-9]+\\)" synctex-output)
(match-string 1 synctex-output))))
@@ -1980,19 +1980,19 @@ enabled and the `synctex' binary is available."
This method assumes that the document was compiled with SyncTeX
enabled and the `synctex' binary is available."
(let* ((file (file-relative-name (buffer-file-name)
- (file-name-directory
- (TeX-active-master))))
- (abs-file (concat (expand-file-name (or (file-name-directory
(TeX-active-master))
- (file-name-directory
(buffer-file-name))))
- "./" file)))
+ (file-name-directory
+ (TeX-active-master))))
+ (abs-file (concat (expand-file-name (or (file-name-directory
(TeX-active-master))
+ (file-name-directory
(buffer-file-name))))
+ "./" file)))
;; It's known that depending on synctex version one of
;; /absolute/path/./foo/bar.tex, foo/bar.tex, or ./foo/bar.tex (relative to
;; TeX-master, and the "." in the absolute path is important) are needed.
;; So try all variants before falling back to page 1.
(or (TeX-synctex-output-page-1 abs-file)
- (TeX-synctex-output-page-1 file)
- (TeX-synctex-output-page-1 (concat "./" file))
- "1")))
+ (TeX-synctex-output-page-1 file)
+ (TeX-synctex-output-page-1 (concat "./" file))
+ "1")))
;;; Miscellaneous minor modes
@@ -2022,7 +2022,7 @@ function `TeX-global-PDF-mode' for toggling this value."
(setq TeX-PDF-mode-parsed nil)
(TeX-set-mode-name nil nil t)
(setq TeX-output-extension
- (if TeX-PDF-mode "pdf" "dvi")))
+ (if TeX-PDF-mode "pdf" "dvi")))
(add-to-list 'minor-mode-alist '(TeX-PDF-mode ""))
(defun TeX-global-PDF-mode (&optional arg)
@@ -2030,8 +2030,8 @@ function `TeX-global-PDF-mode' for toggling this value."
(interactive "P")
(prog1
(setq-default TeX-PDF-mode
- (if arg (> (prefix-numeric-value arg) 0)
- (not (default-value 'TeX-PDF-mode))))
+ (if arg (> (prefix-numeric-value arg) 0)
+ (not (default-value 'TeX-PDF-mode))))
(TeX-set-mode-name 'TeX-PDF-mode nil t)))
(defalias 'tex-pdf-mode 'TeX-PDF-mode)
@@ -2055,7 +2055,7 @@ already established, don't do anything."
(if TeX-PDF-mode-parsed
(unless (eq TeX-PDF-mode arg)
- (TeX-PDF-mode (if (default-value 'TeX-PDF-mode) 1 0)))
+ (TeX-PDF-mode (if (default-value 'TeX-PDF-mode) 1 0)))
(unless (local-variable-p 'TeX-PDF-mode (current-buffer))
(TeX-PDF-mode (if arg 1 0))
(setq TeX-PDF-mode-parsed t))))
@@ -2092,9 +2092,9 @@ Programs should not use this variable directly but the
function
`TeX-PDF-via-dvips-ps2pdf'."
:group 'TeX-command
:type '(choice
- (const :tag "No DVI to PDF conversion" nil)
- (const :tag "dvips - ps2pdf sequence" "Dvips")
- (const :tag "dvipdfmx" "Dvipdfmx")))
+ (const :tag "No DVI to PDF conversion" nil)
+ (const :tag "dvips - ps2pdf sequence" "Dvips")
+ (const :tag "dvipdfmx" "Dvipdfmx")))
;; If you plan to support new values of `TeX-PDF-from-DVI' remember to update
;; `TeX-command-default' accordingly.
(make-variable-buffer-local 'TeX-PDF-from-DVI)
@@ -2207,34 +2207,34 @@ If prefix ARG is non-nil, not only remove intermediate
but also
output files."
(interactive "P")
(let* ((mode-prefix (TeX-mode-prefix))
- (suffixes (append (symbol-value
- (intern (concat mode-prefix
- "-clean-intermediate-suffixes")))
- (when arg
- (symbol-value
- (intern (concat mode-prefix
- "-clean-output-suffixes"))))))
- (master (TeX-active-master))
- (master-dir (file-name-directory master))
- (regexp (concat "\\("
- (regexp-quote (file-name-nondirectory master)) "\\|"
- (regexp-quote (TeX-region-file nil t))
- "\\)"
- "\\("
- (mapconcat 'identity suffixes "\\|")
- "\\)\\'"
- "\\|" (regexp-quote (TeX-region-file t t))))
- (files (when regexp
- (directory-files (or master-dir ".") nil regexp))))
+ (suffixes (append (symbol-value
+ (intern (concat mode-prefix
+ "-clean-intermediate-suffixes")))
+ (when arg
+ (symbol-value
+ (intern (concat mode-prefix
+ "-clean-output-suffixes"))))))
+ (master (TeX-active-master))
+ (master-dir (file-name-directory master))
+ (regexp (concat "\\("
+ (regexp-quote (file-name-nondirectory master)) "\\|"
+ (regexp-quote (TeX-region-file nil t))
+ "\\)"
+ "\\("
+ (mapconcat 'identity suffixes "\\|")
+ "\\)\\'"
+ "\\|" (regexp-quote (TeX-region-file t t))))
+ (files (when regexp
+ (directory-files (or master-dir ".") nil regexp))))
(if files
- (when (or (not TeX-clean-confirm)
- (dired-mark-pop-up " *Deletions*" 'delete
- (if (> (length files) 1)
- files
- (cons t files))
- 'y-or-n-p "Delete files? "))
- (dolist (file files)
- (delete-file (concat master-dir file))))
+ (when (or (not TeX-clean-confirm)
+ (dired-mark-pop-up " *Deletions*" 'delete
+ (if (> (length files) 1)
+ files
+ (cons t files))
+ 'y-or-n-p "Delete files? "))
+ (dolist (file files)
+ (delete-file (concat master-dir file))))
(message "No files to be deleted"))))
;;; Master File
@@ -2261,15 +2261,15 @@ the Emacs manual) to set this variable permanently for
each file."
:group 'TeX-command
:group 'TeX-parse
:type '(choice (const :tag "Query" nil)
- (const :tag "This file" t)
- (const :tag "Shared" shared)
- (const :tag "Dwim" dwim)
- (string :format "%v")))
+ (const :tag "This file" t)
+ (const :tag "Shared" shared)
+ (const :tag "Dwim" dwim)
+ (string :format "%v")))
(make-variable-buffer-local 'TeX-master)
(put 'TeX-master 'safe-local-variable
'(lambda (x)
- (or (stringp x)
- (member x (quote (t nil shared dwim))))))
+ (or (stringp x)
+ (member x (quote (t nil shared dwim))))))
(defcustom TeX-one-master "\\.\\(texi?\\|dtx\\)$"
"Regular expression matching ordinary TeX files.
@@ -2294,8 +2294,8 @@ this variable to \"<none>\"."
(cl-loop for buf in (buffer-list)
until
(when (with-current-buffer buf
- (and (equal dir default-directory)
- (stringp TeX-master)))
+ (and (equal dir default-directory)
+ (stringp TeX-master)))
(cl-return (with-current-buffer buf TeX-master))))))
(defun TeX-master-file-ask ()
@@ -2304,31 +2304,31 @@ this variable to \"<none>\"."
(if (TeX-local-master-p)
(error "Master file already set")
(let* ((default (TeX-dwim-master))
- (name (or (and (eq 'dwim TeX-master) default)
- (condition-case nil
- (read-file-name (format "Master file (default %s): "
- (or default "this file"))
- nil default)
- (quit "<quit>")))))
+ (name (or (and (eq 'dwim TeX-master) default)
+ (condition-case nil
+ (read-file-name (format "Master file (default %s): "
+ (or default "this file"))
+ nil default)
+ (quit "<quit>")))))
(cond ((string= name "<quit>")
- (setq TeX-master t))
- ((string= name default)
- (setq TeX-master default)
- (TeX-add-local-master))
- ((or
- ;; Default `read-file-name' proposes and buffer visits a file.
- (string= (expand-file-name name) (buffer-file-name))
- ;; Default of `read-file-name' and buffer does not visit a file.
- (string= name default-directory)
- ;; User typed <RET> in an empty minibuffer.
- (string= name ""))
- (setq TeX-master t)
- (TeX-add-local-master))
- (t
- (setq TeX-master (TeX-strip-extension (file-relative-name name)
- (list TeX-default-extension)
- 'path))
- (TeX-add-local-master))))))
+ (setq TeX-master t))
+ ((string= name default)
+ (setq TeX-master default)
+ (TeX-add-local-master))
+ ((or
+ ;; Default `read-file-name' proposes and buffer visits a file.
+ (string= (expand-file-name name) (buffer-file-name))
+ ;; Default of `read-file-name' and buffer does not visit a file.
+ (string= name default-directory)
+ ;; User typed <RET> in an empty minibuffer.
+ (string= name ""))
+ (setq TeX-master t)
+ (TeX-add-local-master))
+ (t
+ (setq TeX-master (TeX-strip-extension (file-relative-name name)
+ (list TeX-default-extension)
+ 'path))
+ (TeX-add-local-master))))))
(defun TeX-master-file (&optional extension nondirectory ask)
"Set and return the name of the master file for the current document.
@@ -2345,70 +2345,70 @@ name of master file if it cannot be determined
otherwise."
(if (eq extension t)
(setq extension TeX-default-extension))
(let ((my-name (if (buffer-file-name)
- (TeX-strip-extension nil (list TeX-default-extension) t)
- "<none>")))
+ (TeX-strip-extension nil (list TeX-default-extension) t)
+ "<none>")))
(save-excursion
(save-restriction
- (widen)
- (goto-char (point-min))
- (cond
- ((and TeX-transient-master
- (or (not TeX-master) (eq TeX-master 'shared)))
- (setq TeX-master TeX-transient-master))
- ;; Special value 't means it is own master (a free file).
- ((equal TeX-master my-name)
- (setq TeX-master t))
-
- ;; For files shared between many documents.
- ((and (eq 'shared TeX-master) ask)
- (setq TeX-master
- (let* ((default (TeX-dwim-master))
- (name (read-file-name
- (format "Master file (default %s): "
- (or default "this file"))
- nil default)))
- (cond ((string= name default)
- default)
- ((or
- ;; Default `read-file-name' proposes and
- ;; buffer visits a file.
- (string= (expand-file-name name)
- (buffer-file-name))
- ;; Default of `read-file-name' and
- ;; buffer does not visit a file.
- (string= name default-directory)
- ;; User typed <RET> in an empty minibuffer.
- (string= name ""))
- t)
- (t
- (TeX-strip-extension
- name (list TeX-default-extension) 'path))))))
-
- ;; We might already know the name.
- ((or (eq TeX-master t) (stringp TeX-master)) TeX-master)
-
- ;; Ask the user (but add it as a local variable).
- (ask (TeX-master-file-ask)))))
+ (widen)
+ (goto-char (point-min))
+ (cond
+ ((and TeX-transient-master
+ (or (not TeX-master) (eq TeX-master 'shared)))
+ (setq TeX-master TeX-transient-master))
+ ;; Special value 't means it is own master (a free file).
+ ((equal TeX-master my-name)
+ (setq TeX-master t))
+
+ ;; For files shared between many documents.
+ ((and (eq 'shared TeX-master) ask)
+ (setq TeX-master
+ (let* ((default (TeX-dwim-master))
+ (name (read-file-name
+ (format "Master file (default %s): "
+ (or default "this file"))
+ nil default)))
+ (cond ((string= name default)
+ default)
+ ((or
+ ;; Default `read-file-name' proposes and
+ ;; buffer visits a file.
+ (string= (expand-file-name name)
+ (buffer-file-name))
+ ;; Default of `read-file-name' and
+ ;; buffer does not visit a file.
+ (string= name default-directory)
+ ;; User typed <RET> in an empty minibuffer.
+ (string= name ""))
+ t)
+ (t
+ (TeX-strip-extension
+ name (list TeX-default-extension) 'path))))))
+
+ ;; We might already know the name.
+ ((or (eq TeX-master t) (stringp TeX-master)) TeX-master)
+
+ ;; Ask the user (but add it as a local variable).
+ (ask (TeX-master-file-ask)))))
(let ((name (if (stringp TeX-master)
- TeX-master
- my-name)))
+ TeX-master
+ my-name)))
(if (TeX-match-extension name)
- ;; If it already has an extension...
- (if (equal extension TeX-default-extension)
- ;; Use instead of the default extension
- (setq extension nil)
- ;; Otherwise drop it.
- (setq name (TeX-strip-extension name))))
+ ;; If it already has an extension...
+ (if (equal extension TeX-default-extension)
+ ;; Use instead of the default extension
+ (setq extension nil)
+ ;; Otherwise drop it.
+ (setq name (TeX-strip-extension name))))
;; Remove directory if needed.
(if nondirectory
- (setq name (file-name-nondirectory name)))
+ (setq name (file-name-nondirectory name)))
(if extension
- (concat name "." extension)
- name))))
+ (concat name "." extension)
+ name))))
(defun TeX-master-directory ()
"Directory of master file."
@@ -2417,52 +2417,52 @@ name of master file if it cannot be determined
otherwise."
(substitute-in-file-name
(expand-file-name
(let ((dir (file-name-directory (TeX-master-file))))
- (if dir (directory-file-name dir) "."))
+ (if dir (directory-file-name dir) "."))
(and buffer-file-name
- (file-name-directory buffer-file-name)))))))
+ (file-name-directory buffer-file-name)))))))
(defun TeX-add-local-master ()
"Add local variable for `TeX-master'.
Get `major-mode' from master file and enable it."
(when (and (buffer-file-name)
- (string-match TeX-one-master
- (file-name-nondirectory (buffer-file-name)))
- (not buffer-read-only))
+ (string-match TeX-one-master
+ (file-name-nondirectory (buffer-file-name)))
+ (not buffer-read-only))
(goto-char (point-max))
(if (re-search-backward "^\\([^\n]+\\)Local Variables:"
- (- (point-max) 3000) t)
- (let ((prefix (TeX-match-buffer 1)))
- (re-search-forward (regexp-quote (concat prefix
- "End:")))
- (beginning-of-line 1)
- (insert prefix "TeX-master: " (prin1-to-string TeX-master) "\n"))
+ (- (point-max) 3000) t)
+ (let ((prefix (TeX-match-buffer 1)))
+ (re-search-forward (regexp-quote (concat prefix
+ "End:")))
+ (beginning-of-line 1)
+ (insert prefix "TeX-master: " (prin1-to-string TeX-master) "\n"))
(let* ((mode (if (stringp TeX-master)
- (with-current-buffer
- (find-file-noselect
- (TeX-master-file TeX-default-extension))
- major-mode)
- major-mode))
- (comment-prefix (cond ((eq mode 'texinfo-mode) "@c ")
- ((eq mode 'doctex-mode) "% ")
- (t "%%% ")))
- (mode-string (concat (and (boundp 'japanese-TeX-mode)
japanese-TeX-mode
- "japanese-")
- (substring (symbol-name mode) 0 -5))))
- (newline)
- (when (eq major-mode 'doctex-mode)
- (insert comment-prefix TeX-esc "endinput\n"))
- (insert
- comment-prefix "Local Variables:\n"
- comment-prefix "mode: " mode-string "\n"
- comment-prefix "TeX-master: " (prin1-to-string TeX-master) "\n"
- comment-prefix "End:\n")
- (unless (eq mode major-mode)
- (funcall mode)
- ;; TeX modes run `VirTeX-common-initialization' which kills all local
- ;; variables, thus `TeX-master' will be forgotten after `(funcall
- ;; mode)'. Reparse local variables in order to bring it back.
- (hack-local-variables))))))
+ (with-current-buffer
+ (find-file-noselect
+ (TeX-master-file TeX-default-extension))
+ major-mode)
+ major-mode))
+ (comment-prefix (cond ((eq mode 'texinfo-mode) "@c ")
+ ((eq mode 'doctex-mode) "% ")
+ (t "%%% ")))
+ (mode-string (concat (and (boundp 'japanese-TeX-mode)
japanese-TeX-mode
+ "japanese-")
+ (substring (symbol-name mode) 0 -5))))
+ (newline)
+ (when (eq major-mode 'doctex-mode)
+ (insert comment-prefix TeX-esc "endinput\n"))
+ (insert
+ comment-prefix "Local Variables:\n"
+ comment-prefix "mode: " mode-string "\n"
+ comment-prefix "TeX-master: " (prin1-to-string TeX-master) "\n"
+ comment-prefix "End:\n")
+ (unless (eq mode major-mode)
+ (funcall mode)
+ ;; TeX modes run `VirTeX-common-initialization' which kills all local
+ ;; variables, thus `TeX-master' will be forgotten after `(funcall
+ ;; mode)'. Reparse local variables in order to bring it back.
+ (hack-local-variables))))))
(defun TeX-local-master-p ()
"Return non-nil if there is a `TeX-master' entry in local variables spec.
@@ -2506,11 +2506,11 @@ seperated by REGEXP.
Examples:
(TeX-split-string \"\:\" \"abc:def:ghi\")
- -> (\"abc\" \"def\" \"ghi\")
+ -> (\"abc\" \"def\" \"ghi\")
(TeX-split-string \" +\" \"dvips -Plw -p3 -c4 testfile.dvi\")
- -> (\"dvips\" \"-Plw\" \"-p3\" \"-c4\" \"testfile.dvi\")
+ -> (\"dvips\" \"-Plw\" \"-p3\" \"-c4\" \"testfile.dvi\")
If REGEXP is nil, or \"\", an error will occur."
@@ -2524,25 +2524,25 @@ If REGEXP is nil, or \"\", an error will occur."
(defun TeX-parse-path (env)
"Return a list if private TeX directories found in environment variable ENV."
(let* ((value (getenv env))
- (entries (and value
- (TeX-split-string
- (if (string-match ";" value) ";" ":")
- value)))
- (global (append '("/" "\\")
- (mapcar #'file-name-as-directory
- TeX-macro-global)))
- entry
- answers)
+ (entries (and value
+ (TeX-split-string
+ (if (string-match ";" value) ";" ":")
+ value)))
+ (global (append '("/" "\\")
+ (mapcar #'file-name-as-directory
+ TeX-macro-global)))
+ entry
+ answers)
(while entries
(setq entry (car entries))
(setq entries (cdr entries))
(setq entry (file-name-as-directory
- (if (string-match "/?/?\\'" entry)
- (substring entry 0 (match-beginning 0))
- entry)))
+ (if (string-match "/?/?\\'" entry)
+ (substring entry 0 (match-beginning 0))
+ entry)))
(or (not (file-name-absolute-p entry))
- (member entry global)
- (setq answers (cons entry answers))))
+ (member entry global)
+ (setq answers (cons entry answers))))
answers))
(defun TeX-kpathsea-detect-path-delimiter ()
@@ -2550,20 +2550,20 @@ If REGEXP is nil, or \"\", an error will occur."
Usually return \":\" or \";\". If auto detect fails for some reason,
return nil."
(let ((res (ignore-errors
- (with-output-to-string
- (call-process "kpsewhich" nil
- (list standard-output nil) nil
- "--expand-path" "{.,..}")))))
+ (with-output-to-string
+ (call-process "kpsewhich" nil
+ (list standard-output nil) nil
+ "--expand-path" "{.,..}")))))
;; kpsewhich expands "{.,..}" to ".:SOMEDIR" or ".;SOMEDIR"
;; according to its environment.
;; Don't use "{.,.}" instead because kpsewhich of MiKTeX 2.9
;; simplifies it to just a ".", not ".;.".
(and (stringp res) (> (length res) 0)
- ;; Check whether ; is contained. This should work even if
- ;; some implementation of kpsewhich considers it sane to
- ;; insert drive letters or directory separators or whatever
- ;; else to the current directory.
- (if (string-match ";" res) ";" ":"))))
+ ;; Check whether ; is contained. This should work even if
+ ;; some implementation of kpsewhich considers it sane to
+ ;; insert drive letters or directory separators or whatever
+ ;; else to the current directory.
+ (if (string-match ";" res) ";" ":"))))
(defcustom TeX-kpathsea-path-delimiter
(TeX-kpathsea-detect-path-delimiter)
@@ -2571,9 +2571,9 @@ return nil."
t means autodetect, nil means kpathsea is disabled."
:group 'TeX-file
:type '(choice (const ":")
- (const ";")
- (const :tag "Autodetect" t)
- (const :tag "Off" nil)))
+ (const ";")
+ (const :tag "Autodetect" t)
+ (const :tag "Off" nil)))
(defun TeX-tree-expand (vars program &optional subdirs)
"Return directories corresponding to the kpathsea variables VARS.
@@ -2587,44 +2587,44 @@ are returned."
;; several elements separated by "/".
(if (eq TeX-kpathsea-path-delimiter t)
(setq TeX-kpathsea-path-delimiter
- (TeX-kpathsea-detect-path-delimiter)))
+ (TeX-kpathsea-detect-path-delimiter)))
(when TeX-kpathsea-path-delimiter
(let* ((exit-status 1)
- (args `(,@(if program `("--progname" ,program))
- "--expand-path"
- ,(mapconcat #'identity vars
- TeX-kpathsea-path-delimiter)))
- (path-list (ignore-errors
- (with-output-to-string
- (setq exit-status
- (apply #'call-process
- "kpsewhich" nil
- (list standard-output nil) nil
- args))))))
+ (args `(,@(if program `("--progname" ,program))
+ "--expand-path"
+ ,(mapconcat #'identity vars
+ TeX-kpathsea-path-delimiter)))
+ (path-list (ignore-errors
+ (with-output-to-string
+ (setq exit-status
+ (apply #'call-process
+ "kpsewhich" nil
+ (list standard-output nil) nil
+ args))))))
(if (not (zerop exit-status))
- ;; kpsewhich is not available. Disable subsequent usage.
- (setq TeX-kpathsea-path-delimiter nil)
- (let ((separators (format "[\n\r%s]" TeX-kpathsea-path-delimiter))
- path input-dir-list)
- (dolist (item (split-string path-list separators t))
- (if subdirs
- (dolist (subdir subdirs)
- (setq path (file-name-as-directory (concat item subdir)))
- (when (file-exists-p path)
- (cl-pushnew path input-dir-list :test #'equal)))
- (setq path (file-name-as-directory item))
- (when (file-exists-p path)
- (cl-pushnew path input-dir-list :test #'equal))))
- ;; No duplication in result is assured since `cl-pushnew' is
- ;; used above. Should we introduce an option for speed just
- ;; to accumulate all the results without care for
- ;; duplicates?
- (nreverse input-dir-list))))))
+ ;; kpsewhich is not available. Disable subsequent usage.
+ (setq TeX-kpathsea-path-delimiter nil)
+ (let ((separators (format "[\n\r%s]" TeX-kpathsea-path-delimiter))
+ path input-dir-list)
+ (dolist (item (split-string path-list separators t))
+ (if subdirs
+ (dolist (subdir subdirs)
+ (setq path (file-name-as-directory (concat item subdir)))
+ (when (file-exists-p path)
+ (cl-pushnew path input-dir-list :test #'equal)))
+ (setq path (file-name-as-directory item))
+ (when (file-exists-p path)
+ (cl-pushnew path input-dir-list :test #'equal))))
+ ;; No duplication in result is assured since `cl-pushnew' is
+ ;; used above. Should we introduce an option for speed just
+ ;; to accumulate all the results without care for
+ ;; duplicates?
+ (nreverse input-dir-list))))))
(defun TeX-macro-global ()
"Return directories containing the site's TeX macro and style files."
(or (TeX-tree-expand '("$SYSTEXMF" "$TEXMFLOCAL" "$TEXMFMAIN" "$TEXMFDIST")
- "latex" '("/tex/" "/bibtex/bst/"))
+ "latex" '("/tex/" "/bibtex/bst/"))
'("/usr/share/texmf/tex/" "/usr/share/texmf/bibtex/bst/")))
(defun TeX-macro-private ()
@@ -2637,38 +2637,38 @@ are returned."
:type '(repeat (directory :format "%v")))
(defcustom TeX-macro-private (or (append (TeX-parse-path "TEXINPUTS")
- (TeX-parse-path "BIBINPUTS"))
- (TeX-macro-private))
+ (TeX-parse-path "BIBINPUTS"))
+ (TeX-macro-private))
"Directories where you store your personal TeX macros."
:group 'TeX-file
:type '(repeat (file :format "%v")))
(defcustom TeX-auto-private
(list (expand-file-name TeX-auto-local
- (or (and (boundp 'user-emacs-directory)
- (concat user-emacs-directory "auctex/"))
- "~/.emacs.d/auctex/")))
+ (or (and (boundp 'user-emacs-directory)
+ (concat user-emacs-directory "auctex/"))
+ "~/.emacs.d/auctex/")))
"List of directories containing automatically generated AUCTeX style files.
These correspond to the personal TeX macros."
:group 'TeX-file
:type '(repeat (file :format "%v")))
-(if (stringp TeX-auto-private) ;Backward compatibility
+(if (stringp TeX-auto-private) ;Backward compatibility
(setq TeX-auto-private (list TeX-auto-private)))
(defcustom TeX-style-private
(list (expand-file-name TeX-style-local
- (or (and (boundp 'user-emacs-directory)
- (concat user-emacs-directory "auctex/"))
- "~/.emacs.d/auctex/")))
+ (or (and (boundp 'user-emacs-directory)
+ (concat user-emacs-directory "auctex/"))
+ "~/.emacs.d/auctex/")))
"List of directories containing hand-generated AUCTeX style files.
These correspond to the personal TeX macros."
:group 'TeX-file
:type '(repeat (file :format "%v")))
-(if (stringp TeX-style-private) ;Backward compatibility
+(if (stringp TeX-style-private) ;Backward compatibility
(setq TeX-style-private (list TeX-style-private)))
(defcustom TeX-style-path
@@ -2676,8 +2676,8 @@ These correspond to the personal TeX macros."
;; Put directories in an order where the more local files can
;; override the more global ones.
(mapc (lambda (file)
- (when (and file (not (member file path)))
- (setq path (cons file path))))
+ (when (and file (not (member file path)))
+ (setq path (cons file path))))
(append (list TeX-auto-global TeX-style-global)
TeX-auto-private TeX-style-private
(list TeX-auto-local TeX-style-local)))
@@ -2740,11 +2740,11 @@ Supported values are described below:
* `:bibtex' for files in BibTeX mode.
* `:context' for files in ConTeXt mode.
* `:latex' for files in LaTeX mode, or any mode derived
- thereof.
+ thereof.
* `:plain-tex' for files in plain-TeX mode.
* `:texinfo' for Texinfo files.
* `:classopt' for class options of LaTeX document. Just
- considered as a pseudo-dialect.
+ considered as a pseudo-dialect.
Purpose is notably to prevent non-Texinfo hooks to be run in
Texinfo files, due to ambiguous style name, as this may cause bad
@@ -2762,48 +2762,48 @@ side effect e.g. on variable `TeX-font-list'.")
(defun TeX-load-style (style)
"Search for and load each definition for STYLE in `TeX-style-path'."
(cond ((assoc style TeX-style-hook-list)) ; We already found it
- ((string-match "\\`\\(.+[/\\]\\)\\([^/\\]*\\)\\'" style) ;Complex path
- (let* ((dir (substring style (match-beginning 1) (match-end 1)))
- (style (substring style (match-beginning 2) (match-end 2)))
- (master-dir (if (stringp TeX-master)
- (file-name-directory
- (file-relative-name TeX-master))
- "./"))
- (TeX-style-path (append (list (expand-file-name
- TeX-auto-local dir)
- (expand-file-name
- TeX-auto-local master-dir)
- (expand-file-name
- TeX-style-local dir)
- (expand-file-name
- TeX-style-local master-dir))
- TeX-style-path)))
- (TeX-load-style style)))
- (t ;Relative path
- ;; Insert empty list to mark the fact that we have searched.
- (setq TeX-style-hook-list (cons (list style) TeX-style-hook-list))
- ;; Now check each element of the path
- (dolist (name TeX-style-path)
- (TeX-load-style-file (expand-file-name style name))))))
+ ((string-match "\\`\\(.+[/\\]\\)\\([^/\\]*\\)\\'" style) ;Complex path
+ (let* ((dir (substring style (match-beginning 1) (match-end 1)))
+ (style (substring style (match-beginning 2) (match-end 2)))
+ (master-dir (if (stringp TeX-master)
+ (file-name-directory
+ (file-relative-name TeX-master))
+ "./"))
+ (TeX-style-path (append (list (expand-file-name
+ TeX-auto-local dir)
+ (expand-file-name
+ TeX-auto-local master-dir)
+ (expand-file-name
+ TeX-style-local dir)
+ (expand-file-name
+ TeX-style-local master-dir))
+ TeX-style-path)))
+ (TeX-load-style style)))
+ (t ;Relative path
+ ;; Insert empty list to mark the fact that we have searched.
+ (setq TeX-style-hook-list (cons (list style) TeX-style-hook-list))
+ ;; Now check each element of the path
+ (dolist (name TeX-style-path)
+ (TeX-load-style-file (expand-file-name style name))))))
(defun TeX-load-style-file (file)
"Load FILE checking for a Lisp extensions."
(let ((el (concat file ".el"))
- (elc (concat file ".elc")))
+ (elc (concat file ".elc")))
(cond ((file-newer-than-file-p el elc)
- (if (file-readable-p el)
- (if (and TeX-byte-compile
- (file-writable-p elc)
- (save-excursion
- ;; `byte-compile-file' switches buffer in Emacs 20.3.
- (byte-compile-file el))
- (file-readable-p elc))
- (load-file elc)
- (load-file el))))
- ((file-readable-p elc)
- (load-file elc))
- ((file-readable-p el)
- (load-file el)))))
+ (if (file-readable-p el)
+ (if (and TeX-byte-compile
+ (file-writable-p elc)
+ (save-excursion
+ ;; `byte-compile-file' switches buffer in Emacs 20.3.
+ (byte-compile-file el))
+ (file-readable-p elc))
+ (load-file elc)
+ (load-file el))))
+ ((file-readable-p elc)
+ (load-file elc))
+ ((file-readable-p el)
+ (load-file el)))))
(defconst TeX-style-hook-dialect-weight-alist
'((:latex . 1) (:texinfo . 2) (:bibtex . 4) (:plain-tex . 8) (:context . 16)
@@ -2817,12 +2817,12 @@ side effect e.g. on variable `TeX-font-list'.")
((symbolp dialect-expr)
(let ((cell (assq dialect-expr TeX-style-hook-dialect-weight-alist)))
(if cell (cdr cell)
- (error "Invalid dialect expression : %S." dialect-expr))))
+ (error "Invalid dialect expression : %S." dialect-expr))))
((and (consp dialect-expr)
- (memq (car dialect-expr) '(or not and nor)))
+ (memq (car dialect-expr) '(or not and nor)))
(apply (intern
- (concat "TeX-shdex-" (symbol-name (car dialect-expr))))
- (cdr dialect-expr)))
+ (concat "TeX-shdex-" (symbol-name (car dialect-expr))))
+ (cdr dialect-expr)))
(t
(error "Invalid dialect expression : %S." dialect-expr))))
@@ -2846,7 +2846,7 @@ side effect e.g. on variable `TeX-font-list'.")
"Test whether dialect DIALECT is in dialect set DIALECT-SET."
(let ((cell (assq dialect TeX-style-hook-dialect-weight-alist)))
(if cell
- (/= 0 (logand (cdr cell) dialect-set))
+ (/= 0 (logand (cdr cell) dialect-set))
(error "Invalid dialect %S" dialect))))
(defsubst TeX-shdex-listify (dialect-set)
@@ -2855,7 +2855,7 @@ comprised in this set, where dialects are symbols"
(let (ret)
(dolist (c dialect-set)
(when (/= 0 (logand (cdr c) dialect-set))
- (push (car c) ret)))
+ (push (car c) ret)))
ret))
(defun TeX-add-style-hook (style hook &optional dialect-expr)
@@ -2878,17 +2878,17 @@ When omitted DIALECT-EXPR is equivalent to `(nor )', ie
all
dialected are allowed."
(let ((entry (assoc-string style TeX-style-hook-list)))
(and dialect-expr (setq hook (vector 'TeX-style-hook hook
- (TeX-shdex-eval dialect-expr))))
+ (TeX-shdex-eval dialect-expr))))
(cond ((null entry)
- ;; New style, add entry.
- (setq TeX-style-hook-list (cons (list style hook)
- TeX-style-hook-list)))
- ((member hook entry)
- ;; Old style, hook already there, do nothing.
- nil)
- (t
- ;; Old style, new hook.
- (setcdr entry (cons hook (cdr entry)))))))
+ ;; New style, add entry.
+ (setq TeX-style-hook-list (cons (list style hook)
+ TeX-style-hook-list)))
+ ((member hook entry)
+ ;; Old style, hook already there, do nothing.
+ nil)
+ (t
+ ;; Old style, new hook.
+ (setcdr entry (cons hook (cdr entry)))))))
(defun TeX-keep-hooks-in-dialect (hooks dialect-list)
"Scan HOOKS for all hooks the associated dialect of which is
@@ -2896,11 +2896,11 @@ found in DIALECT-LIST and return the list thereof."
(let (ret dialect-list-1)
(dolist (hook hooks)
(setq dialect-list-1 (and (vectorp hook) (eq (aref hook 0)
'TeX-style-hook)
- (TeX-shdex-listify (aref hook 2))))
+ (TeX-shdex-listify (aref hook 2))))
(while dialect-list-1
- (when (memq (pop dialect-list-1) dialect-list)
- (push hook ret)
- (setq dialect-list-1 nil)))
+ (when (memq (pop dialect-list-1) dialect-list)
+ (push hook ret)
+ (setq dialect-list-1 nil)))
ret)))
(defun TeX-unload-style (style &optional dialect-list)
@@ -2910,15 +2910,15 @@ the STYLE is only removed for those dialects in
DIALECT-LIST.
See variable `TeX-style-hook-dialect' for supported dialects."
(let ((style-data (assoc-string style TeX-style-hook-list)))
(if style-data
- (let ((hooks (and dialect-list (TeX-keep-hooks-in-dialect (cdr
style-data) dialect-list))))
- (if hooks
- (setcdr style-data hooks)
- (setq TeX-style-hook-list (delq style-data
TeX-style-hook-list)))))))
+ (let ((hooks (and dialect-list (TeX-keep-hooks-in-dialect (cdr
style-data) dialect-list))))
+ (if hooks
+ (setcdr style-data hooks)
+ (setq TeX-style-hook-list (delq style-data
TeX-style-hook-list)))))))
(defcustom TeX-virgin-style (if (and TeX-auto-global
- (file-directory-p TeX-auto-global))
- "virtex"
- "NoVirtexSymbols")
+ (file-directory-p TeX-auto-global))
+ "virtex"
+ "NoVirtexSymbols")
"Style all documents use."
:group 'TeX-parse
:type 'string)
@@ -2930,43 +2930,43 @@ See variable `TeX-style-hook-dialect' for supported
dialects."
(defun TeX-run-style-hooks (&rest styles)
"Run the TeX style hooks STYLES."
(mapcar (lambda (style)
- ;; Avoid recursion.
- (unless (TeX-member style TeX-active-styles 'string-equal)
- (setq TeX-active-styles
- (cons style TeX-active-styles))
- (TeX-load-style style)
- (let ((default-directory default-directory))
- ;; Complex path.
- (when (string-match "\\`\\(.+[/\\]\\)\\([^/\\]*\\)\\'" style)
- ;; Set `default-directory' to directory of master
- ;; file since style files not stored in the fixed
- ;; style directories are usually located there.
- (setq default-directory (save-match-data
- (TeX-master-directory))
- style (substring style
- (match-beginning 2) (match-end 2))))
- (condition-case nil
- (mapcar (lambda (hook)
- (cond
- ((functionp hook)
- (funcall hook))
- ((and (vectorp hook)
- (eq (aref hook 0) 'TeX-style-hook))
- (and (TeX-shdex-in-p TeX-style-hook-dialect
(aref hook 2))
- (funcall (aref hook 1))))
- (t (error "Invalid style hook %S" hook))))
- ;; Reverse the list of style hooks in order to run
- ;; styles in the order global, private, local
- ;; (assuming TeX-style-path has that ordering,
- ;; too).
- (reverse (cdr-safe (assoc-string style
TeX-style-hook-list))))
- ;; This happens in case some style added a new parser, and
- ;; now the style isn't used anymore (user deleted
- ;; \usepackage{style}). Then we're left over with, e.g.,
- ;; (LaTeX-add-siunitx-units "\\parsec"), but the function is
- ;; defined in a style siunitx.el that's not loaded anymore.
- (void-function nil)))))
- styles))
+ ;; Avoid recursion.
+ (unless (TeX-member style TeX-active-styles 'string-equal)
+ (setq TeX-active-styles
+ (cons style TeX-active-styles))
+ (TeX-load-style style)
+ (let ((default-directory default-directory))
+ ;; Complex path.
+ (when (string-match "\\`\\(.+[/\\]\\)\\([^/\\]*\\)\\'" style)
+ ;; Set `default-directory' to directory of master
+ ;; file since style files not stored in the fixed
+ ;; style directories are usually located there.
+ (setq default-directory (save-match-data
+ (TeX-master-directory))
+ style (substring style
+ (match-beginning 2) (match-end 2))))
+ (condition-case nil
+ (mapcar (lambda (hook)
+ (cond
+ ((functionp hook)
+ (funcall hook))
+ ((and (vectorp hook)
+ (eq (aref hook 0) 'TeX-style-hook))
+ (and (TeX-shdex-in-p TeX-style-hook-dialect
(aref hook 2))
+ (funcall (aref hook 1))))
+ (t (error "Invalid style hook %S" hook))))
+ ;; Reverse the list of style hooks in order to run
+ ;; styles in the order global, private, local
+ ;; (assuming TeX-style-path has that ordering,
+ ;; too).
+ (reverse (cdr-safe (assoc-string style
TeX-style-hook-list))))
+ ;; This happens in case some style added a new parser, and
+ ;; now the style isn't used anymore (user deleted
+ ;; \usepackage{style}). Then we're left over with, e.g.,
+ ;; (LaTeX-add-siunitx-units "\\parsec"), but the function is
+ ;; defined in a style siunitx.el that's not loaded anymore.
+ (void-function nil)))))
+ styles))
(defcustom TeX-parse-self nil
"Parse file after loading it if no style hook is found for it."
@@ -2986,22 +2986,22 @@ See variable `TeX-style-hook-dialect' for supported
dialects."
Only do this if it has not been done before, or if optional argument
FORCE is not nil."
(unless (or (and (boundp 'TeX-auto-update)
- (eq TeX-auto-update 'BibTeX)) ; Not a real TeX buffer
- (and (not force)
- TeX-style-hook-applied-p))
+ (eq TeX-auto-update 'BibTeX)) ; Not a real TeX buffer
+ (and (not force)
+ TeX-style-hook-applied-p))
(setq TeX-style-hook-applied-p t)
(message "Applying style hooks...")
(TeX-run-style-hooks (TeX-strip-extension nil nil t))
;; Run parent style hooks if it has a single parent that isn't itself.
(if (or (not (memq TeX-master '(nil t)))
- (and (buffer-file-name)
- (string-match TeX-one-master
- (file-name-nondirectory (buffer-file-name)))))
- (TeX-run-style-hooks (TeX-master-file)))
+ (and (buffer-file-name)
+ (string-match TeX-one-master
+ (file-name-nondirectory (buffer-file-name)))))
+ (TeX-run-style-hooks (TeX-master-file)))
(if (and TeX-parse-self
- (null (cdr-safe (assoc (TeX-strip-extension nil nil t)
- TeX-style-hook-list))))
- (TeX-auto-apply))
+ (null (cdr-safe (assoc (TeX-strip-extension nil nil t)
+ TeX-style-hook-list))))
+ (TeX-auto-apply))
(run-hooks 'TeX-update-style-hook)
(message "Applying style hooks...done")))
@@ -3054,44 +3054,44 @@ Possible values are nil, t, or a list of style names.
- (STYLES ...) Only complete expert commands of STYLES."
:group 'TeX-macro
:type '(choice (const :tag "Don't complete expert commands" nil)
- (const :tag "Always complete expert commands" t)
- (repeat :tag "Complete expert commands of certain styles"
string)))
+ (const :tag "Always complete expert commands" t)
+ (repeat :tag "Complete expert commands of certain styles"
string)))
(defmacro TeX-complete-make-expert-command-functions (thing list-var prefix)
(let* ((plural (concat thing "s"))
- (upcase-plural (upcase plural)))
+ (upcase-plural (upcase plural)))
`(progn
(defvar ,(intern (format "%s-expert-%s-table" prefix thing))
- (make-hash-table :test 'equal)
- ,(format "A hash-table mapping %s names to the style name providing it.
+ (make-hash-table :test 'equal)
+ ,(format "A hash-table mapping %s names to the style name providing
it.
A %s occuring in this table is considered an expert %s and
treated specially in the completion." thing thing thing))
(defun ,(intern (format "%s-declare-expert-%s" prefix plural)) (style
&rest ,(intern plural))
- ,(format "Declare %s as expert %s of STYLE.
+ ,(format "Declare %s as expert %s of STYLE.
Expert %s are completed depending on `TeX-complete-expert-commands'."
- upcase-plural plural plural)
- (dolist (x ,(intern plural))
- (if (null style)
- (remhash x TeX-expert-macro-table)
- (puthash x style TeX-expert-macro-table))))
+ upcase-plural plural plural)
+ (dolist (x ,(intern plural))
+ (if (null style)
+ (remhash x TeX-expert-macro-table)
+ (puthash x style TeX-expert-macro-table))))
(defun ,(intern (format "%s-filtered" list-var)) ()
- ,(format "Return (%s) filtered depending on
`TeX-complete-expert-commands'."
- list-var)
- (delq nil
- (mapcar
- (lambda (entry)
- (if (eq t TeX-complete-expert-commands)
- entry
- (let* ((cmd (car entry))
- (style (gethash cmd TeX-expert-macro-table)))
- (when (or (null style)
- (member style TeX-complete-expert-commands))
- entry))))
- (,list-var)))))))
+ ,(format "Return (%s) filtered depending on
`TeX-complete-expert-commands'."
+ list-var)
+ (delq nil
+ (mapcar
+ (lambda (entry)
+ (if (eq t TeX-complete-expert-commands)
+ entry
+ (let* ((cmd (car entry))
+ (style (gethash cmd TeX-expert-macro-table)))
+ (when (or (null style)
+ (member style TeX-complete-expert-commands))
+ entry))))
+ (,list-var)))))))
(TeX-complete-make-expert-command-functions "macro" TeX-symbol-list "TeX")
(TeX-complete-make-expert-command-functions "environment"
LaTeX-environment-list "LaTeX")
@@ -3117,14 +3117,14 @@ Or alternatively:
(defun TeX--complete-find-entry ()
"Return the first applicable entry of `TeX-complete-list'."
(let ((list TeX-complete-list)
- entry)
+ entry)
(while list
(setq entry (car list)
- list (cdr list))
+ list (cdr list))
(when (if (functionp (car entry))
- (funcall (car entry))
- (TeX-looking-at-backward (car entry) 250))
- (setq list nil)))
+ (funcall (car entry))
+ (TeX-looking-at-backward (car entry) 250))
+ (setq list nil)))
entry))
(defun TeX-complete-symbol ()
@@ -3133,47 +3133,47 @@ Or alternatively:
(let ((entry (TeX--complete-find-entry)))
(when entry
(if (numberp (nth 1 entry))
- (let* ((sub (nth 1 entry))
- (close (if (and (nth 3 entry)
+ (let* ((sub (nth 1 entry))
+ (close (if (and (nth 3 entry)
(listp (nth 3 entry))
(symbolp (car (nth 3 entry))))
(eval (nth 3 entry))
(nth 3 entry)))
- (begin (match-beginning sub))
- (end (match-end sub))
- (pattern (TeX-match-buffer 0))
- (symbol (buffer-substring begin end))
- (list (funcall (nth 2 entry)))
- (completion (try-completion symbol list))
- (buf-name "*Completions*"))
- (cond ((eq completion t)
- (and close
- (not (looking-at (regexp-quote close)))
- (insert close))
- (let ((window (get-buffer-window buf-name)))
- (when window (delete-window window))))
- ((null completion)
- (error "Can't find completion for \"%s\"" pattern))
- ((not (string-equal symbol completion))
- (delete-region begin end)
- (insert completion)
- (and close
- (eq (try-completion completion list) t)
- (not (looking-at (regexp-quote close)))
- (insert close))
- (let ((window (get-buffer-window buf-name)))
- (when window (delete-window window))))
- (t
- (if (fboundp 'completion-in-region)
- (completion-in-region begin end
- (all-completions symbol list nil))
- (message "Making completion list...")
- (let ((list (all-completions symbol list nil)))
- (with-output-to-temp-buffer buf-name
- (display-completion-list list)))
- (set-window-dedicated-p (get-buffer-window buf-name) 'soft)
- (message "Making completion list...done")))))
- (funcall (nth 1 entry))))))
+ (begin (match-beginning sub))
+ (end (match-end sub))
+ (pattern (TeX-match-buffer 0))
+ (symbol (buffer-substring begin end))
+ (list (funcall (nth 2 entry)))
+ (completion (try-completion symbol list))
+ (buf-name "*Completions*"))
+ (cond ((eq completion t)
+ (and close
+ (not (looking-at (regexp-quote close)))
+ (insert close))
+ (let ((window (get-buffer-window buf-name)))
+ (when window (delete-window window))))
+ ((null completion)
+ (error "Can't find completion for \"%s\"" pattern))
+ ((not (string-equal symbol completion))
+ (delete-region begin end)
+ (insert completion)
+ (and close
+ (eq (try-completion completion list) t)
+ (not (looking-at (regexp-quote close)))
+ (insert close))
+ (let ((window (get-buffer-window buf-name)))
+ (when window (delete-window window))))
+ (t
+ (if (fboundp 'completion-in-region)
+ (completion-in-region begin end
+ (all-completions symbol list nil))
+ (message "Making completion list...")
+ (let ((list (all-completions symbol list nil)))
+ (with-output-to-temp-buffer buf-name
+ (display-completion-list list)))
+ (set-window-dedicated-p (get-buffer-window buf-name)
'soft)
+ (message "Making completion list...done")))))
+ (funcall (nth 1 entry))))))
(defun TeX--completion-at-point ()
"(La)TeX completion at point function.
@@ -3181,17 +3181,17 @@ See `completion-at-point-functions'."
(let ((entry (TeX--complete-find-entry)))
(when entry
(if (numberp (nth 1 entry))
- (let* ((sub (nth 1 entry))
- (begin (match-beginning sub))
- (end (match-end sub))
- (symbol (buffer-substring-no-properties begin end))
- (list (funcall (nth 2 entry))))
- (list begin end (all-completions symbol list)))
- ;; We intentionally don't call the fallback completion functions because
- ;; they do completion on their own and don't work too well with things
- ;; like company-mode. And the default function `ispell-complete-word'
- ;; isn't so useful anyway.
- nil))))
+ (let* ((sub (nth 1 entry))
+ (begin (match-beginning sub))
+ (end (match-end sub))
+ (symbol (buffer-substring-no-properties begin end))
+ (list (funcall (nth 2 entry))))
+ (list begin end (all-completions symbol list)))
+ ;; We intentionally don't call the fallback completion functions
because
+ ;; they do completion on their own and don't work too well with things
+ ;; like company-mode. And the default function `ispell-complete-word'
+ ;; isn't so useful anyway.
+ nil))))
(defcustom TeX-default-macro "ref"
"The default macro when creating new ones with `TeX-insert-macro'."
@@ -3219,7 +3219,7 @@ will use its value to decide what to do, whatever the
value of
the variable `TeX-insert-braces'."
:group 'TeX-macro
:type '(repeat (cons (string :tag "Macro name")
- (boolean :tag "Append braces?"))))
+ (boolean :tag "Append braces?"))))
(make-variable-buffer-local 'TeX-insert-braces-alist)
(defcustom TeX-insert-macro-default-style 'show-optional-args
@@ -3239,8 +3239,8 @@ Note that for some macros, there are special mechanisms,
see e.g.
`LaTeX-includegraphics-options-alist' and `TeX-arg-cite-note-p'."
:group 'TeX-macro
:type '(choice (const mandatory-args-only)
- (const show-optional-args)
- (const show-all-optional-args)))
+ (const show-optional-args)
+ (const show-all-optional-args)))
(defvar TeX-arg-opening-brace nil
"String used as an opening brace for argument insertion.
@@ -3267,11 +3267,11 @@ is called with \\[universal-argument]."
;; flexible solution in the future, therefore we don't document it at the
;; moment.
(interactive (list (completing-read (concat "Macro (default "
- TeX-default-macro
- "): "
- TeX-esc)
- (TeX-symbol-list-filtered) nil nil nil
- 'TeX-macro-history TeX-default-macro)))
+ TeX-default-macro
+ "): "
+ TeX-esc)
+ (TeX-symbol-list-filtered) nil nil nil
+ 'TeX-macro-history TeX-default-macro)))
(when (called-interactively-p 'any)
(setq TeX-default-macro symbol))
(TeX-parse-macro symbol (cdr-safe (assoc symbol (TeX-symbol-list))))
@@ -3290,14 +3290,14 @@ AUCTeX knows of some macros, and may query for extra
arguments.
Space will complete and exit."
(interactive)
(cond ((eq (preceding-char) ?\\)
- (call-interactively 'self-insert-command))
- ((eq (preceding-char) ?.)
- (let ((TeX-default-macro " ")
- (minibuffer-local-completion-map TeX-electric-macro-map))
- (call-interactively 'TeX-insert-macro)))
- (t
- (let ((minibuffer-local-completion-map TeX-electric-macro-map))
- (call-interactively 'TeX-insert-macro)))))
+ (call-interactively 'self-insert-command))
+ ((eq (preceding-char) ?.)
+ (let ((TeX-default-macro " ")
+ (minibuffer-local-completion-map TeX-electric-macro-map))
+ (call-interactively 'TeX-insert-macro)))
+ (t
+ (let ((minibuffer-local-completion-map TeX-electric-macro-map))
+ (call-interactively 'TeX-insert-macro)))))
(defvar TeX-exit-mark nil
"Dynamically bound by `TeX-parse-macro' and `LaTeX-env-args'.")
@@ -3339,50 +3339,50 @@ TeX macro. What is done depend on the type of the
element:
Use square brackets instead of curly braces, and is not inserted
on empty user input."
(let ((TeX-grop (if (and (or (atom args) (= (length args) 1))
- (fboundp 'LaTeX-verbatim-macros-with-delims)
- (member symbol (LaTeX-verbatim-macros-with-delims)))
- LaTeX-default-verb-delimiter
- TeX-grop))
- (TeX-grcl (if (and (or (atom args) (= (length args) 1))
- (fboundp 'LaTeX-verbatim-macros-with-delims)
- (member symbol (LaTeX-verbatim-macros-with-delims)))
- LaTeX-default-verb-delimiter
- TeX-grcl)))
+ (fboundp 'LaTeX-verbatim-macros-with-delims)
+ (member symbol (LaTeX-verbatim-macros-with-delims)))
+ LaTeX-default-verb-delimiter
+ TeX-grop))
+ (TeX-grcl (if (and (or (atom args) (= (length args) 1))
+ (fboundp 'LaTeX-verbatim-macros-with-delims)
+ (member symbol (LaTeX-verbatim-macros-with-delims)))
+ LaTeX-default-verb-delimiter
+ TeX-grcl)))
(if (and (TeX-active-mark)
- (> (point) (mark)))
- (exchange-point-and-mark))
+ (> (point) (mark)))
+ (exchange-point-and-mark))
(insert TeX-esc symbol)
(let ((TeX-exit-mark (make-marker))
- (position (point)))
+ (position (point)))
(TeX-parse-arguments args)
(cond ((marker-position TeX-exit-mark)
- (goto-char (marker-position TeX-exit-mark))
- (set-marker TeX-exit-mark nil))
- ((let ((element (assoc symbol TeX-insert-braces-alist)))
- ;; If in `TeX-insert-braces-alist' there is an element associated
- ;; to the current macro, use its value to decide whether
inserting
- ;; a pair of braces, otherwise use the standard criterion.
- (if element
- (cdr element)
- (and TeX-insert-braces
- ;; Do not add braces if the argument is 0 or -1.
- (not (and (= (safe-length args) 1)
- (numberp (car args))
- (<= (car args) 0)))
- (equal position (point))
- (string-match "[a-zA-Z]+" symbol))))
- (if (texmathp)
- (when (TeX-active-mark)
- (insert TeX-grop)
- (exchange-point-and-mark)
- (insert TeX-grcl))
- (insert TeX-grop)
- (if (TeX-active-mark)
- (progn
- (exchange-point-and-mark)
- (insert TeX-grcl))
- (insert TeX-grcl)
- (backward-char))))))))
+ (goto-char (marker-position TeX-exit-mark))
+ (set-marker TeX-exit-mark nil))
+ ((let ((element (assoc symbol TeX-insert-braces-alist)))
+ ;; If in `TeX-insert-braces-alist' there is an element
associated
+ ;; to the current macro, use its value to decide whether
inserting
+ ;; a pair of braces, otherwise use the standard criterion.
+ (if element
+ (cdr element)
+ (and TeX-insert-braces
+ ;; Do not add braces if the argument is 0 or -1.
+ (not (and (= (safe-length args) 1)
+ (numberp (car args))
+ (<= (car args) 0)))
+ (equal position (point))
+ (string-match "[a-zA-Z]+" symbol))))
+ (if (texmathp)
+ (when (TeX-active-mark)
+ (insert TeX-grop)
+ (exchange-point-and-mark)
+ (insert TeX-grcl))
+ (insert TeX-grop)
+ (if (TeX-active-mark)
+ (progn
+ (exchange-point-and-mark)
+ (insert TeX-grcl))
+ (insert TeX-grcl)
+ (backward-char))))))))
(defun TeX-arg-string (optional &optional prompt initial-input)
"Prompt for a string.
@@ -3392,8 +3392,8 @@ INITIAL-INPUT is a string to insert before reading input."
(TeX-argument-insert
(if (and (not optional) (TeX-active-mark))
(let ((TeX-argument (buffer-substring (point) (mark))))
- (delete-region (point) (mark))
- TeX-argument)
+ (delete-region (point) (mark))
+ TeX-argument)
(TeX-read-string (TeX-argument-prompt optional prompt "Text")
initial-input))
optional))
@@ -3407,28 +3407,28 @@ See `TeX-parse-macro' for details."
(let ((TeX-last-optional-rejected nil))
(while args
(if (vectorp (car args))
- ;; Maybe get rid of all optional arguments. See `TeX-insert-macro'
- ;; for more comments. See `TeX-insert-macro-default-style'.
- ;; The macro `LaTeX-check-insert-macro-default-style' in
- ;; `latex.el' uses the code inside (unless ...) This macro
- ;; should be adapted if the code here changs.
- (unless (if (eq TeX-insert-macro-default-style
'show-all-optional-args)
- (equal current-prefix-arg '(4))
- (or
- (and (eq TeX-insert-macro-default-style
'show-optional-args)
- (equal current-prefix-arg '(4)))
- (and (eq TeX-insert-macro-default-style
'mandatory-args-only)
- (null (equal current-prefix-arg '(4))))
- TeX-last-optional-rejected))
- (let ((TeX-arg-opening-brace LaTeX-optop)
- (TeX-arg-closing-brace LaTeX-optcl))
- (TeX-parse-argument t (if (equal (length (car args)) 1)
- (aref (car args) 0)
- (append (car args) nil)))))
- (let ((TeX-arg-opening-brace TeX-grop)
- (TeX-arg-closing-brace TeX-grcl))
- (setq TeX-last-optional-rejected nil)
- (TeX-parse-argument nil (car args))))
+ ;; Maybe get rid of all optional arguments. See `TeX-insert-macro'
+ ;; for more comments. See `TeX-insert-macro-default-style'.
+ ;; The macro `LaTeX-check-insert-macro-default-style' in
+ ;; `latex.el' uses the code inside (unless ...) This macro
+ ;; should be adapted if the code here changs.
+ (unless (if (eq TeX-insert-macro-default-style
'show-all-optional-args)
+ (equal current-prefix-arg '(4))
+ (or
+ (and (eq TeX-insert-macro-default-style
'show-optional-args)
+ (equal current-prefix-arg '(4)))
+ (and (eq TeX-insert-macro-default-style
'mandatory-args-only)
+ (null (equal current-prefix-arg '(4))))
+ TeX-last-optional-rejected))
+ (let ((TeX-arg-opening-brace LaTeX-optop)
+ (TeX-arg-closing-brace LaTeX-optcl))
+ (TeX-parse-argument t (if (equal (length (car args)) 1)
+ (aref (car args) 0)
+ (append (car args) nil)))))
+ (let ((TeX-arg-opening-brace TeX-grop)
+ (TeX-arg-closing-brace TeX-grcl))
+ (setq TeX-last-optional-rejected nil)
+ (TeX-parse-argument nil (car args))))
(setq args (cdr args)))))
(defun TeX-parse-argument (optional arg)
@@ -3439,54 +3439,54 @@ then use square brackets instead of curly braces.
See `TeX-parse-macro' for details."
(let (insert-flag)
(cond ((stringp arg)
- (TeX-arg-string optional arg)
- (setq insert-flag t))
- ((numberp arg)
- (cond ((< arg 0)
- (when (TeX-active-mark)
- ;; Put both the macro and the marked region in a TeX group.
- (let ((beg (min (point) (mark)))
- (end (set-marker (make-marker) (max (point) (mark)))))
- (insert " ")
- (goto-char beg)
- (skip-chars-backward "^\\\\")
- (backward-char)
- (insert TeX-arg-opening-brace)
- (goto-char (marker-position end))
- (insert TeX-arg-closing-brace)
- (setq insert-flag t))))
- ((= arg 0)) ; nop for clarity
- ((> arg 0)
- (TeX-parse-argument optional t)
- (while (> arg 1)
- (TeX-parse-argument optional nil)
- (setq arg (- arg 1))))))
- ((null arg)
- (insert TeX-arg-opening-brace)
- (when (and (not optional) (TeX-active-mark))
- (exchange-point-and-mark))
- (insert TeX-arg-closing-brace)
- (setq insert-flag t))
- ((eq arg t)
- (insert TeX-arg-opening-brace)
- (if (and (not optional) (TeX-active-mark))
- (progn
- (exchange-point-and-mark))
- (set-marker TeX-exit-mark (point)))
- (insert TeX-arg-closing-brace)
- (setq insert-flag t))
- ((symbolp arg)
- (funcall arg optional))
- ((listp arg)
- (let ((head (car arg))
- (tail (cdr arg)))
- (cond ((stringp head)
- (apply 'TeX-arg-string optional arg))
- ((symbolp head)
- (apply head optional tail))
- (t (error "Unknown list argument type %s"
- (prin1-to-string head))))))
- (t (error "Unknown argument type %s" (prin1-to-string arg))))
+ (TeX-arg-string optional arg)
+ (setq insert-flag t))
+ ((numberp arg)
+ (cond ((< arg 0)
+ (when (TeX-active-mark)
+ ;; Put both the macro and the marked region in a TeX group.
+ (let ((beg (min (point) (mark)))
+ (end (set-marker (make-marker) (max (point)
(mark)))))
+ (insert " ")
+ (goto-char beg)
+ (skip-chars-backward "^\\\\")
+ (backward-char)
+ (insert TeX-arg-opening-brace)
+ (goto-char (marker-position end))
+ (insert TeX-arg-closing-brace)
+ (setq insert-flag t))))
+ ((= arg 0)) ; nop for clarity
+ ((> arg 0)
+ (TeX-parse-argument optional t)
+ (while (> arg 1)
+ (TeX-parse-argument optional nil)
+ (setq arg (- arg 1))))))
+ ((null arg)
+ (insert TeX-arg-opening-brace)
+ (when (and (not optional) (TeX-active-mark))
+ (exchange-point-and-mark))
+ (insert TeX-arg-closing-brace)
+ (setq insert-flag t))
+ ((eq arg t)
+ (insert TeX-arg-opening-brace)
+ (if (and (not optional) (TeX-active-mark))
+ (progn
+ (exchange-point-and-mark))
+ (set-marker TeX-exit-mark (point)))
+ (insert TeX-arg-closing-brace)
+ (setq insert-flag t))
+ ((symbolp arg)
+ (funcall arg optional))
+ ((listp arg)
+ (let ((head (car arg))
+ (tail (cdr arg)))
+ (cond ((stringp head)
+ (apply 'TeX-arg-string optional arg))
+ ((symbolp head)
+ (apply head optional tail))
+ (t (error "Unknown list argument type %s"
+ (prin1-to-string head))))))
+ (t (error "Unknown argument type %s" (prin1-to-string arg))))
(when (and insert-flag (not optional) (TeX-active-mark))
(deactivate-mark))))
@@ -3499,10 +3499,10 @@ If PREFIX is given, insert it before NAME."
(setq TeX-last-optional-rejected t)
(insert TeX-arg-opening-brace)
(if prefix
- (insert prefix))
+ (insert prefix))
(if (and (string-equal name "")
- (null (marker-position TeX-exit-mark)))
- (set-marker TeX-exit-mark (point))
+ (null (marker-position TeX-exit-mark)))
+ (set-marker TeX-exit-mark (point))
(insert name))
(insert TeX-arg-closing-brace)))
@@ -3515,25 +3515,25 @@ PROMPT will be used if not nil, otherwise use DEFAULT.
Unless optional argument COMPLETE is non-nil, ``: '' will be appended."
(concat (if optional "(Optional) " "")
- (if prompt prompt default)
- (if complete "" ": ")))
+ (if prompt prompt default)
+ (if complete "" ": ")))
(defun TeX-string-divide-number-unit (string)
"Divide number and unit in STRING and return a list (number unit)."
(if (string-match "[0-9]*\\.?[0-9]+" string)
(list (substring string 0 (string-match "[^.0-9]" string))
- (substring string (if (string-match "[^.0-9]" string)
- (string-match "[^.0-9]" string)
- (length string))))
+ (substring string (if (string-match "[^.0-9]" string)
+ (string-match "[^.0-9]" string)
+ (length string))))
(list "" string)))
(defcustom TeX-default-unit-for-image "cm"
"Default unit when prompting for an image size."
:group 'TeX-macro
:type '(choice (const "cm")
- (const "in")
- (const "\\linewidth")
- (string :tag "Other")))
+ (const "in")
+ (const "\\linewidth")
+ (string :tag "Other")))
(defun TeX-arg-maybe (symbol list form)
"Evaluates FORM, if SYMBOL is an element of LIST."
@@ -3543,9 +3543,9 @@ Unless optional argument COMPLETE is non-nil, ``: '' will
be appended."
(defun TeX-arg-free (optional &rest args)
"Parse its arguments but use no braces when they are inserted."
(let ((TeX-arg-opening-brace "")
- (TeX-arg-closing-brace ""))
+ (TeX-arg-closing-brace ""))
(if (equal (length args) 1)
- (TeX-parse-argument optional (car args))
+ (TeX-parse-argument optional (car args))
(TeX-parse-argument optional args))))
(defun TeX-arg-literal (_optional &rest args)
@@ -3562,9 +3562,9 @@ argument OPTIONAL is ignored."
Choose `ignore' if you don't want AUCTeX to install support for font locking."
:group 'TeX-misc
:type '(radio (function-item font-latex-setup)
- (function-item tex-font-setup)
- (function-item ignore)
- (function :tag "Other")))
+ (function-item tex-font-setup)
+ (function-item ignore)
+ (function :tag "Other")))
;;; The Mode
@@ -3603,8 +3603,8 @@ the major mode to be used.")
"Mode to enter for a new file when it can't be determined otherwise."
:group 'TeX-misc
:type '(radio (function-item latex-mode)
- (function-item plain-tex-mode)
- (function :tag "Other")))
+ (function-item plain-tex-mode)
+ (function :tag "Other")))
(defcustom TeX-force-default-mode nil
"If set to nil, try to infer the mode of the file from its content."
@@ -3626,36 +3626,36 @@ The algorithm is as follows:
(interactive)
(funcall (if (or (equal (buffer-size) 0)
- TeX-force-default-mode)
- TeX-default-mode
- (save-excursion
- (goto-char (point-min))
- (let ((comment-start-skip ;Used by TeX-in-comment
- (concat
- "\\(\\(^\\|[^\\\n]\\)\\("
- (regexp-quote TeX-esc)
- (regexp-quote TeX-esc)
- "\\)*\\)\\(%+ *\\)"))
- (entry TeX-format-list)
- answer case-fold-search)
- (while (and entry (not answer))
- (if (re-search-forward (nth 2 (car entry))
- 10000 t)
- (if (not (TeX-in-comment))
- (setq answer (nth 1 (car entry))))
- (setq entry (cdr entry))))
- (if answer
- answer
- TeX-default-mode))))))
+ TeX-force-default-mode)
+ TeX-default-mode
+ (save-excursion
+ (goto-char (point-min))
+ (let ((comment-start-skip ;Used by TeX-in-comment
+ (concat
+ "\\(\\(^\\|[^\\\n]\\)\\("
+ (regexp-quote TeX-esc)
+ (regexp-quote TeX-esc)
+ "\\)*\\)\\(%+ *\\)"))
+ (entry TeX-format-list)
+ answer case-fold-search)
+ (while (and entry (not answer))
+ (if (re-search-forward (nth 2 (car entry))
+ 10000 t)
+ (if (not (TeX-in-comment))
+ (setq answer (nth 1 (car entry))))
+ (setq entry (cdr entry))))
+ (if answer
+ answer
+ TeX-default-mode))))))
(when (and (boundp 'tex--prettify-symbols-alist)
- (boundp 'prettify-symbols-compose-predicate))
+ (boundp 'prettify-symbols-compose-predicate))
(defun TeX--prettify-symbols-compose-p (start end match)
(and (tex--prettify-symbols-compose-p start end match)
- (not (let ((face (get-text-property end 'face)))
- (if (consp face)
- (memq 'font-latex-verbatim-face face)
- (eq face 'font-latex-verbatim-face)))))))
+ (not (let ((face (get-text-property end 'face)))
+ (if (consp face)
+ (memq 'font-latex-verbatim-face face)
+ (eq face 'font-latex-verbatim-face)))))))
(defun VirTeX-common-initialization ()
"Perform basic initialization."
@@ -3674,10 +3674,10 @@ The algorithm is as follows:
(set (make-local-variable 'comment-start) "%")
(set (make-local-variable 'comment-start-skip)
(concat
- "\\(\\(^\\|[^\\\n]\\)\\("
- (regexp-quote TeX-esc)
- (regexp-quote TeX-esc)
- "\\)*\\)\\(%+[ \t]*\\)"))
+ "\\(\\(^\\|[^\\\n]\\)\\("
+ (regexp-quote TeX-esc)
+ (regexp-quote TeX-esc)
+ "\\)*\\)\\(%+[ \t]*\\)"))
(set (make-local-variable 'comment-end-skip) "[ \t]*\\(\\s>\\|\n\\)")
(set (make-local-variable 'comment-use-syntax) t)
;; `comment-padding' is defined here as an integer for compatibility
@@ -3696,16 +3696,16 @@ The algorithm is as follows:
;; Make TAB stand out
;; (make-local-variable 'buffer-display-table)
;; (setq buffer-display-table (if standard-display-table
- ;; (copy-sequence standard-display-table)
- ;; (make-display-table)))
+ ;; (copy-sequence standard-display-table)
+ ;; (make-display-table)))
;; (aset buffer-display-table ?\t (apply 'vector (append "<TAB>" nil)))
;; Symbol completion.
(set (make-local-variable 'TeX-complete-list)
(list (list "\\\\\\([a-zA-Z]*\\)"
- 1 'TeX-symbol-list-filtered
- (if TeX-insert-braces "{}"))
- (list "" TeX-complete-word)))
+ 1 'TeX-symbol-list-filtered
+ (if TeX-insert-braces "{}"))
+ (list "" TeX-complete-word)))
(funcall TeX-install-font-lock)
@@ -3724,15 +3724,15 @@ The algorithm is as follows:
(when (fboundp 'TeX--prettify-symbols-compose-p)
(set (make-local-variable 'prettify-symbols-alist)
tex--prettify-symbols-alist)
(TeX--if-macro-fboundp add-function
- (add-function :override (local 'prettify-symbols-compose-predicate)
- #'TeX--prettify-symbols-compose-p)
+ (add-function :override (local 'prettify-symbols-compose-predicate)
+ #'TeX--prettify-symbols-compose-p)
(set (make-local-variable 'prettify-symbols-compose-predicate)
- #'TeX--prettify-symbols-compose-p)))
+ #'TeX--prettify-symbols-compose-p)))
;; Standard Emacs completion-at-point support
(when (boundp 'completion-at-point-functions)
(add-hook 'completion-at-point-functions
- #'TeX--completion-at-point nil t))
+ #'TeX--completion-at-point nil t))
;; Let `TeX-master-file' be called after a new file was opened and
;; call `TeX-update-style' on any file opened. (The addition to the
@@ -3749,24 +3749,24 @@ The algorithm is as follows:
;; `TeX-update-style' as the latter will call `TeX-master-file'
;; without the `ask' bit set.
(add-hook 'find-file-hook
- (lambda ()
- ;; Check if we are looking at a new or shared file.
- (when (or (not (file-exists-p (buffer-file-name)))
- (eq TeX-master 'shared))
- (TeX-master-file nil nil t))
- (TeX-update-style t)) nil t))
+ (lambda ()
+ ;; Check if we are looking at a new or shared file.
+ (when (or (not (file-exists-p (buffer-file-name)))
+ (eq TeX-master 'shared))
+ (TeX-master-file nil nil t))
+ (TeX-update-style t)) nil t))
;;; Hilighting
(if (boundp 'hilit-patterns-alist)
(let ((latex-patterns (cdr-safe (assq 'latex-mode hilit-patterns-alist)))
- (plain-tex-patterns (cdr-safe (assq 'plain-tex-mode
- hilit-patterns-alist))))
+ (plain-tex-patterns (cdr-safe (assq 'plain-tex-mode
+ hilit-patterns-alist))))
(if (and latex-patterns plain-tex-patterns)
- (setq hilit-patterns-alist
- (append (list (cons 'ams-tex-mode plain-tex-patterns))
- hilit-patterns-alist)))))
+ (setq hilit-patterns-alist
+ (append (list (cons 'ams-tex-mode plain-tex-patterns))
+ hilit-patterns-alist)))))
;;; Parsing
@@ -3793,12 +3793,12 @@ The algorithm is as follows:
(defun TeX-auto-add-information (name entries)
"For NAME in `TeX-auto-parser' add ENTRIES."
(let* ((entry (assoc name TeX-auto-parser))
- (change (nth TeX-auto-parser-change entry))
- (change-value (symbol-value change))
- (local (nth TeX-auto-parser-local entry))
- (local-value (symbol-value local)))
+ (change (nth TeX-auto-parser-change entry))
+ (change-value (symbol-value change))
+ (local (nth TeX-auto-parser-local entry))
+ (local-value (symbol-value local)))
(if change-value
- (set local (cons entries local-value))
+ (set local (cons entries local-value))
(set change t)
(set local (list entries local-value)))))
@@ -3806,31 +3806,31 @@ The algorithm is as follows:
"Return information in `TeX-auto-parser' about NAME."
(TeX-update-style)
(let* ((entry (assoc name TeX-auto-parser))
- (change (nth TeX-auto-parser-change entry))
- (change-value (symbol-value change))
- (local (nth TeX-auto-parser-local entry)))
+ (change (nth TeX-auto-parser-change entry))
+ (change-value (symbol-value change))
+ (local (nth TeX-auto-parser-local entry)))
(if (not change-value)
- ()
+ ()
(set change nil)
;; Sort it
(message "Sorting %s..." name)
(set local
- (sort (mapcar 'TeX-listify (apply 'append (symbol-value local)))
- 'TeX-car-string-lessp))
+ (sort (mapcar 'TeX-listify (apply 'append (symbol-value local)))
+ 'TeX-car-string-lessp))
(message "Sorting %s...done" name)
;; Make it unique
(message "Removing duplicates...")
(let ((entry (symbol-value local)))
- (while (and entry (cdr entry))
- (let ((this (car entry))
- (next (car (cdr entry))))
- (if (not (string-equal (car this) (car next)))
- (setq entry (cdr entry))
- ;; We have two equal symbols. Use the one with
- ;; most arguments.
- (if (> (length next) (length this))
- (setcdr this (cdr next)))
- (setcdr entry (cdr (cdr entry)))))))
+ (while (and entry (cdr entry))
+ (let ((this (car entry))
+ (next (car (cdr entry))))
+ (if (not (string-equal (car this) (car next)))
+ (setq entry (cdr entry))
+ ;; We have two equal symbols. Use the one with
+ ;; most arguments.
+ (if (> (length next) (length this))
+ (setcdr this (cdr next)))
+ (setcdr entry (cdr (cdr entry)))))))
(message "Removing duplicates...done"))
(symbol-value local)))
@@ -3843,12 +3843,12 @@ By default just add an `s'.
This macro creates a set of variables and functions to maintain a
separate type of information in the parser."
(let* ((names (or plural (concat name "s")))
- (tmp (intern (concat prefix "-auto-" name)))
- (add (intern (concat prefix "-add-" names)))
- (local (intern (concat prefix "-" name "-list")))
- (change (intern (concat prefix "-" name "-changed")))
- (vardoc (concat "Information about " names
- " in the current buffer.
+ (tmp (intern (concat prefix "-auto-" name)))
+ (add (intern (concat prefix "-add-" names)))
+ (local (intern (concat prefix "-" name "-list")))
+ (change (intern (concat prefix "-" name "-changed")))
+ (vardoc (concat "Information about " names
+ " in the current buffer.
Generated by `TeX-auto-add-type'.")))
`(progn
(defvar ,tmp nil ,vardoc)
@@ -3857,21 +3857,21 @@ Generated by `TeX-auto-add-type'.")))
(defvar ,change nil ,vardoc)
(make-variable-buffer-local ',change)
(defun ,add (&rest ,(intern names))
- ,(concat "Add information about " (upcase names)
- " to the current buffer.
+ ,(concat "Add information about " (upcase names)
+ " to the current buffer.
Generated by `TeX-auto-add-type'.")
- (TeX-auto-add-information ,name ,(intern names)))
+ (TeX-auto-add-information ,name ,(intern names)))
(defun ,local ()
- ,(concat "List of " names
- " active in the current buffer.
+ ,(concat "List of " names
+ " active in the current buffer.
Generated by `TeX-auto-add-type'.")
- (TeX-auto-list-information ,name))
+ (TeX-auto-list-information ,name))
;; Append new type to `TeX-auto-parser' in order to make `style' type
;; always the first.
(add-to-list 'TeX-auto-parser ',(list name tmp add local change) t)
(add-hook 'TeX-remove-style-hook
- (lambda ()
- (setq ,local nil))))))
+ (lambda ()
+ (setq ,local nil))))))
(TeX-auto-add-type "symbol" "TeX")
@@ -3887,15 +3887,15 @@ Generated by `TeX-auto-add-type'.")
(defun TeX-auto-apply-entry (entry)
"Apply the information in ENTRY in `TeX-auto-parser'."
(let ((value (symbol-value (nth TeX-auto-parser-temporary entry)))
- (add (nth TeX-auto-parser-add entry)))
+ (add (nth TeX-auto-parser-add entry)))
(if value (apply add value))))
(defun TeX-safe-auto-write ()
"Call `TeX-auto-write' safely."
(condition-case _ignored
(and (boundp 'TeX-auto-update)
- TeX-auto-update
- (TeX-auto-write))
+ TeX-auto-update
+ (TeX-auto-write))
(error nil))
;; Continue with the other write file hooks.
nil)
@@ -3916,22 +3916,22 @@ Generated by `TeX-auto-add-type'.")
(untabify (point-min) (point-max)))
(if (and TeX-auto-save TeX-auto-local)
(let* ((file (expand-file-name
- (concat
- (file-name-as-directory TeX-auto-local)
- (TeX-strip-extension nil TeX-all-extensions t)
- ".el")
- (TeX-master-directory)))
- (dir (file-name-directory file)))
- ;; Create auto directory if possible.
- (if (not (file-exists-p dir))
- (condition-case _ignored
- (make-directory dir)
- (error nil)))
- (if (file-writable-p file)
- (save-excursion
- (TeX-update-style)
- (TeX-auto-store file))
- (message "Can't write style information.")))))
+ (concat
+ (file-name-as-directory TeX-auto-local)
+ (TeX-strip-extension nil TeX-all-extensions t)
+ ".el")
+ (TeX-master-directory)))
+ (dir (file-name-directory file)))
+ ;; Create auto directory if possible.
+ (if (not (file-exists-p dir))
+ (condition-case _ignored
+ (make-directory dir)
+ (error nil)))
+ (if (file-writable-p file)
+ (save-excursion
+ (TeX-update-style)
+ (TeX-auto-store file))
+ (message "Can't write style information.")))))
(defcustom TeX-macro-default (car-safe TeX-macro-private)
"Default directory to search for TeX macros."
@@ -3958,8 +3958,8 @@ nil means do not recurse, a positive integer means go
that far deep in the
directory hierarchy, t means recurse indefinitely."
:group 'TeX-parse
:type '(choice (const :tag "On" t)
- (const :tag "Off" nil)
- (integer :tag "Depth" :value 1)))
+ (const :tag "Off" nil)
+ (integer :tag "Depth" :value 1)))
(defvar TeX-file-extensions)
(defvar BibTeX-file-extensions)
@@ -3970,50 +3970,50 @@ directory hierarchy, t means recurse indefinitely."
"Generate style file for TEX and store it in AUTO.
If TEX is a directory, generate style files for all files in the directory."
(interactive (list (setq TeX-macro-default
- (expand-file-name (read-file-name
- "TeX file or directory: "
- TeX-macro-default
- TeX-macro-default 'confirm)))
- (setq TeX-auto-default
- (expand-file-name (read-file-name
- "AUTO lisp directory: "
- TeX-auto-default
- TeX-auto-default 'confirm)))))
+ (expand-file-name (read-file-name
+ "TeX file or directory: "
+ TeX-macro-default
+ TeX-macro-default 'confirm)))
+ (setq TeX-auto-default
+ (expand-file-name (read-file-name
+ "AUTO lisp directory: "
+ TeX-auto-default
+ TeX-auto-default 'confirm)))))
(cond ((not (file-readable-p tex)))
- ((string-match TeX-ignore-file tex))
- ((file-directory-p tex)
- (let ((files (directory-files (expand-file-name tex)))
- (default-directory (file-name-as-directory
- (expand-file-name tex)))
- (TeX-file-recurse (cond ((symbolp TeX-file-recurse)
- TeX-file-recurse)
- ((zerop TeX-file-recurse)
- nil)
- ((1- TeX-file-recurse)))))
- (mapcar (lambda (file)
- (if (or TeX-file-recurse
- (not (file-directory-p file)))
- (TeX-auto-generate file auto)))
- files)))
- ((not (file-newer-than-file-p
- tex
- (concat (file-name-as-directory auto)
- (TeX-strip-extension tex TeX-all-extensions t)
- ".el"))))
- ((TeX-match-extension tex (TeX-delete-duplicate-strings
- (append TeX-file-extensions
- BibTeX-file-extensions
- TeX-Biber-file-extensions)))
- (with-current-buffer (let (enable-local-eval)
- (find-file-noselect tex))
- (message "Parsing %s..." tex)
- (TeX-auto-store (concat (file-name-as-directory auto)
- (TeX-strip-extension tex
- TeX-all-extensions
- t)
- ".el"))
- (kill-buffer (current-buffer))
- (message "Parsing %s...done" tex)))))
+ ((string-match TeX-ignore-file tex))
+ ((file-directory-p tex)
+ (let ((files (directory-files (expand-file-name tex)))
+ (default-directory (file-name-as-directory
+ (expand-file-name tex)))
+ (TeX-file-recurse (cond ((symbolp TeX-file-recurse)
+ TeX-file-recurse)
+ ((zerop TeX-file-recurse)
+ nil)
+ ((1- TeX-file-recurse)))))
+ (mapcar (lambda (file)
+ (if (or TeX-file-recurse
+ (not (file-directory-p file)))
+ (TeX-auto-generate file auto)))
+ files)))
+ ((not (file-newer-than-file-p
+ tex
+ (concat (file-name-as-directory auto)
+ (TeX-strip-extension tex TeX-all-extensions t)
+ ".el"))))
+ ((TeX-match-extension tex (TeX-delete-duplicate-strings
+ (append TeX-file-extensions
+ BibTeX-file-extensions
+ TeX-Biber-file-extensions)))
+ (with-current-buffer (let (enable-local-eval)
+ (find-file-noselect tex))
+ (message "Parsing %s..." tex)
+ (TeX-auto-store (concat (file-name-as-directory auto)
+ (TeX-strip-extension tex
+ TeX-all-extensions
+ t)
+ ".el"))
+ (kill-buffer (current-buffer))
+ (message "Parsing %s...done" tex)))))
;;;###autoload
(defun TeX-auto-generate-global ()
@@ -4022,10 +4022,10 @@ If TEX is a directory, generate style files for all
files in the directory."
(unless (file-directory-p TeX-auto-global)
(make-directory TeX-auto-global))
(let ((TeX-file-extensions '("cls" "sty"))
- (BibTeX-file-extensions nil)
- (TeX-Biber-file-extensions nil))
+ (BibTeX-file-extensions nil)
+ (TeX-Biber-file-extensions nil))
(mapc (lambda (macro) (TeX-auto-generate macro TeX-auto-global))
- TeX-macro-global))
+ TeX-macro-global))
(byte-recompile-directory TeX-auto-global 0))
(defun TeX-auto-store (file)
@@ -4034,55 +4034,55 @@ If TEX is a directory, generate style files for all
files in the directory."
(if (member nil (mapcar 'TeX-auto-entry-clear-p TeX-auto-parser))
(let ((style (TeX-strip-extension nil TeX-all-extensions t))
- (class-opts (if (boundp 'LaTeX-provided-class-options)
- LaTeX-provided-class-options))
- (pkg-opts (if (boundp 'LaTeX-provided-package-options)
- LaTeX-provided-package-options))
- (tex-cmd-opts TeX-command-extra-options)
- (verb-envs (when (boundp 'LaTeX-verbatim-environments-local)
- LaTeX-verbatim-environments-local))
- (verb-macros-delims (when (boundp
'LaTeX-verbatim-macros-with-delims-local)
- LaTeX-verbatim-macros-with-delims-local))
- (verb-macros-braces (when (boundp
'LaTeX-verbatim-macros-with-braces-local)
- LaTeX-verbatim-macros-with-braces-local))
- (dialect TeX-style-hook-dialect))
- (TeX-unload-style style)
- (with-current-buffer (generate-new-buffer file)
- (erase-buffer)
- (insert "(TeX-add-style-hook\n \""
- style "\"\n (lambda ()")
- (unless (string= tex-cmd-opts "")
- (insert "\n (setq TeX-command-extra-options\n"
- " " (prin1-to-string tex-cmd-opts) ")"))
- (when class-opts
- (insert "\n (TeX-add-to-alist 'LaTeX-provided-class-options\n"
- " '" (prin1-to-string class-opts) ")"))
- (when pkg-opts
- (insert "\n (TeX-add-to-alist 'LaTeX-provided-package-options\n"
- " '" (prin1-to-string pkg-opts) ")"))
- (dolist (env verb-envs)
- (insert
- (format "\n (add-to-list 'LaTeX-verbatim-environments-local
\"%s\")"
- env)))
- (dolist (env verb-macros-braces)
- (insert
- (format "\n (add-to-list
'LaTeX-verbatim-macros-with-braces-local \"%s\")"
- env)))
- (dolist (env verb-macros-delims)
- (insert
- (format "\n (add-to-list
'LaTeX-verbatim-macros-with-delims-local \"%s\")"
- env)))
- (mapc (lambda (el) (TeX-auto-insert el style))
- TeX-auto-parser)
- (insert ")")
- (if dialect (insert (concat "\n " (prin1-to-string dialect))))
- (insert ")\n\n")
- (write-region (point-min) (point-max) file nil 'silent)
- (kill-buffer (current-buffer))))
+ (class-opts (if (boundp 'LaTeX-provided-class-options)
+ LaTeX-provided-class-options))
+ (pkg-opts (if (boundp 'LaTeX-provided-package-options)
+ LaTeX-provided-package-options))
+ (tex-cmd-opts TeX-command-extra-options)
+ (verb-envs (when (boundp 'LaTeX-verbatim-environments-local)
+ LaTeX-verbatim-environments-local))
+ (verb-macros-delims (when (boundp
'LaTeX-verbatim-macros-with-delims-local)
+ LaTeX-verbatim-macros-with-delims-local))
+ (verb-macros-braces (when (boundp
'LaTeX-verbatim-macros-with-braces-local)
+ LaTeX-verbatim-macros-with-braces-local))
+ (dialect TeX-style-hook-dialect))
+ (TeX-unload-style style)
+ (with-current-buffer (generate-new-buffer file)
+ (erase-buffer)
+ (insert "(TeX-add-style-hook\n \""
+ style "\"\n (lambda ()")
+ (unless (string= tex-cmd-opts "")
+ (insert "\n (setq TeX-command-extra-options\n"
+ " " (prin1-to-string tex-cmd-opts) ")"))
+ (when class-opts
+ (insert "\n (TeX-add-to-alist 'LaTeX-provided-class-options\n"
+ " '" (prin1-to-string class-opts) ")"))
+ (when pkg-opts
+ (insert "\n (TeX-add-to-alist 'LaTeX-provided-package-options\n"
+ " '" (prin1-to-string pkg-opts) ")"))
+ (dolist (env verb-envs)
+ (insert
+ (format "\n (add-to-list 'LaTeX-verbatim-environments-local
\"%s\")"
+ env)))
+ (dolist (env verb-macros-braces)
+ (insert
+ (format "\n (add-to-list
'LaTeX-verbatim-macros-with-braces-local \"%s\")"
+ env)))
+ (dolist (env verb-macros-delims)
+ (insert
+ (format "\n (add-to-list
'LaTeX-verbatim-macros-with-delims-local \"%s\")"
+ env)))
+ (mapc (lambda (el) (TeX-auto-insert el style))
+ TeX-auto-parser)
+ (insert ")")
+ (if dialect (insert (concat "\n " (prin1-to-string dialect))))
+ (insert ")\n\n")
+ (write-region (point-min) (point-max) file nil 'silent)
+ (kill-buffer (current-buffer))))
(if (file-exists-p (concat file "c"))
- (delete-file (concat file "c")))
+ (delete-file (concat file "c")))
(if (file-exists-p file)
- (delete-file file))))
+ (delete-file file))))
(defun TeX-auto-entry-clear-p (entry)
"Check if the temporary for `TeX-auto-parser' entry ENTRY is clear."
@@ -4094,16 +4094,16 @@ If TEX is a directory, generate style files for all
files in the directory."
If SKIP is not-nil, don't insert code for SKIP."
(let ((name (symbol-name (nth TeX-auto-parser-add entry)))
- (list (symbol-value (nth TeX-auto-parser-temporary entry))))
+ (list (symbol-value (nth TeX-auto-parser-temporary entry))))
(unless (null list)
(insert "\n (" name)
(dolist (el list)
- (cond ((and (stringp el) (not (string= el skip)))
- (insert "\n ")
- (insert (prin1-to-string el)))
- ((not (stringp el))
- (insert "\n ")
- (insert "'" (prin1-to-string el)))))
+ (cond ((and (stringp el) (not (string= el skip)))
+ (insert "\n ")
+ (insert (prin1-to-string el)))
+ ((not (stringp el))
+ (insert "\n ")
+ (insert "'" (prin1-to-string el)))))
(insert ")"))))
(defvar TeX-auto-ignore
@@ -4117,16 +4117,16 @@ If SKIP is not-nil, don't insert code for SKIP."
(defcustom TeX-auto-regexp-list 'TeX-auto-full-regexp-list
"List of regular expressions used for parsing the current file."
:type '(radio (variable-item TeX-auto-empty-regexp-list)
- (variable-item TeX-auto-full-regexp-list)
- (variable-item plain-TeX-auto-regexp-list)
- (variable-item LaTeX-auto-minimal-regexp-list)
- (variable-item LaTeX-auto-label-regexp-list)
- (variable-item LaTeX-auto-regexp-list)
- (symbol :tag "Other")
- (repeat :tag "Specify"
- (group (regexp :tag "Match")
- (sexp :tag "Groups")
- symbol)))
+ (variable-item TeX-auto-full-regexp-list)
+ (variable-item plain-TeX-auto-regexp-list)
+ (variable-item LaTeX-auto-minimal-regexp-list)
+ (variable-item LaTeX-auto-label-regexp-list)
+ (variable-item LaTeX-auto-regexp-list)
+ (symbol :tag "Other")
+ (repeat :tag "Specify"
+ (group (regexp :tag "Match")
+ (sexp :tag "Groups")
+ symbol)))
:group 'TeX-parse)
(make-variable-buffer-local 'TeX-auto-regexp-list)
@@ -4160,7 +4160,7 @@ alter the numbering of any ordinary, non-shy groups.")
(,(concat "\\\\font\\\\\\(" token "+\\)[^a-zA-Z@]") 1 TeX-auto-symbol)
(,(concat "\\\\chardef\\\\\\(" token "+\\)[^a-zA-Z@]") 1 TeX-auto-symbol)
(,(concat "\\\\new\\(?:count\\|dimen\\|muskip\\|skip\\)\\\\\\(" token
- "+\\)[^a-zA-Z@]")
+ "+\\)[^a-zA-Z@]")
1 TeX-auto-symbol)
(,(concat "\\\\newfont{?\\\\\\(" token "+\\)}?") 1 TeX-auto-symbol)
(,(concat "\\\\typein\\[\\\\\\(" token "+\\)\\]") 1 TeX-auto-symbol)
@@ -4197,16 +4197,16 @@ Use `TeX-auto-x-regexp-list' for parsing the region
between
"List of regular expressions used for additional parsing.
See `TeX-auto-x-parse-length'."
:type '(radio (variable-item TeX-auto-empty-regexp-list)
- (variable-item TeX-auto-full-regexp-list)
- (variable-item plain-TeX-auto-regexp-list)
- (variable-item LaTeX-auto-minimal-regexp-list)
- (variable-item LaTeX-auto-label-regexp-list)
- (variable-item LaTeX-auto-regexp-list)
- (symbol :tag "Other")
- (repeat :tag "Specify"
- (group (regexp :tag "Match")
- (sexp :tag "Groups")
- symbol)))
+ (variable-item TeX-auto-full-regexp-list)
+ (variable-item plain-TeX-auto-regexp-list)
+ (variable-item LaTeX-auto-minimal-regexp-list)
+ (variable-item LaTeX-auto-label-regexp-list)
+ (variable-item LaTeX-auto-regexp-list)
+ (symbol :tag "Other")
+ (repeat :tag "Specify"
+ (group (regexp :tag "Match")
+ (sexp :tag "Groups")
+ symbol)))
:group 'TeX-parse)
(make-variable-buffer-local 'TeX-auto-x-regexp-list)
@@ -4215,9 +4215,9 @@ See `TeX-auto-x-parse-length'."
you should not use something like `[\\(]' for a character range."
(let (start (n 0))
(while (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\([^?]"
- regexp start)
+ regexp start)
(setq start (- (match-end 0) 2)
- n (1+ n)))
+ n (1+ n)))
n))
(defun TeX-auto-parse-region (regexp-list beg end)
@@ -4227,52 +4227,52 @@ you should not use something like `[\\(]' for a
character range."
(if regexp-list
;; Extract the information.
(let* (groups
- (count 1)
- (regexp (concat "\\("
- (mapconcat
- (lambda(x)
- (push (cons count x) groups)
- (setq count
- (+ 1 count
- (TeX-regexp-group-count (car x))))
- (car x))
- regexp-list "\\)\\|\\(")
- "\\)"))
- syms
- lst)
- (setq count 0)
- (goto-char (if end (min end (point-max)) (point-max)))
- (while (re-search-backward regexp beg t)
- (let* ((entry (cdr (TeX-member nil groups
- (lambda (_a b)
- (match-beginning (car b))))))
- (symbol (nth 2 entry))
- (match (nth 1 entry)))
- (unless (TeX-in-comment)
- (looking-at (nth 0 entry))
- (if (fboundp symbol)
- (funcall symbol match)
- (puthash (if (listp match)
- (mapcar #'TeX-match-buffer match)
- (TeX-match-buffer match))
- (setq count (1- count))
- (cdr (or (assq symbol syms)
- (car (push
- (cons symbol
- (make-hash-table :test 'equal))
- syms)))))))))
- (setq count 0)
- (dolist (symbol syms)
- (setq lst (symbol-value (car symbol)))
- (while lst
- (puthash (pop lst)
- (setq count (1+ count))
- (cdr symbol)))
- (maphash (lambda (key value)
- (push (cons value key) lst))
- (cdr symbol))
- (clrhash (cdr symbol))
- (set (car symbol) (mapcar #'cdr (sort lst #'car-less-than-car)))))))
+ (count 1)
+ (regexp (concat "\\("
+ (mapconcat
+ (lambda(x)
+ (push (cons count x) groups)
+ (setq count
+ (+ 1 count
+ (TeX-regexp-group-count (car x))))
+ (car x))
+ regexp-list "\\)\\|\\(")
+ "\\)"))
+ syms
+ lst)
+ (setq count 0)
+ (goto-char (if end (min end (point-max)) (point-max)))
+ (while (re-search-backward regexp beg t)
+ (let* ((entry (cdr (TeX-member nil groups
+ (lambda (_a b)
+ (match-beginning (car b))))))
+ (symbol (nth 2 entry))
+ (match (nth 1 entry)))
+ (unless (TeX-in-comment)
+ (looking-at (nth 0 entry))
+ (if (fboundp symbol)
+ (funcall symbol match)
+ (puthash (if (listp match)
+ (mapcar #'TeX-match-buffer match)
+ (TeX-match-buffer match))
+ (setq count (1- count))
+ (cdr (or (assq symbol syms)
+ (car (push
+ (cons symbol
+ (make-hash-table :test 'equal))
+ syms)))))))))
+ (setq count 0)
+ (dolist (symbol syms)
+ (setq lst (symbol-value (car symbol)))
+ (while lst
+ (puthash (pop lst)
+ (setq count (1+ count))
+ (cdr symbol)))
+ (maphash (lambda (key value)
+ (push (cons value key) lst))
+ (cdr symbol))
+ (clrhash (cdr symbol))
+ (set (car symbol) (mapcar #'cdr (sort lst #'car-less-than-car)))))))
(defun TeX-auto-parse ()
"Parse TeX information in current buffer.
@@ -4287,12 +4287,12 @@ functions in `TeX-auto-cleanup-hook' after parsing."
(save-excursion
(and (> TeX-auto-x-parse-length TeX-auto-parse-length)
- (> (point-max) TeX-auto-parse-length)
- (TeX-auto-parse-region TeX-auto-x-regexp-list
- TeX-auto-parse-length
- TeX-auto-x-parse-length))
+ (> (point-max) TeX-auto-parse-length)
+ (TeX-auto-parse-region TeX-auto-x-regexp-list
+ TeX-auto-parse-length
+ TeX-auto-x-parse-length))
(TeX-auto-parse-region TeX-auto-regexp-list
- nil TeX-auto-parse-length))
+ nil TeX-auto-parse-length))
;; Cleanup ignored symbols.
@@ -4302,9 +4302,9 @@ functions in `TeX-auto-cleanup-hook' after parsing."
(setq TeX-auto-symbol (cdr TeX-auto-symbol)))
(let ((list TeX-auto-symbol))
(while (and list (cdr list))
- (if (member (car (cdr list)) TeX-auto-ignore)
- (setcdr list (cdr (cdr list)))
- (setq list (cdr list)))))
+ (if (member (car (cdr list)) TeX-auto-ignore)
+ (setcdr list (cdr (cdr list)))
+ (setq list (cdr list)))))
(run-hooks 'TeX-auto-cleanup-hook)))
@@ -4318,16 +4318,16 @@ functions in `TeX-auto-cleanup-hook' after parsing."
"Add MATCH to TeX-auto-symbols.
Check for potential LaTeX environments."
(let ((symbol (if (listp match)
- (mapcar 'TeX-match-buffer match)
- (TeX-match-buffer match))))
+ (mapcar 'TeX-match-buffer match)
+ (TeX-match-buffer match))))
(if (and (stringp symbol)
- (string-match "^end\\(.+\\)$" symbol))
- (add-to-list 'LaTeX-auto-end-symbol
- (substring symbol (match-beginning 1) (match-end 1)))
+ (string-match "^end\\(.+\\)$" symbol))
+ (add-to-list 'LaTeX-auto-end-symbol
+ (substring symbol (match-beginning 1) (match-end 1)))
(if (listp symbol)
- (dolist (elt symbol)
- (add-to-list 'TeX-auto-symbol elt))
- (add-to-list 'TeX-auto-symbol symbol)))))
+ (dolist (elt symbol)
+ (add-to-list 'TeX-auto-symbol elt))
+ (add-to-list 'TeX-auto-symbol symbol)))))
;;; File Extensions
@@ -4401,9 +4401,9 @@ If EXTENSIONS is not specified or nil, the value of
(setq extensions TeX-file-extensions))
(let ((regexp (concat "\\.\\("
- (mapconcat 'identity extensions "\\|")
- "\\)$"))
- (case-fold-search t))
+ (mapconcat 'identity extensions "\\|")
+ "\\)$"))
+ (case-fold-search t))
(string-match regexp file)))
(defun TeX-strip-extension (&optional string extensions nodir nostrip)
@@ -4423,15 +4423,15 @@ EXTENSIONS defaults to `TeX-file-extensions'."
(setq extensions TeX-file-extensions))
(let* ((strip (if (and (not nostrip)
- (TeX-match-extension string extensions))
- (substring string 0 (match-beginning 0))
- string))
- (dir (expand-file-name (or (file-name-directory strip) "./"))))
+ (TeX-match-extension string extensions))
+ (substring string 0 (match-beginning 0))
+ string))
+ (dir (expand-file-name (or (file-name-directory strip) "./"))))
(if (or (eq nodir t)
- (string-equal dir (expand-file-name "./"))
- (member dir (mapcar #'file-name-as-directory TeX-macro-global))
- (member dir (mapcar #'file-name-as-directory TeX-macro-private)))
- (file-name-nondirectory strip)
+ (string-equal dir (expand-file-name "./"))
+ (member dir (mapcar #'file-name-as-directory TeX-macro-global))
+ (member dir (mapcar #'file-name-as-directory TeX-macro-private)))
+ (file-name-nondirectory strip)
strip)))
@@ -4441,7 +4441,7 @@ EXTENSIONS defaults to `TeX-file-extensions'."
"Return a list of available TeX tree roots."
(let (list)
(dolist (dir (TeX-tree-expand '("$TEXMFHOME" "$TEXMFMAIN" "$TEXMFLOCAL"
- "$TEXMFDIST")
+ "$TEXMFDIST")
"latex"))
(when (file-readable-p dir)
(cl-pushnew dir list :test #'equal)))
@@ -4463,26 +4463,26 @@ nil. If NODIR is non-nil, remove directory part. If
STRIP is
non-nil, remove file extension."
(when TeX-kpathsea-path-delimiter
(let ((dirs (if (eq scope 'local)
- '("./")
- (TeX-tree-expand (list var) nil)))
- result)
+ '("./")
+ (TeX-tree-expand (list var) nil)))
+ result)
(if (eq scope 'global)
- (setq dirs (delete "./" dirs)))
+ (setq dirs (delete "./" dirs)))
(setq extensions (concat "\\.\\(?:"
- (mapconcat #'identity extensions "\\|")
- "\\)\\'")
- result (apply #'append (mapcar (lambda (x)
- (when (file-readable-p x)
- (directory-files
- x (not nodir) extensions t)))
- dirs)))
+ (mapconcat #'identity extensions "\\|")
+ "\\)\\'")
+ result (apply #'append (mapcar (lambda (x)
+ (when (file-readable-p x)
+ (directory-files
+ x (not nodir) extensions t)))
+ dirs)))
(if strip
- (mapcar (lambda (x)
- (if (string-match extensions x)
- (substring x 0 (match-beginning 0))
- x))
- result)
- result))))
+ (mapcar (lambda (x)
+ (if (string-match extensions x)
+ (substring x 0 (match-beginning 0))
+ x))
+ result)
+ result))))
(defun TeX-search-files (&optional directories extensions nodir strip)
"Return a list of all reachable files in DIRECTORIES ending with EXTENSIONS.
@@ -4496,34 +4496,34 @@ If optional argument EXTENSIONS is not set, use
`TeX-file-extensions'"
(when (null directories)
(setq directories (cons "./" (append TeX-macro-private TeX-macro-global))))
(let (match
- (TeX-file-recurse (cond ((symbolp TeX-file-recurse)
- TeX-file-recurse)
- ((zerop TeX-file-recurse)
- nil)
- ((1- TeX-file-recurse)))))
+ (TeX-file-recurse (cond ((symbolp TeX-file-recurse)
+ TeX-file-recurse)
+ ((zerop TeX-file-recurse)
+ nil)
+ ((1- TeX-file-recurse)))))
(while directories
(let* ((directory (car directories))
- (content (and directory
- (file-readable-p directory)
- (file-directory-p directory)
- (directory-files directory))))
- (setq directories (cdr directories))
- (while content
- (let ((file (concat directory (car content))))
- (setq content (cdr content))
- (cond ((string-match TeX-ignore-file file))
- ((not (file-readable-p file)))
- ((file-directory-p file)
- (if TeX-file-recurse
- (setq match
- (append match
- (TeX-search-files
- (list (file-name-as-directory file))
- extensions nodir strip)))))
- ((TeX-match-extension file extensions)
- (setq match (cons (TeX-strip-extension
- file extensions nodir (not strip))
- match))))))))
+ (content (and directory
+ (file-readable-p directory)
+ (file-directory-p directory)
+ (directory-files directory))))
+ (setq directories (cdr directories))
+ (while content
+ (let ((file (concat directory (car content))))
+ (setq content (cdr content))
+ (cond ((string-match TeX-ignore-file file))
+ ((not (file-readable-p file)))
+ ((file-directory-p file)
+ (if TeX-file-recurse
+ (setq match
+ (append match
+ (TeX-search-files
+ (list (file-name-as-directory file))
+ extensions nodir strip)))))
+ ((TeX-match-extension file extensions)
+ (setq match (cons (TeX-strip-extension
+ file extensions nodir (not strip))
+ match))))))))
match))
;; The variables `TeX-macro-private' and `TeX-macro-global' are not
@@ -4565,29 +4565,29 @@ If optional argument NODIR is non-nil, remove directory
part.
If optional argument STRIP is non-nil, remove file extension."
(let* ((gc-cons-threshold 10000000)
- (spec (assq filetype TeX-search-files-type-alist))
- (kpse-var (nth 1 spec))
- (rawdirs (nth 2 spec))
- (exts (nth 3 spec))
- expdirs dirs local-files)
+ (spec (assq filetype TeX-search-files-type-alist))
+ (kpse-var (nth 1 spec))
+ (rawdirs (nth 2 spec))
+ (exts (nth 3 spec))
+ expdirs dirs local-files)
(setq exts (if (symbolp exts) (eval exts) exts))
(or (TeX-search-files-kpathsea kpse-var exts scope nodir strip)
- (progn
- (unless (eq scope 'global)
- (setq local-files
- (let ((TeX-file-recurse nil))
- (TeX-search-files '("./") exts nodir strip))))
- (if (eq scope 'local)
- local-files
- (if (null TeX-tree-roots)
- (error "No TeX trees available; configure `TeX-tree-roots'")
- ;; Expand variables.
+ (progn
+ (unless (eq scope 'global)
+ (setq local-files
+ (let ((TeX-file-recurse nil))
+ (TeX-search-files '("./") exts nodir strip))))
+ (if (eq scope 'local)
+ local-files
+ (if (null TeX-tree-roots)
+ (error "No TeX trees available; configure `TeX-tree-roots'")
+ ;; Expand variables.
(setq expdirs
- ;; Don't use `delete-dups' instead of
- ;; `TeX-delete-duplicate-strings' here.
- ;; Otherwise, when the last element of `rawdirs'
- ;; is a variable, its value might be truncated as
- ;; side effect.
+ ;; Don't use `delete-dups' instead of
+ ;; `TeX-delete-duplicate-strings' here.
+ ;; Otherwise, when the last element of `rawdirs'
+ ;; is a variable, its value might be truncated as
+ ;; side effect.
(TeX-delete-duplicate-strings
(apply #'append
(mapcar (lambda (rawdir)
@@ -4595,16 +4595,16 @@ If optional argument STRIP is non-nil, remove file
extension."
(symbol-value rawdir)
(list rawdir)))
rawdirs))))
- ;; Assumption: Either all paths are absolute or all are relative.
- (if (file-name-absolute-p (car expdirs))
- (setq dirs expdirs)
- ;; Append relative TDS subdirs to all TeX tree roots.
- (dolist (root TeX-tree-roots)
- (dolist (dir expdirs)
+ ;; Assumption: Either all paths are absolute or all are relative.
+ (if (file-name-absolute-p (car expdirs))
+ (setq dirs expdirs)
+ ;; Append relative TDS subdirs to all TeX tree roots.
+ (dolist (root TeX-tree-roots)
+ (dolist (dir expdirs)
(let ((dir (expand-file-name dir root)))
(unless (member dir dirs)
(setq dirs (append dirs (list dir)))))))))
- (append local-files (TeX-search-files dirs exts nodir strip)))))))
+ (append local-files (TeX-search-files dirs exts nodir strip)))))))
;;; Narrowing
@@ -4614,15 +4614,15 @@ If optional argument STRIP is non-nil, remove file
extension."
(save-excursion
(widen)
(let ((opoint (point))
- beg end)
+ beg end)
(if (null (search-backward "{" nil t))
- (message "Nothing to be narrowed here.")
- (setq beg (point))
- (forward-sexp)
- (setq end (point))
- (if (< end opoint)
- (message "Nothing to be narrowed here.")
- (narrow-to-region beg end))))))
+ (message "Nothing to be narrowed here.")
+ (setq beg (point))
+ (forward-sexp)
+ (setq end (point))
+ (if (< end opoint)
+ (message "Nothing to be narrowed here.")
+ (narrow-to-region beg end))))))
(put 'TeX-narrow-to-group 'disabled t)
;;; Utilities
@@ -4647,16 +4647,16 @@ Return nil if ELT is not a member of LIST."
(catch 'found
(dolist (elt elts)
(when (member elt list)
- (throw 'found t)))))
+ (throw 'found t)))))
(defun TeX-assoc (key list)
"Return non-nil if KEY is `equal' to the car of an element of LIST.
Like assoc, except case insensitive."
(let ((case-fold-search t))
(TeX-member key list
- (lambda (a b)
- (string-match (concat "^" (regexp-quote a) "$")
- (car b))))))
+ (lambda (a b)
+ (string-match (concat "^" (regexp-quote a) "$")
+ (car b))))))
(defun TeX-match-buffer (n)
"Return the substring corresponding to the N'th match.
@@ -4672,9 +4672,9 @@ to look backward for."
(let ((pos (point)))
(save-excursion
(and (re-search-backward regexp
- (if limit (max (point-min) (- (point) limit)))
- t)
- (eq (match-end 0) pos)))))
+ (if limit (max (point-min) (- (point) limit)))
+ t)
+ (eq (match-end 0) pos)))))
(defun TeX-current-line ()
"The current line number."
@@ -4701,18 +4701,18 @@ element to ALIST-VAR."
;; Loop over all elements of NEW-ALIST.
(while new-alist
(let* ((new-element (car new-alist))
- ;; Get the element of ALIST-VAR with the same key of the current
- ;; element of NEW-ALIST, if any.
- (old-element (assoc (car new-element) (symbol-value alist-var))))
+ ;; Get the element of ALIST-VAR with the same key of the current
+ ;; element of NEW-ALIST, if any.
+ (old-element (assoc (car new-element) (symbol-value alist-var))))
(if old-element
- (progn
- (set alist-var (delete old-element (symbol-value alist-var)))
- ;; Append to `old-element' the values of the current element of
- ;; NEW-ALIST.
- (mapc (lambda (elt) (add-to-list 'old-element elt t))
- (cdr new-element))
- (set alist-var (add-to-list alist-var old-element t)))
- (add-to-list alist-var new-element t)))
+ (progn
+ (set alist-var (delete old-element (symbol-value alist-var)))
+ ;; Append to `old-element' the values of the current element of
+ ;; NEW-ALIST.
+ (mapc (lambda (elt) (add-to-list 'old-element elt t))
+ (cdr new-element))
+ (set alist-var (add-to-list alist-var old-element t)))
+ (add-to-list alist-var new-element t)))
;; Next element of NEW-ALIST.
(setq new-alist (cdr new-alist))))
@@ -4725,15 +4725,15 @@ element to ALIST-VAR."
(progn ; Define TeX-mode-syntax-table.
(modify-syntax-entry (string-to-char TeX-esc)
- "\\" TeX-mode-syntax-table)
+ "\\" TeX-mode-syntax-table)
(modify-syntax-entry ?\f ">" TeX-mode-syntax-table)
(modify-syntax-entry ?\n ">" TeX-mode-syntax-table)
(modify-syntax-entry (string-to-char TeX-grop)
- (concat "(" TeX-grcl)
- TeX-mode-syntax-table)
+ (concat "(" TeX-grcl)
+ TeX-mode-syntax-table)
(modify-syntax-entry (string-to-char TeX-grcl)
- (concat ")" TeX-grop)
- TeX-mode-syntax-table)
+ (concat ")" TeX-grop)
+ TeX-mode-syntax-table)
(modify-syntax-entry ?% "<" TeX-mode-syntax-table)
(modify-syntax-entry ?\" "." TeX-mode-syntax-table)
(modify-syntax-entry ?& "." TeX-mode-syntax-table)
@@ -4782,39 +4782,39 @@ element to ALIST-VAR."
(defun TeX-command-menu-print (printer command name)
"Print on PRINTER using method COMMAND to run NAME."
(let ((TeX-printer-default (unless (string= printer "Other") printer))
- (TeX-printer-list (and (string= printer "Other") TeX-printer-list))
- (TeX-print-command command)
- (TeX-queue-command command))
+ (TeX-printer-list (and (string= printer "Other") TeX-printer-list))
+ (TeX-print-command command)
+ (TeX-queue-command command))
(TeX-command-menu name)))
(defun TeX-command-menu-printer-entry (entry lookup command name)
"Return `TeX-printer-list' ENTRY as a menu item."
(vector (nth 0 entry)
- (list 'TeX-command-menu-print
- (nth 0 entry)
- (or (nth lookup entry) command)
- name)))
+ (list 'TeX-command-menu-print
+ (nth 0 entry)
+ (or (nth lookup entry) command)
+ name)))
(defun TeX-command-menu-entry (entry)
"Return `TeX-command-list' ENTRY as a menu item."
(let ((name (car entry)))
(cond ((and (string-equal name TeX-command-Print)
- TeX-printer-list)
- (cons TeX-command-Print
- (mapcar (lambda (entry)
- (TeX-command-menu-printer-entry
- entry 1 TeX-print-command name))
- (append TeX-printer-list '(("Other"))))))
- ((and (string-equal name TeX-command-Queue)
- TeX-printer-list)
- (cons TeX-command-Queue
- (mapcar (lambda (entry)
- (TeX-command-menu-printer-entry
- entry 2 TeX-queue-command name))
- (append TeX-printer-list '(("Other"))))))
- (t
- (vconcat `(,name (TeX-command-menu ,name))
- (nthcdr 5 entry))))))
+ TeX-printer-list)
+ (cons TeX-command-Print
+ (mapcar (lambda (entry)
+ (TeX-command-menu-printer-entry
+ entry 1 TeX-print-command name))
+ (append TeX-printer-list '(("Other"))))))
+ ((and (string-equal name TeX-command-Queue)
+ TeX-printer-list)
+ (cons TeX-command-Queue
+ (mapcar (lambda (entry)
+ (TeX-command-menu-printer-entry
+ entry 2 TeX-queue-command name))
+ (append TeX-printer-list '(("Other"))))))
+ (t
+ (vconcat `(,name (TeX-command-menu ,name))
+ (nthcdr 5 entry))))))
(defconst TeX-command-menu-name "Command"
"Name to be displayed for the command menu in all modes defined by AUCTeX.")
@@ -4837,9 +4837,9 @@ affected. See `TeX-electric-macro' for detail."
"Function to be called upon pressing `RET'."
:group 'TeX-indentation
:type '(choice (const newline)
- (const newline-and-indent)
- (const reindent-then-newline-and-indent)
- (sexp :tag "Other")))
+ (const newline-and-indent)
+ (const reindent-then-newline-and-indent)
+ (sexp :tag "Other")))
(defun TeX-insert-backslash (arg)
"Either insert typed key ARG times or call `TeX-electric-macro'.
@@ -4951,14 +4951,14 @@ Brace insertion is only done if point is in a math
construct and
:help "Commands in this menu work on the region"]
[ "Fix the Region" TeX-pin-region
:active (or (if prefix-arg
- (<= (prefix-numeric-value prefix-arg) 0)
- (and (boundp 'TeX-command-region-begin)
- (markerp TeX-command-region-begin)))
- mark-active)
+ (<= (prefix-numeric-value prefix-arg) 0)
+ (and (boundp 'TeX-command-region-begin)
+ (markerp TeX-command-region-begin)))
+ mark-active)
;;:visible (eq TeX-command-current 'TeX-command-region)
:style toggle
:selected (and (boundp 'TeX-command-region-begin)
- (markerp TeX-command-region-begin))
+ (markerp TeX-command-region-begin))
:help "Fix the region for \"Command on Region\""]
"-"
["Recenter Output Buffer" TeX-recenter-output-buffer
@@ -4978,37 +4978,37 @@ Brace insertion is only done if point is in a math
construct and
"-"
("TeXing Options"
,@(mapcar (lambda (x)
- (let ((symbol (car x)) (name (nth 1 x)))
- `[ ,(format "Use %s engine" name) (TeX-engine-set ',symbol)
- :style radio :selected (eq TeX-engine ',symbol)
- :help ,(format "Use %s engine for compiling" name) ]))
- (TeX-engine-alist))
+ (let ((symbol (car x)) (name (nth 1 x)))
+ `[ ,(format "Use %s engine" name) (TeX-engine-set ',symbol)
+ :style radio :selected (eq TeX-engine ',symbol)
+ :help ,(format "Use %s engine for compiling" name) ]))
+ (TeX-engine-alist))
"-"
[ "Generate PDF" TeX-PDF-mode
- :style toggle :selected TeX-PDF-mode
- :active (not (eq TeX-engine 'omega))
- :help "Use PDFTeX to generate PDF instead of DVI"]
+ :style toggle :selected TeX-PDF-mode
+ :active (not (eq TeX-engine 'omega))
+ :help "Use PDFTeX to generate PDF instead of DVI"]
( "PDF from DVI"
- :visible TeX-PDF-mode
- :help "Compile to DVI with (La)TeX and convert to PDF"
- [ "Compile directly to PDF"
- (lambda () (interactive) (setq TeX-PDF-from-DVI nil))
- :style radio :selected (null (TeX-PDF-from-DVI))
- :help "Compile directly to PDF without intermediate conversions"]
- [ "dvips + ps2pdf"
- (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvips"))
- :style radio :selected (equal (TeX-PDF-from-DVI) "Dvips")
- :help "Convert DVI to PDF with dvips + ps2pdf sequence"]
- [ "dvipdfmx"
- (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvipdfmx"))
- :style radio :selected (equal (TeX-PDF-from-DVI) "Dvipdfmx")
- :help "Convert DVI to PDF with dvipdfmx"])
+ :visible TeX-PDF-mode
+ :help "Compile to DVI with (La)TeX and convert to PDF"
+ [ "Compile directly to PDF"
+ (lambda () (interactive) (setq TeX-PDF-from-DVI nil))
+ :style radio :selected (null (TeX-PDF-from-DVI))
+ :help "Compile directly to PDF without intermediate conversions"]
+ [ "dvips + ps2pdf"
+ (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvips"))
+ :style radio :selected (equal (TeX-PDF-from-DVI) "Dvips")
+ :help "Convert DVI to PDF with dvips + ps2pdf sequence"]
+ [ "dvipdfmx"
+ (lambda () (interactive) (setq TeX-PDF-from-DVI "Dvipdfmx"))
+ :style radio :selected (equal (TeX-PDF-from-DVI) "Dvipdfmx")
+ :help "Convert DVI to PDF with dvipdfmx"])
[ "Run Interactively" TeX-interactive-mode
- :style toggle :selected TeX-interactive-mode :keys "C-c C-t C-i"
- :help "Stop on errors in a TeX run"]
+ :style toggle :selected TeX-interactive-mode :keys "C-c C-t C-i"
+ :help "Stop on errors in a TeX run"]
[ "Correlate I/O" TeX-source-correlate-mode
- :style toggle :selected TeX-source-correlate-mode
- :help "Enable forward and inverse search in the previewer"]
+ :style toggle :selected TeX-source-correlate-mode
+ :help "Enable forward and inverse search in the previewer"]
["Debug Bad Boxes" TeX-toggle-debug-bad-boxes
:style toggle :selected TeX-debug-bad-boxes :keys "C-c C-t C-b"
:help "Make \"Next Error\" show overfull and underfull boxes"]
@@ -5018,20 +5018,20 @@ Brace insertion is only done if point is in a math
construct and
["Compile and view" TeX-command-run-all
:help "Compile the document until it is ready and open the viewer"])
(delq nil
- (mapcar #'TeX-command-menu-entry
- (TeX-mode-specific-command-list mode)))))
+ (mapcar #'TeX-command-menu-entry
+ (TeX-mode-specific-command-list mode)))))
(defun TeX-mode-specific-command-list (mode)
"Return the list of commands available in the given MODE."
(let ((full-list TeX-command-list)
- out-list
- entry)
+ out-list
+ entry)
(while (setq entry (pop full-list))
;; `(nth 4 entry)' may be either an atom in case of which the
;; entry should be present in any mode or a list of major modes.
(if (or (atom (nth 4 entry))
- (memq mode (nth 4 entry)))
- (push entry out-list)))
+ (memq mode (nth 4 entry)))
+ (push entry out-list)))
(nreverse out-list)))
(defvar TeX-fold-menu
@@ -5104,17 +5104,17 @@ Brace insertion is only done if point is in a math
construct and
:help "Open the customization buffer for AUCTeX"]
["Extend this Menu"
(progn
- (easy-menu-add-item
- nil
- ;; Ugly hack because docTeX mode uses the LaTeX menu.
- (list (if (eq major-mode 'doctex-mode) "LaTeX" TeX-base-mode-name))
- (or TeX-customization-menu
- (setq TeX-customization-menu
- (customize-menu-create 'AUCTeX "Customize AUCTeX")))))
+ (easy-menu-add-item
+ nil
+ ;; Ugly hack because docTeX mode uses the LaTeX menu.
+ (list (if (eq major-mode 'doctex-mode) "LaTeX" TeX-base-mode-name))
+ (or TeX-customization-menu
+ (setq TeX-customization-menu
+ (customize-menu-create 'AUCTeX "Customize AUCTeX")))))
:help "Make this menu a full-blown customization menu"])
["Report AUCTeX Bug" TeX-submit-bug-report
:help ,(format "Problems with AUCTeX %s? Mail us!"
- AUCTeX-version)]))
+ AUCTeX-version)]))
;;; Verbatim constructs
@@ -5147,14 +5147,14 @@ whitespace after the comment starter or any character
before it.")
;; Find first comment line
(beginning-of-line)
(while (and (looking-at (concat "^[ \t]*" TeX-comment-start-regexp))
- (not (bobp)))
+ (not (bobp)))
(forward-line -1))
(let ((beg (point)))
(forward-line 1)
;; Find last comment line
(while (and (looking-at (concat "^[ \t]*" TeX-comment-start-regexp))
- (not (eobp)))
- (forward-line 1))
+ (not (eobp)))
+ (forward-line 1))
;; Uncomment region
(uncomment-region beg (point)))))
@@ -5171,22 +5171,22 @@ whitespace after the comment starter or any character
before it.")
;; paragraph outside the visible window which might get
;; commented without the user noticing.
(unless (looking-at "^[ \t]*$")
- (mark-paragraph)
- (comment-region (point) (mark))))))
+ (mark-paragraph)
+ (comment-region (point) (mark))))))
(defun TeX-in-comment ()
"Return non-nil if point is in a comment."
(if (or (bolp)
- (null comment-start-skip)
- (eq (preceding-char) ?\r))
+ (null comment-start-skip)
+ (eq (preceding-char) ?\r))
nil
(save-excursion
(save-match-data
- (let ((pos (point)))
- (beginning-of-line)
- (and (or (looking-at comment-start-skip)
- (re-search-forward comment-start-skip pos t))
- (not (TeX-verbatim-p))))))))
+ (let ((pos (point)))
+ (beginning-of-line)
+ (and (or (looking-at comment-start-skip)
+ (re-search-forward comment-start-skip pos t))
+ (not (TeX-verbatim-p))))))))
(defun TeX-in-commented-line ()
"Return non-nil if point is in a line consisting only of a comment.
@@ -5199,8 +5199,8 @@ whitespace as well."
(forward-line 0)
(skip-chars-forward " \t")
(string= (buffer-substring-no-properties
- (point) (min (point-max) (+ (point) (length comment-start))))
- comment-start)))
+ (point) (min (point-max) (+ (point) (length comment-start))))
+ comment-start)))
(defun TeX-in-line-comment ()
"Return non-nil if point is in a line comment.
@@ -5209,8 +5209,8 @@ no whitespace before the comment sign."
(save-excursion
(forward-line 0)
(string= (buffer-substring-no-properties
- (point) (min (point-max) (+ (point) (length comment-start))))
- comment-start)))
+ (point) (min (point-max) (+ (point) (length comment-start))))
+ comment-start)))
(defun TeX-comment-prefix ()
"Return the comment prefix of the current line.
@@ -5220,7 +5220,7 @@ the beginning of the line, return nil."
(beginning-of-line)
(save-match-data
(when (looking-at (concat "\\([ \t]*" TeX-comment-start-regexp "+\\)+"))
- (match-string 0)))))
+ (match-string 0)))))
(defun TeX-forward-comment-skip (&optional count limit)
"Move forward to the next comment skip.
@@ -5234,40 +5234,40 @@ not move point further than this value."
(unless limit (setq limit (point-max)))
(dotimes (_ (abs count))
(if (< count 0)
- (forward-line -1)
+ (forward-line -1)
(beginning-of-line))
(let ((prefix (when (looking-at (concat "\\([ \t]*"
- TeX-comment-start-regexp "+\\)+"))
- (buffer-substring (+ (line-beginning-position)
- (current-indentation))
- (match-end 0)))))
+ TeX-comment-start-regexp "+\\)+"))
+ (buffer-substring (+ (line-beginning-position)
+ (current-indentation))
+ (match-end 0)))))
(while (save-excursion
- (and (if (> count 0)
- (<= (point) limit)
- (>= (point) limit))
- (zerop (if (> count 0)
- (forward-line 1)
- (forward-line -1)))
- (if prefix
- (if (looking-at (concat "\\([ \t]*"
- TeX-comment-start-regexp
- "+\\)+"))
- ;; If the preceding line is a commented line
- ;; as well, check if the prefixes are
- ;; identical.
- (string= prefix
- (buffer-substring
- (+ (line-beginning-position)
- (current-indentation))
- (match-end 0)))
- nil)
- (not (looking-at (concat "[ \t]*"
- TeX-comment-start-regexp))))))
- (if (> count 0)
- (forward-line 1)
- (forward-line -1)))
+ (and (if (> count 0)
+ (<= (point) limit)
+ (>= (point) limit))
+ (zerop (if (> count 0)
+ (forward-line 1)
+ (forward-line -1)))
+ (if prefix
+ (if (looking-at (concat "\\([ \t]*"
+ TeX-comment-start-regexp
+ "+\\)+"))
+ ;; If the preceding line is a commented line
+ ;; as well, check if the prefixes are
+ ;; identical.
+ (string= prefix
+ (buffer-substring
+ (+ (line-beginning-position)
+ (current-indentation))
+ (match-end 0)))
+ nil)
+ (not (looking-at (concat "[ \t]*"
+ TeX-comment-start-regexp))))))
+ (if (> count 0)
+ (forward-line 1)
+ (forward-line -1)))
(if (> count 0)
- (forward-line 1)))))
+ (forward-line 1)))))
(defun TeX-backward-comment-skip (&optional count limit)
"Move backward to the next comment skip.
@@ -5314,25 +5314,25 @@ regardless of its data type."
(current-column)
(skip-chars-backward " \t")
(max (if (bolp) 0 (1+ (current-column)))
- comment-column)))
+ comment-column)))
(defun TeX-brace-count-line ()
"Count number of open/closed braces."
(save-excursion
(let ((count 0) (limit (line-end-position)) char)
(while (progn
- (skip-chars-forward "^{}\\\\" limit)
- (when (and (< (point) limit) (not (TeX-in-comment)))
- (setq char (char-after))
- (forward-char)
- (cond ((eq char ?\{)
- (setq count (+ count TeX-brace-indent-level)))
- ((eq char ?\})
- (setq count (- count TeX-brace-indent-level)))
- ((eq char ?\\)
- (when (< (point) limit)
- (forward-char)
- t))))))
+ (skip-chars-forward "^{}\\\\" limit)
+ (when (and (< (point) limit) (not (TeX-in-comment)))
+ (setq char (char-after))
+ (forward-char)
+ (cond ((eq char ?\{)
+ (setq count (+ count TeX-brace-indent-level)))
+ ((eq char ?\})
+ (setq count (- count TeX-brace-indent-level)))
+ ((eq char ?\\)
+ (when (< (point) limit)
+ (forward-char)
+ t))))))
count)))
;;; Navigation
@@ -5358,9 +5358,9 @@ characters ?{, ?}, ?[, ?], ?\(, ?\), ?<, and ?> are
supported.
The syntax of each of these characters not specified will be
reset to \" \"."
(let ((char-syntax-alist '((?\{ . "(}") (?\} . "){")
- (?\[ . "(]") (?\] . ")[")
- (?\( . "()") (?\) . ")(")
- (?\< . "(>") (?\> . ")<"))))
+ (?\[ . "(]") (?\] . ")[")
+ (?\( . "()") (?\) . ")(")
+ (?\< . "(>") (?\> . ")<"))))
;; Clean entries possibly set before.
(modify-syntax-entry ?\\ " " TeX-search-syntax-table)
(modify-syntax-entry ?@ " " TeX-search-syntax-table)
@@ -5377,7 +5377,7 @@ reset to \" \"."
(dolist (elt args)
(unless (assoc elt char-syntax-alist) (error "Char not supported"))
(modify-syntax-entry elt (cdr (assoc elt char-syntax-alist))
- TeX-search-syntax-table))
+ TeX-search-syntax-table))
;; Return the syntax table.
TeX-search-syntax-table))
@@ -5388,20 +5388,20 @@ Default is 1. If COUNT is negative, it searches
backwards. With
optional DEPTH>=1, find that outer level. If LIMIT is non-nil,
do not search further than this position in the buffer."
(let ((count (if count
- (if (= count 0) (error "COUNT has to be <> 0") count)
- 1))
- (depth (if depth
- (if (< depth 1) (error "DEPTH has to be > 0") depth)
- 1)))
+ (if (= count 0) (error "COUNT has to be <> 0") count)
+ 1))
+ (depth (if depth
+ (if (< depth 1) (error "DEPTH has to be > 0") depth)
+ 1)))
(save-restriction
(when limit
- (if (> count 0)
- (narrow-to-region (point-min) limit)
- (narrow-to-region limit (point-max))))
+ (if (> count 0)
+ (narrow-to-region (point-min) limit)
+ (narrow-to-region limit (point-max))))
(with-syntax-table (TeX-search-syntax-table ?\{ ?\})
- (condition-case nil
- (scan-lists (point) count depth)
- (error nil))))))
+ (condition-case nil
+ (scan-lists (point) count depth)
+ (error nil))))))
(defun TeX-find-closing-brace (&optional depth limit)
"Return the position of the closing brace in a TeX group.
@@ -5428,41 +5428,41 @@ considered part of the macro."
(when lower-bound
(narrow-to-region lower-bound (point-max)))
(let ((orig-point (point))
- start-point)
+ start-point)
;; Point is located directly at the start of a macro. (-!-\foo{bar})
(when (and (eq (char-after) (aref TeX-esc 0))
- (not (TeX-escaped-p)))
- (setq start-point (point)))
+ (not (TeX-escaped-p)))
+ (setq start-point (point)))
;; Point is located on a macro. (\fo-!-o{bar})
(unless start-point
- (save-excursion
- (skip-chars-backward "A-Za-z@*")
- (when (and (eq (char-before) (aref TeX-esc 0))
- (not (TeX-escaped-p (1- (point)))))
- (setq start-point (1- (point))))))
+ (save-excursion
+ (skip-chars-backward "A-Za-z@*")
+ (when (and (eq (char-before) (aref TeX-esc 0))
+ (not (TeX-escaped-p (1- (point)))))
+ (setq start-point (1- (point))))))
;; Point is located in the argument of a macro. (\foo{ba-!-r})
(unless start-point
- (save-excursion
- (catch 'abort
- (let ((parse-sexp-ignore-comments t))
- (when (condition-case nil (progn (up-list) t) (error nil))
- (while (progn
- (condition-case nil (backward-sexp)
- (error (throw 'abort nil)))
- (forward-comment -1)
- (and (memq (char-before) '(?\] ?\}))
- (not (TeX-escaped-p (1- (point)))))))
- (skip-chars-backward "A-Za-z@*")
- (when (and (eq (char-before) (aref TeX-esc 0))
- (not (TeX-escaped-p (1- (point)))))
- (setq start-point (1- (point)))))))))
+ (save-excursion
+ (catch 'abort
+ (let ((parse-sexp-ignore-comments t))
+ (when (condition-case nil (progn (up-list) t) (error nil))
+ (while (progn
+ (condition-case nil (backward-sexp)
+ (error (throw 'abort nil)))
+ (forward-comment -1)
+ (and (memq (char-before) '(?\] ?\}))
+ (not (TeX-escaped-p (1- (point)))))))
+ (skip-chars-backward "A-Za-z@*")
+ (when (and (eq (char-before) (aref TeX-esc 0))
+ (not (TeX-escaped-p (1- (point)))))
+ (setq start-point (1- (point)))))))))
;; Search forward for the end of the macro.
(when start-point
- (save-excursion
- (goto-char (TeX-find-macro-end-helper start-point))
- (if (< orig-point (point))
- (cons start-point (point))
- nil))))))
+ (save-excursion
+ (goto-char (TeX-find-macro-end-helper start-point))
+ (if (< orig-point (point))
+ (cons start-point (point))
+ nil))))))
(defun TeX-find-macro-end-helper (start)
"Find the end of a macro given its START.
@@ -5472,41 +5472,41 @@ those will be considered part of it."
(save-excursion
(save-match-data
(catch 'found
- (goto-char (1+ start))
- (if (zerop (skip-chars-forward "A-Za-z@"))
- (forward-char)
- (skip-chars-forward "*"))
- (while (not (eobp))
- (cond
- ;; Skip over pairs of square brackets
- ((or (looking-at "[ \t]*\n?\\(\\[\\)") ; Be conservative: Consider
- ; only consecutive lines.
- (and (looking-at (concat "[ \t]*" TeX-comment-start-regexp))
- (save-excursion
- (forward-line 1)
- (looking-at "[ \t]*\\(\\[\\)"))))
- (goto-char (match-beginning 1))
- (condition-case nil
- (forward-sexp)
- (scan-error (throw 'found (point)))))
- ;; Skip over pairs of curly braces
- ((or (looking-at "[ \t]*\n?{") ; Be conservative: Consider
- ; only consecutive lines.
- (and (looking-at (concat "[ \t]*" TeX-comment-start-regexp))
- (save-excursion
- (forward-line 1)
- (looking-at "[ \t]*{"))))
- (goto-char (match-end 0))
- (goto-char (or (TeX-find-closing-brace)
- ;; If we cannot find a regular end, use the
- ;; next whitespace.
- (save-excursion (skip-chars-forward "^ \t\n")
- (point)))))
- (t
- (throw 'found (point)))))
- ;; Make sure that this function does not return nil, even
- ;; when the above `while' loop is totally skipped. (bug#35638)
- (throw 'found (point))))))
+ (goto-char (1+ start))
+ (if (zerop (skip-chars-forward "A-Za-z@"))
+ (forward-char)
+ (skip-chars-forward "*"))
+ (while (not (eobp))
+ (cond
+ ;; Skip over pairs of square brackets
+ ((or (looking-at "[ \t]*\n?\\(\\[\\)") ; Be conservative: Consider
+ ; only consecutive lines.
+ (and (looking-at (concat "[ \t]*" TeX-comment-start-regexp))
+ (save-excursion
+ (forward-line 1)
+ (looking-at "[ \t]*\\(\\[\\)"))))
+ (goto-char (match-beginning 1))
+ (condition-case nil
+ (forward-sexp)
+ (scan-error (throw 'found (point)))))
+ ;; Skip over pairs of curly braces
+ ((or (looking-at "[ \t]*\n?{") ; Be conservative: Consider
+ ; only consecutive lines.
+ (and (looking-at (concat "[ \t]*" TeX-comment-start-regexp))
+ (save-excursion
+ (forward-line 1)
+ (looking-at "[ \t]*{"))))
+ (goto-char (match-end 0))
+ (goto-char (or (TeX-find-closing-brace)
+ ;; If we cannot find a regular end, use the
+ ;; next whitespace.
+ (save-excursion (skip-chars-forward "^ \t\n")
+ (point)))))
+ (t
+ (throw 'found (point)))))
+ ;; Make sure that this function does not return nil, even
+ ;; when the above `while' loop is totally skipped. (bug#35638)
+ (throw 'found (point))))))
(defun TeX-find-macro-start (&optional limit)
"Return the start of a macro.
@@ -5552,7 +5552,7 @@ characters."
(TeX-search-unescaped regexp 'forward t bound noerror))
(defun TeX-search-unescaped (pattern
- &optional direction regexp-flag bound noerror)
+ &optional direction regexp-flag bound noerror)
"Search for unescaped PATTERN in a certain DIRECTION.
DIRECTION can be indicated by the symbols 'forward and 'backward.
If DIRECTION is omitted, a forward search is carried out.
@@ -5565,12 +5565,12 @@ throwing an error.
A pattern is escaped, if it is preceded by an odd number of escape
characters."
(let ((search-fun (if (eq direction 'backward)
- (if regexp-flag 're-search-backward 'search-backward)
- (if regexp-flag 're-search-forward 'search-forward))))
+ (if regexp-flag 're-search-backward 'search-backward)
+ (if regexp-flag 're-search-forward 'search-forward))))
(catch 'found
(while (funcall search-fun pattern bound noerror)
- (when (not (TeX-escaped-p (match-beginning 0)))
- (throw 'found (point)))))))
+ (when (not (TeX-escaped-p (match-beginning 0)))
+ (throw 'found (point)))))))
(defun TeX-escaped-p (&optional pos)
"Return t if the character at position POS is escaped.
@@ -5586,10 +5586,10 @@ escape characters, such as \"\\\" in LaTeX."
(let ((macro-start (TeX-find-macro-start)))
(when macro-start
(save-excursion
- (goto-char macro-start)
- (forward-char (length TeX-esc))
- (buffer-substring-no-properties
- (point) (progn (skip-chars-forward "@A-Za-z") (point)))))))
+ (goto-char macro-start)
+ (forward-char (length TeX-esc))
+ (buffer-substring-no-properties
+ (point) (progn (skip-chars-forward "@A-Za-z") (point)))))))
(defvar TeX-search-forward-comment-start-function nil
"Function to find the start of a comment.
@@ -5617,13 +5617,13 @@ the default implementation."
;;; Fonts
(defcustom TeX-font-list '((?\C-b "{\\bf " "}")
- (?\C-c "{\\sc " "}")
- (?\C-e "{\\em " "\\/}")
- (?\C-i "{\\it " "\\/}")
- (?\C-r "{\\rm " "}")
- (?\C-s "{\\sl " "\\/}")
- (?\C-t "{\\tt " "}")
- (?\C-d "" "" t))
+ (?\C-c "{\\sc " "}")
+ (?\C-e "{\\em " "\\/}")
+ (?\C-i "{\\it " "\\/}")
+ (?\C-r "{\\rm " "}")
+ (?\C-s "{\\sl " "\\/}")
+ (?\C-t "{\\tt " "}")
+ (?\C-d "" "" t))
"List of fonts used by `TeX-font'.
Each entry is a list.
@@ -5635,16 +5635,16 @@ suffix to be used in math mode.
An optional fourth (or sixth) element means always replace if t."
:group 'TeX-macro
:type '(repeat
- (group
- :value (?\C-a "" "")
- (character :tag "Key")
- (string :tag "Prefix")
- (string :tag "Suffix")
- (option (group
- :inline t
- (string :tag "Math Prefix")
- (string :tag "Math Suffix")))
- (option (sexp :format "Replace\n" :value t)))))
+ (group
+ :value (?\C-a "" "")
+ (character :tag "Key")
+ (string :tag "Prefix")
+ (string :tag "Suffix")
+ (option (group
+ :inline t
+ (string :tag "Math Prefix")
+ (string :tag "Math Suffix")))
+ (option (sexp :format "Replace\n" :value t)))))
(defvar TeX-font-replace-function 'TeX-font-replace
"Determines the function which is called when a font should be replaced.")
@@ -5652,12 +5652,12 @@ An optional fourth (or sixth) element means always
replace if t."
(defun TeX-describe-font-entry (entry)
"A textual description of an ENTRY in `TeX-font-list'."
(concat (format "%16s " (key-description (char-to-string (nth 0 entry))))
- (if (or (eq t (nth 3 entry)) (eq t (nth 5 entry)))
- "-- delete font"
- (format "%14s %-3s %14s %-3s"
- (nth 1 entry) (nth 2 entry)
- (if (stringp (nth 3 entry)) (nth 3 entry) "")
- (if (stringp (nth 4 entry)) (nth 4 entry) "")))))
+ (if (or (eq t (nth 3 entry)) (eq t (nth 5 entry)))
+ "-- delete font"
+ (format "%14s %-3s %14s %-3s"
+ (nth 1 entry) (nth 2 entry)
+ (if (stringp (nth 3 entry)) (nth 3 entry) "")
+ (if (stringp (nth 4 entry)) (nth 4 entry) "")))))
(defun TeX-font (replace what)
"Insert template for font change command.
@@ -5666,38 +5666,38 @@ to use, as specified by `TeX-font-list'."
(interactive "*P\nc")
(TeX-update-style)
(let* ((entry (assoc what TeX-font-list))
- (in-math (texmathp))
- (before (nth 1 entry))
- (after (nth 2 entry)))
+ (in-math (texmathp))
+ (before (nth 1 entry))
+ (after (nth 2 entry)))
(setq replace (or replace (eq t (nth 3 entry)) (eq t (nth 5 entry))))
(if (and in-math (stringp (nth 3 entry)))
- (setq before (nth 3 entry)
- after (nth 4 entry)))
+ (setq before (nth 3 entry)
+ after (nth 4 entry)))
(cond ((null entry)
- (let ((help (concat
- "Font list: "
- "KEY TEXTFONT MATHFONT\n\n"
- (mapconcat 'TeX-describe-font-entry
- TeX-font-list "\n"))))
- (with-output-to-temp-buffer "*Help*"
- (set-buffer "*Help*")
- (insert help))))
- (replace
- (funcall TeX-font-replace-function before after))
- ((TeX-active-mark)
- (save-excursion
- (cond ((> (mark) (point))
- (insert before)
- (goto-char (mark))
- (insert after))
- (t
- (insert after)
- (goto-char (mark))
- (insert before)))))
- (t
- (insert before)
- (save-excursion
- (insert after))))))
+ (let ((help (concat
+ "Font list: "
+ "KEY TEXTFONT MATHFONT\n\n"
+ (mapconcat 'TeX-describe-font-entry
+ TeX-font-list "\n"))))
+ (with-output-to-temp-buffer "*Help*"
+ (set-buffer "*Help*")
+ (insert help))))
+ (replace
+ (funcall TeX-font-replace-function before after))
+ ((TeX-active-mark)
+ (save-excursion
+ (cond ((> (mark) (point))
+ (insert before)
+ (goto-char (mark))
+ (insert after))
+ (t
+ (insert after)
+ (goto-char (mark))
+ (insert before)))))
+ (t
+ (insert before)
+ (save-excursion
+ (insert after))))))
(defun TeX-font-replace (start end)
"Replace font specification around point with START and END.
@@ -5710,13 +5710,13 @@ See also `TeX-font-replace-macro' and
`TeX-font-replace-function'."
(save-excursion
(replace-match start t t))
(if (save-excursion
- (backward-char 3)
- (if (looking-at (regexp-quote "\\/}"))
- (progn
- (delete-char 3)
- nil)
- t))
- (delete-char -1))
+ (backward-char 3)
+ (if (looking-at (regexp-quote "\\/}"))
+ (progn
+ (delete-char 3)
+ nil)
+ t))
+ (delete-char -1))
(insert end)))
(defun TeX-font-replace-macro (start end)
@@ -5724,30 +5724,30 @@ See also `TeX-font-replace-macro' and
`TeX-font-replace-function'."
For modes with font specifications like `\\font{text}'.
See also `TeX-font-replace' and `TeX-font-replace-function'."
(let ((font-list TeX-font-list)
- cmds strings regexp)
+ cmds strings regexp)
(while font-list
(setq strings (cdr (car font-list))
- font-list (cdr font-list))
+ font-list (cdr font-list))
(and (stringp (car strings)) (null (string= (car strings) ""))
- (setq cmds (cons (car strings) cmds)))
+ (setq cmds (cons (car strings) cmds)))
(setq strings (cdr (cdr strings)))
(and (stringp (car strings)) (null (string= (car strings) ""))
- (setq cmds (cons (car strings) cmds))))
+ (setq cmds (cons (car strings) cmds))))
(setq regexp (mapconcat 'regexp-quote cmds "\\|"))
(save-excursion
(catch 'done
- (while t
- (if (/= ?\\ (following-char))
- (skip-chars-backward "a-zA-Z "))
- (skip-chars-backward (regexp-quote TeX-esc))
- (if (looking-at regexp)
- (throw 'done t)
- (up-list -1))))
+ (while t
+ (if (/= ?\\ (following-char))
+ (skip-chars-backward "a-zA-Z "))
+ (skip-chars-backward (regexp-quote TeX-esc))
+ (if (looking-at regexp)
+ (throw 'done t)
+ (up-list -1))))
;; Use stripped syntax table in order to get stuff like "\emph{(}" right.
(with-syntax-table (TeX-search-syntax-table ?\{ ?\})
- (forward-sexp 2))
+ (forward-sexp 2))
(save-excursion
- (replace-match start t t))
+ (replace-match start t t))
(delete-char -1)
(insert end))))
@@ -5767,7 +5767,7 @@ See also `TeX-font-replace' and
`TeX-font-replace-function'."
(defconst TeX-dollar-string (char-to-string TeX-dollar-sign))
(defconst TeX-dollar-regexp
(concat "^" (regexp-quote TeX-dollar-string) "\\|[^" TeX-esc "]"
- (regexp-quote TeX-dollar-string)))
+ (regexp-quote TeX-dollar-string)))
(defcustom TeX-math-toggle-off-input-method t
"If non-nil, auto turn off some input methods when entering math mode.
@@ -5796,11 +5796,11 @@ to insert before point, the CDR is the string to insert
after
point. You can choose between \"$...$\" and \"\\(...\\)\"."
:group 'TeX-macro
:type '(choice (const :tag "No electricity" nil)
- (const :tag "$...$" ("$" . "$"))
- (const :tag "\\(...\\)" ("\\(" . "\\)"))
- (cons :tag "Other"
- (string :tag "Insert before point")
- (string :tag "Insert after point"))))
+ (const :tag "$...$" ("$" . "$"))
+ (const :tag "\\(...\\)" ("\\(" . "\\)"))
+ (cons :tag "Other"
+ (string :tag "Insert before point")
+ (string :tag "Insert after point"))))
(defun TeX-insert-dollar (&optional arg)
"Insert dollar sign.
@@ -5830,76 +5830,76 @@ sign. With optional ARG, insert that many dollar
signs."
;; We are inside math mode
(cond
((and TeX-electric-math
- (eq (preceding-char) ?\$)
- (eq (following-char) ?\$))
+ (eq (preceding-char) ?\$)
+ (eq (following-char) ?\$))
;; Point is between "$$" and `TeX-electric-math' is non-nil - insert
;; another pair of dollar signs and leave point between them.
(insert "$$")
(backward-char))
((and (stringp (car texmathp-why))
- (string-equal (substring (car texmathp-why) 0 1) "\$"))
+ (string-equal (substring (car texmathp-why) 0 1) "\$"))
;; Math mode was turned on with $ or $$ - insert a single $.
(insert "$")
;; Compatibility, `TeX-math-close-double-dollar' has been removed
;; after AUCTeX 11.87.
(if (boundp 'TeX-math-close-double-dollar)
- (message
- (concat "`TeX-math-close-double-dollar' has been removed,"
- "\nplease use `TeX-electric-math' instead.")))
+ (message
+ (concat "`TeX-math-close-double-dollar' has been removed,"
+ "\nplease use `TeX-electric-math' instead.")))
(when (and blink-matching-paren
- (or (string= (car texmathp-why) "$")
- (zerop (mod (save-excursion
- (skip-chars-backward "$")) 2))))
- (save-excursion
- (goto-char (cdr texmathp-why))
- (if (pos-visible-in-window-p)
- (sit-for blink-matching-delay)
- (message "Matches %s"
- (buffer-substring
- (point) (progn (end-of-line) (point))))))))
+ (or (string= (car texmathp-why) "$")
+ (zerop (mod (save-excursion
+ (skip-chars-backward "$")) 2))))
+ (save-excursion
+ (goto-char (cdr texmathp-why))
+ (if (pos-visible-in-window-p)
+ (sit-for blink-matching-delay)
+ (message "Matches %s"
+ (buffer-substring
+ (point) (progn (end-of-line) (point))))))))
(t
;; Math mode was not entered with dollar - we cannot finish it with one.
(message "Math mode started with `%s' cannot be closed with dollar"
- (car texmathp-why)))))
+ (car texmathp-why)))))
(t
;; Just somewhere in the text.
(cond
((and TeX-electric-math (TeX-active-mark))
(if (> (point) (mark))
- (exchange-point-and-mark))
+ (exchange-point-and-mark))
(cond
;; $...$ to $$...$$
((and (eq last-command 'TeX-insert-dollar)
- (re-search-forward "\\=\\$\\([^$][^z-a]*[^$]\\)\\$" (mark) t))
- (replace-match "$$\\1$$")
- (set-mark (match-beginning 0)))
+ (re-search-forward "\\=\\$\\([^$][^z-a]*[^$]\\)\\$" (mark) t))
+ (replace-match "$$\\1$$")
+ (set-mark (match-beginning 0)))
;; \(...\) to \[...\]
((and (eq last-command 'TeX-insert-dollar)
- (re-search-forward "\\=\\\\(\\([^z-a]*\\)\\\\)" (mark) t))
- (replace-match "\\\\[\\1\\\\]")
- (set-mark (match-beginning 0)))
+ (re-search-forward "\\=\\\\(\\([^z-a]*\\)\\\\)" (mark) t))
+ (replace-match "\\\\[\\1\\\\]")
+ (set-mark (match-beginning 0)))
;; Strip \[...\] or $$...$$
((and (eq last-command 'TeX-insert-dollar)
- (or (re-search-forward "\\=\\\\\\[\\([^z-a]*\\)\\\\\\]" (mark) t)
- (re-search-forward "\\=\\$\\$\\([^z-a]*\\)\\$\\$" (mark) t)))
- (replace-match "\\1")
- (set-mark (match-beginning 0)))
+ (or (re-search-forward "\\=\\\\\\[\\([^z-a]*\\)\\\\\\]" (mark) t)
+ (re-search-forward "\\=\\$\\$\\([^z-a]*\\)\\$\\$" (mark) t)))
+ (replace-match "\\1")
+ (set-mark (match-beginning 0)))
(t
- ;; We use `save-excursion' because point must be situated before opening
- ;; symbol.
- (save-excursion (insert (car TeX-electric-math)))
- (exchange-point-and-mark)
- (insert (cdr TeX-electric-math))))
+ ;; We use `save-excursion' because point must be situated before
opening
+ ;; symbol.
+ (save-excursion (insert (car TeX-electric-math)))
+ (exchange-point-and-mark)
+ (insert (cdr TeX-electric-math))))
;; Keep the region active.
(TeX-activate-region))
(TeX-electric-math
(insert (car TeX-electric-math))
(save-excursion (insert (cdr TeX-electric-math)))
(if blink-matching-paren
- (progn
- (backward-char)
- (sit-for blink-matching-delay)
- (forward-char))))
+ (progn
+ (backward-char)
+ (sit-for blink-matching-delay)
+ (forward-char))))
;; In any other case just insert a single $.
((insert "$")))))
(TeX-math-input-method-off))
@@ -5918,8 +5918,8 @@ sign. With optional ARG, insert that many dollar signs."
(string-match TeX-math-input-method-off-regexp current-input-method)
;; inactivate-input-method is obsolete since emacs 24.3.
(if (fboundp 'deactivate-input-method)
- (deactivate-input-method)
- (with-no-warnings
+ (deactivate-input-method)
+ (with-no-warnings
(inactivate-input-method)))))
;;; Simple Commands
@@ -5931,16 +5931,16 @@ With optional argument ARG, also reload the style
hooks."
(interactive "*P")
(if arg
(setq TeX-style-hook-list nil
- BibTeX-global-style-files nil
- BibTeX-global-files nil
- BibLaTeX-global-style-files nil
- TeX-Biber-global-files nil
- TeX-global-input-files nil
- LaTeX-global-class-files nil
- LaTeX-includegraphics-global-files nil))
+ BibTeX-global-style-files nil
+ BibTeX-global-files nil
+ BibLaTeX-global-style-files nil
+ TeX-Biber-global-files nil
+ TeX-global-input-files nil
+ LaTeX-global-class-files nil
+ LaTeX-includegraphics-global-files nil))
(let ((TeX-auto-save t))
(if (buffer-modified-p)
- (save-buffer)
+ (save-buffer)
(TeX-auto-write)))
(normal-mode)
;; See also addition to `find-file-hook' in `VirTeX-common-initialization'.
@@ -5981,20 +5981,20 @@ valid languages."
:group 'TeX-quote
:link '(custom-manual "(auctex)European")
:type '(repeat (group (choice
- (const "czech")
- (const "danish")
- (const "dutch")
- (const "german")
- (const "ngerman")
- (const "french") ;; not frenchb or francais
- (const "italian")
- (const "polish")
- (const "slovak")
- (const "swedish")
- (string :tag "Other Language"))
- (choice :tag "Opening quotation mark" string function)
- (choice :tag "Closing quotation mark" string function)
- (boolean :tag "Insert plain quote first" :value t))))
+ (const "czech")
+ (const "danish")
+ (const "dutch")
+ (const "german")
+ (const "ngerman")
+ (const "french") ;; not frenchb or francais
+ (const "italian")
+ (const "polish")
+ (const "slovak")
+ (const "swedish")
+ (string :tag "Other Language"))
+ (choice :tag "Opening quotation mark" string function)
+ (choice :tag "Closing quotation mark" string function)
+ (boolean :tag "Insert plain quote first" :value t))))
(defvar TeX-quote-language nil
"If non-nil determines behavior of quote insertion.
@@ -6014,80 +6014,80 @@ is non-nil, this insertion works only after \".
With prefix argument FORCE, always inserts \" characters."
(interactive "*P")
(if (or force
- ;; Do not insert TeX quotes in verbatim, math or comment constructs.
- (and (fboundp 'font-latex-faces-present-p)
- (font-latex-faces-present-p '(font-latex-verbatim-face
- font-latex-math-face
- font-lock-comment-face))
- (font-latex-faces-present-p '(font-latex-verbatim-face
- font-latex-math-face
- font-lock-comment-face)
- (1- (point))))
- (texmathp)
- (and (TeX-in-comment) (not (eq major-mode 'doctex-mode))))
+ ;; Do not insert TeX quotes in verbatim, math or comment constructs.
+ (and (fboundp 'font-latex-faces-present-p)
+ (font-latex-faces-present-p '(font-latex-verbatim-face
+ font-latex-math-face
+ font-lock-comment-face))
+ (font-latex-faces-present-p '(font-latex-verbatim-face
+ font-latex-math-face
+ font-lock-comment-face)
+ (1- (point))))
+ (texmathp)
+ (and (TeX-in-comment) (not (eq major-mode 'doctex-mode))))
(self-insert-command (prefix-numeric-value force))
(TeX-update-style)
(let* ((lang-override (if (eq (car TeX-quote-language) 'override)
- TeX-quote-language
- (assoc (car TeX-quote-language)
- TeX-quote-language-alist)))
- (lang (or lang-override TeX-quote-language))
- (open-quote (if lang (nth 1 lang) TeX-open-quote))
- (close-quote (if lang (nth 2 lang) TeX-close-quote))
- (q-after-q (if lang (nth 3 lang) TeX-quote-after-quote)))
+ TeX-quote-language
+ (assoc (car TeX-quote-language)
+ TeX-quote-language-alist)))
+ (lang (or lang-override TeX-quote-language))
+ (open-quote (if lang (nth 1 lang) TeX-open-quote))
+ (close-quote (if lang (nth 2 lang) TeX-close-quote))
+ (q-after-q (if lang (nth 3 lang) TeX-quote-after-quote)))
(when (functionp open-quote)
- (setq open-quote (funcall open-quote)))
+ (setq open-quote (funcall open-quote)))
(when (functionp close-quote)
- (setq close-quote (funcall close-quote)))
+ (setq close-quote (funcall close-quote)))
(if q-after-q
- (insert (cond ((bobp)
- ?\")
- ((save-excursion
- (TeX-looking-at-backward
- (concat (regexp-quote open-quote) "\\|"
- (regexp-quote close-quote))
- (max (length open-quote) (length close-quote))))
- (delete-char (- (length (match-string 0))))
- "\"\"")
- ((< (save-excursion (skip-chars-backward "\"")) -1)
- ?\")
- ((not (= (preceding-char) ?\"))
- ?\")
- ((save-excursion
- (forward-char -1)
- (bobp))
- (delete-char -1)
- open-quote)
- ((save-excursion
- (forward-char -2) ;;; at -1 there is double quote
- (looking-at "[ \t\n]\\|\\s("))
- (delete-char -1)
- open-quote)
- (t
- (delete-char -1)
- close-quote)))
- (insert (cond ((bobp)
- open-quote)
- ((= (preceding-char) (string-to-char TeX-esc))
- ?\")
- ((= (preceding-char) ?\")
- ?\")
- ((save-excursion
- (forward-char (- (length open-quote)))
- (looking-at (regexp-quote open-quote)))
- (delete-char (- (length open-quote)))
- ?\")
- ((save-excursion
- (forward-char (- (length close-quote)))
- (looking-at (regexp-quote close-quote)))
- (delete-char (- (length close-quote)))
- ?\")
- ((save-excursion
- (forward-char -1)
- (looking-at "[ \t\n]\\|\\s("))
- open-quote)
- (t
- close-quote)))))))
+ (insert (cond ((bobp)
+ ?\")
+ ((save-excursion
+ (TeX-looking-at-backward
+ (concat (regexp-quote open-quote) "\\|"
+ (regexp-quote close-quote))
+ (max (length open-quote) (length close-quote))))
+ (delete-char (- (length (match-string 0))))
+ "\"\"")
+ ((< (save-excursion (skip-chars-backward "\"")) -1)
+ ?\")
+ ((not (= (preceding-char) ?\"))
+ ?\")
+ ((save-excursion
+ (forward-char -1)
+ (bobp))
+ (delete-char -1)
+ open-quote)
+ ((save-excursion
+ (forward-char -2) ;;; at -1 there is double quote
+ (looking-at "[ \t\n]\\|\\s("))
+ (delete-char -1)
+ open-quote)
+ (t
+ (delete-char -1)
+ close-quote)))
+ (insert (cond ((bobp)
+ open-quote)
+ ((= (preceding-char) (string-to-char TeX-esc))
+ ?\")
+ ((= (preceding-char) ?\")
+ ?\")
+ ((save-excursion
+ (forward-char (- (length open-quote)))
+ (looking-at (regexp-quote open-quote)))
+ (delete-char (- (length open-quote)))
+ ?\")
+ ((save-excursion
+ (forward-char (- (length close-quote)))
+ (looking-at (regexp-quote close-quote)))
+ (delete-char (- (length close-quote)))
+ ?\")
+ ((save-excursion
+ (forward-char -1)
+ (looking-at "[ \t\n]\\|\\s("))
+ open-quote)
+ (t
+ close-quote)))))))
(defun TeX-insert-punctuation ()
"Insert point or comma, cleaning up preceding space."
@@ -6108,12 +6108,12 @@ closing brace."
(interactive "P")
(if (TeX-active-mark)
(progn
- (if (< (point) (mark))
- (exchange-point-and-mark))
- (insert TeX-grcl)
- (save-excursion
- (goto-char (mark))
- (insert TeX-grop)))
+ (if (< (point) (mark))
+ (exchange-point-and-mark))
+ (insert TeX-grcl)
+ (save-excursion
+ (goto-char (mark))
+ (insert TeX-grop)))
(insert TeX-grop)
(save-excursion
(if arg (forward-sexp (prefix-numeric-value arg)))
@@ -6136,43 +6136,43 @@ information about your AUCTeX version and AUCTeX
configuration."
"bug-auctex@gnu.org"
AUCTeX-version
(list 'AUCTeX-date
- 'window-system
- 'LaTeX-version
- 'TeX-style-path
- 'TeX-auto-save
- 'TeX-parse-self
- 'TeX-master
- 'TeX-command-list)
+ 'window-system
+ 'LaTeX-version
+ 'TeX-style-path
+ 'TeX-auto-save
+ 'TeX-parse-self
+ 'TeX-master
+ 'TeX-command-list)
nil
;; reporter adds too many new lines around salutation text, that we don't
;; want, since it's itself a new line.
(lambda ()
(save-excursion
- (goto-char (point-min))
- (re-search-forward mail-header-separator)
- (forward-char)
- (delete-char 1)
- (forward-char)
- (delete-char 2)))
+ (goto-char (point-min))
+ (re-search-forward mail-header-separator)
+ (forward-char)
+ (delete-char 1)
+ (forward-char)
+ (delete-char 2)))
(propertize
"\n" 'display
(with-temp-buffer
- (insert
- "Remember to cover the basics, that is, what you expected to happen and
+ (insert
+ "Remember to cover the basics, that is, what you expected to happen
and
what in fact did happen.
Be sure to consult the FAQ section in the manual before submitting
a bug report. In addition check if the bug is reproducable with an
up-to-date version of AUCTeX. So please upgrade to the version
available from ")
- (insert-text-button
- "https://www.gnu.org/software/auctex/"
- 'face 'link
- 'help-echo (concat "mouse-2, RET: Follow this link")
- 'action (lambda (_button)
- (browse-url "https://www.gnu.org/software/auctex/"))
- 'follow-link t)
- (insert " if your
+ (insert-text-button
+ "https://www.gnu.org/software/auctex/"
+ 'face 'link
+ 'help-echo (concat "mouse-2, RET: Follow this link")
+ 'action (lambda (_button)
+ (browse-url "https://www.gnu.org/software/auctex/"))
+ 'follow-link t)
+ (insert " if your
installation is older than the one available from the web site.
If the bug is triggered by a specific \(La\)TeX file, you should try
@@ -6181,16 +6181,16 @@ in your report.
Your report will be posted for the auctex package at the GNU bug
tracker. Visit ")
- (insert-text-button
- "https://debbugs.gnu.org/cgi/pkgreport.cgi?pkg=auctex"
- 'face 'link
- 'help-echo (concat "mouse-2, RET: Follow this link")
- 'action (lambda (_button)
- (browse-url
"https://debbugs.gnu.org/cgi/pkgreport.cgi?pkg=auctex"))
- 'follow-link t)
- (insert "\nto browse existing AUCTeX bugs.
+ (insert-text-button
+ "https://debbugs.gnu.org/cgi/pkgreport.cgi?pkg=auctex"
+ 'face 'link
+ 'help-echo (concat "mouse-2, RET: Follow this link")
+ 'action (lambda (_button)
+ (browse-url
"https://debbugs.gnu.org/cgi/pkgreport.cgi?pkg=auctex"))
+ 'follow-link t)
+ (insert "\nto browse existing AUCTeX bugs.
------------------------------------------------------------------------\n\n")
- (buffer-string))))))
+ (buffer-string))))))
;;; Documentation
@@ -6205,80 +6205,80 @@ package, prompt for selection of the manual of that
package to
show."
(interactive "P")
(let ((pkg (thing-at-point 'symbol))
- buffer list doc)
+ 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
- (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 \
+ ;; 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
+ (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))))))))
+ (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))))))))
(defun TeX-goto-info-page ()
"Read documentation for AUCTeX in the info system."
@@ -6289,32 +6289,32 @@ the number of the file to view, anything else to skip:
") list)))
(defvar TeX-doc-backend-alist
'((texdoc (plain-tex-mode latex-mode doctex-mode ams-tex-mode context-mode)
- (lambda ()
- (when (executable-find "texdoc")
- (TeX-search-files-by-type 'docs 'global t t)))
- (lambda (doc)
- ;; texdoc in MiKTeX requires --view in order to start
- ;; the viewer instead of an intermediate web page.
- (call-process "texdoc" nil 0 nil "--view" doc)))
+ (lambda ()
+ (when (executable-find "texdoc")
+ (TeX-search-files-by-type 'docs 'global t t)))
+ (lambda (doc)
+ ;; texdoc in MiKTeX requires --view in order to start
+ ;; the viewer instead of an intermediate web page.
+ (call-process "texdoc" nil 0 nil "--view" doc)))
(latex-info (latex-mode)
- (lambda ()
- (mapcar (lambda (x)
- (let ((x (car x)))
- (if (string-match "\\`\\\\" x)
- (substring x 1) x)))
- (info-lookup->completions 'symbol 'latex-mode)))
- (lambda (doc)
- (info-lookup-symbol (concat "\\" doc) 'latex-mode)))
+ (lambda ()
+ (mapcar (lambda (x)
+ (let ((x (car x)))
+ (if (string-match "\\`\\\\" x)
+ (substring x 1) x)))
+ (info-lookup->completions 'symbol 'latex-mode)))
+ (lambda (doc)
+ (info-lookup-symbol (concat "\\" doc) 'latex-mode)))
(texinfo-info (texinfo-mode)
- (lambda ()
- (mapcar (lambda (x)
- (let ((x (car x)))
- (if (string-match "\\`@" x)
- (substring x 1) x)))
- (info-lookup->completions 'symbol
- 'texinfo-mode)))
- (lambda (doc)
- (info-lookup-symbol (concat "@" doc) 'texinfo-mode))))
+ (lambda ()
+ (mapcar (lambda (x)
+ (let ((x (car x)))
+ (if (string-match "\\`@" x)
+ (substring x 1) x)))
+ (info-lookup->completions 'symbol
+ 'texinfo-mode)))
+ (lambda (doc)
+ (info-lookup-symbol (concat "@" doc) 'texinfo-mode))))
"Alist of backends used for looking up documentation.
Each item consists of four elements.
@@ -6339,49 +6339,49 @@ NAME may be a package, a command, or a document."
;; Build the lists of available documentation used for completion.
(dolist (elt TeX-doc-backend-alist)
(when (memq major-mode (nth 1 elt))
- (let ((completions (funcall (nth 2 elt))))
- (unless (null completions)
+ (let ((completions (funcall (nth 2 elt))))
+ (unless (null completions)
(cl-pushnew (cons completions (nth 0 elt)) docs :test #'equal)))))
(if (null docs)
- (progn
- (if (executable-find "texdoc")
- ;; Fallback if we did not find anything via the backend list.
- (let ((doc (read-from-minibuffer "Input for `texdoc': ")))
- (when doc (call-process "texdoc" nil 0 nil "--view" doc)))
- ;; Give up.
- (message "No documentation found")))
+ (progn
+ (if (executable-find "texdoc")
+ ;; Fallback if we did not find anything via the backend list.
+ (let ((doc (read-from-minibuffer "Input for `texdoc': ")))
+ (when doc (call-process "texdoc" nil 0 nil "--view" doc)))
+ ;; Give up.
+ (message "No documentation found")))
;; Ask the user about the package, command, or document.
(when (and (called-interactively-p 'any)
- (or (not name) (string= name "")))
- (let ((symbol (thing-at-point 'symbol))
- contained completions)
- ;; Is the symbol at point contained in the lists of available
- ;; documentation?
- (setq contained (catch 'found
- (dolist (elt docs)
- (when (member symbol (car elt))
- (throw 'found t)))))
- ;; Setup completion list in a format suitable for `completing-read'.
- (dolist (elt docs)
- (setq completions (nconc (mapcar 'list (car elt)) completions)))
- ;; Query user.
- (setq name (completing-read
- (if contained
- (format "Package, command, or document (default %s): "
- symbol)
- "Package, command, or document: ")
- completions nil nil nil nil symbol))))
+ (or (not name) (string= name "")))
+ (let ((symbol (thing-at-point 'symbol))
+ contained completions)
+ ;; Is the symbol at point contained in the lists of available
+ ;; documentation?
+ (setq contained (catch 'found
+ (dolist (elt docs)
+ (when (member symbol (car elt))
+ (throw 'found t)))))
+ ;; Setup completion list in a format suitable for `completing-read'.
+ (dolist (elt docs)
+ (setq completions (nconc (mapcar 'list (car elt)) completions)))
+ ;; Query user.
+ (setq name (completing-read
+ (if contained
+ (format "Package, command, or document (default %s):
"
+ symbol)
+ "Package, command, or document: ")
+ completions nil nil nil nil symbol))))
(if (not name)
- (message "No documentation specified")
- ;; XXX: Provide way to choose in case a symbol can be found in
- ;; more than one backend.
- (let* ((backend (catch 'found
- (dolist (elt docs)
- (when (member name (car elt))
- (throw 'found (cdr elt)))))))
- (if backend
- (funcall (nth 3 (assoc backend TeX-doc-backend-alist)) name)
- (message "Documentation not found")))))))
+ (message "No documentation specified")
+ ;; XXX: Provide way to choose in case a symbol can be found in
+ ;; more than one backend.
+ (let* ((backend (catch 'found
+ (dolist (elt docs)
+ (when (member name (car elt))
+ (throw 'found (cdr elt)))))))
+ (if backend
+ (funcall (nth 3 (assoc backend TeX-doc-backend-alist)) name)
+ (message "Documentation not found")))))))
;;; Ispell Support
@@ -6389,16 +6389,16 @@ NAME may be a package, a command, or a document."
(defun TeX-run-ispell (_command _string file)
"Run ispell on current TeX buffer."
(cond ((and (string-equal file (TeX-region-file))
- (fboundp 'ispell-region))
- (call-interactively 'ispell-region))
- ((string-equal file (TeX-region-file))
- (call-interactively 'spell-region))
- ((fboundp 'ispell-buffer)
- (ispell-buffer))
- ((fboundp 'ispell)
- (ispell))
- (t
- (spell-buffer))))
+ (fboundp 'ispell-region))
+ (call-interactively 'ispell-region))
+ ((string-equal file (TeX-region-file))
+ (call-interactively 'spell-region))
+ ((fboundp 'ispell-buffer)
+ (ispell-buffer))
+ ((fboundp 'ispell)
+ (ispell))
+ (t
+ (spell-buffer))))
(defun TeX-ispell-document (name)
"Run ispell on all open files belonging to the current document."
@@ -6407,35 +6407,35 @@ NAME may be a package, a command, or a document."
(setq name (TeX-master-file)))
(let ((regexp (concat "\\`\\("
- (mapconcat (lambda (dir)
- (regexp-quote
- (expand-file-name
- (file-name-as-directory dir))))
- (append (when (file-name-directory name)
- (list (file-name-directory name)))
- TeX-check-path)
- "\\|")
- "\\).*\\("
- (mapconcat 'regexp-quote
- (cons (file-name-nondirectory name)
- (TeX-style-list)) "\\|")
- "\\)\\.\\("
- (mapconcat #'identity TeX-file-extensions "\\|")
- "\\)\\'"))
- (buffers (buffer-list)))
+ (mapconcat (lambda (dir)
+ (regexp-quote
+ (expand-file-name
+ (file-name-as-directory dir))))
+ (append (when (file-name-directory name)
+ (list (file-name-directory name)))
+ TeX-check-path)
+ "\\|")
+ "\\).*\\("
+ (mapconcat 'regexp-quote
+ (cons (file-name-nondirectory name)
+ (TeX-style-list)) "\\|")
+ "\\)\\.\\("
+ (mapconcat #'identity TeX-file-extensions "\\|")
+ "\\)\\'"))
+ (buffers (buffer-list)))
(while buffers
(let* ((buffer (car buffers))
- (name (buffer-file-name buffer)))
- (setq buffers (cdr buffers))
- (when (and name (string-match regexp name))
- (save-excursion (switch-to-buffer buffer) (ispell-buffer))
+ (name (buffer-file-name buffer)))
+ (setq buffers (cdr buffers))
+ (when (and name (string-match regexp name))
+ (save-excursion (switch-to-buffer buffer) (ispell-buffer))
t)))))
;; Some versions of ispell 3 use this.
(defvar ispell-tex-major-modes nil)
(setq ispell-tex-major-modes
(append '(plain-tex-mode ams-tex-mode latex-mode doctex-mode)
- ispell-tex-major-modes))
+ ispell-tex-major-modes))
(defcustom TeX-ispell-extend-skip-list t
"Whether to extend regions selected for skipping during spell checking."
@@ -6452,9 +6452,9 @@ of the car of `ispell-tex-skip-alists'. This only
happens if
`TeX-ispell-extend-skip-list' is non-nil."
(when TeX-ispell-extend-skip-list
(let ((raws (car ispell-tex-skip-alists))
- (envs (cadr ispell-tex-skip-alists)))
+ (envs (cadr ispell-tex-skip-alists)))
(dolist (x skip)
- (cl-pushnew x raws :test #'equal))
+ (cl-pushnew x raws :test #'equal))
(setq ispell-tex-skip-alists (list raws envs)))))
(defun TeX-ispell-skip-setcdr (skip)
@@ -6465,9 +6465,9 @@ of the cdr of `ispell-tex-skip-alists'. This only
happens if
`TeX-ispell-extend-skip-list' is non-nil."
(when TeX-ispell-extend-skip-list
(let ((raws (car ispell-tex-skip-alists))
- (envs (cadr ispell-tex-skip-alists)))
+ (envs (cadr ispell-tex-skip-alists)))
(dolist (x skip)
- (cl-pushnew x envs :test #'equal))
+ (cl-pushnew x envs :test #'equal))
(setq ispell-tex-skip-alists (list raws envs)))))
(defun TeX-ispell-tex-arg-end (&optional arg1 arg2 arg3)
@@ -6489,30 +6489,30 @@ following. Omitting argument means 1.
Here some examples for additions to `ispell-tex-skip-alists':
\\begin{tabularx}{300pt}[t]{lrc} ...
- ARG 1 2 3
+ ARG 1 2 3
(\"tabularx\" TeX-ispell-tex-arg-end) or equivalent
(\"tabularx\" TeX-ispell-tex-arg-end 1 1 1)
\\fontspec{font name}[font features]
- ARG1 ARG2 ARG3=0
+ ARG1 ARG2 ARG3=0
(\"\\\\\\\\fontspec\" TeX-ispell-tex-arg-end 1 1 0)
\\raisebox{lift}[height][depth]{contents}
- ARG1 ARG2 ARG3=0 (checked by Ispell)
+ ARG1 ARG2 ARG3=0 (checked by Ispell)
(\"\\\\\\\\raisebox\" TeX-ispell-tex-arg-end 1 2 0)
Optional arguments before the first mandatory one are all
skipped."
(condition-case nil
(progn
- (while (looking-at "[ \t\n]*\\[") (forward-sexp))
- (forward-sexp (or arg1 1))
- (let ((num 0))
- (while (and (looking-at "[ \t\n]*\\[")
- (< num (or arg2 1)))
- (setq num (1+ num))
- (forward-sexp)))
- (forward-sexp (or arg3 1)))
+ (while (looking-at "[ \t\n]*\\[") (forward-sexp))
+ (forward-sexp (or arg1 1))
+ (let ((num 0))
+ (while (and (looking-at "[ \t\n]*\\[")
+ (< num (or arg2 1)))
+ (setq num (1+ num))
+ (forward-sexp)))
+ (forward-sexp (or arg3 1)))
(error
(message "Error skipping s-expressions at point %d" (point))
(sit-for 2))))
@@ -6527,19 +6527,19 @@ in `TeX-ispell-verb-delimiters' or in braces, otherwise
raises an
error."
(condition-case nil
(progn
- (when (looking-at "[ \t\n]*\\[") (forward-sexp))
- (when (and arg (looking-at "{"))
- (forward-sexp arg))
- (cond ((looking-at (concat "[" TeX-ispell-verb-delimiters "]"))
- (forward-char)
- (skip-chars-forward (concat "^" (string (char-before))))
- (forward-char))
- ((looking-at "{")
- (forward-sexp))
- (t (error nil))))
+ (when (looking-at "[ \t\n]*\\[") (forward-sexp))
+ (when (and arg (looking-at "{"))
+ (forward-sexp arg))
+ (cond ((looking-at (concat "[" TeX-ispell-verb-delimiters "]"))
+ (forward-char)
+ (skip-chars-forward (concat "^" (string (char-before))))
+ (forward-char))
+ ((looking-at "{")
+ (forward-sexp))
+ (t (error nil))))
(error
(message "Verbatim delimiter is not one of %s"
- (split-string TeX-ispell-verb-delimiters "" t))
+ (split-string TeX-ispell-verb-delimiters "" t))
(sit-for 2))))
;;; Abbrev mode
@@ -6547,13 +6547,13 @@ error."
(defmacro TeX-abbrev-mode-setup (mode)
"Set up the abbrev table and variable for MODE."
(let ((symbol (intern (concat (symbol-name mode) "-abbrev-table")))
- (name (TeX-mode-prefix mode)))
+ (name (TeX-mode-prefix mode)))
`(progn
(defvar ,symbol nil
- ,(format "Abbrev table for %s mode." name))
+ ,(format "Abbrev table for %s mode." name))
(define-abbrev-table ',symbol nil)
(when (fboundp 'abbrev-table-put)
- (abbrev-table-put ,symbol :parents (list text-mode-abbrev-table))))))
+ (abbrev-table-put ,symbol :parents (list text-mode-abbrev-table))))))
;;; Special provisions for other modes and libraries
@@ -6564,10 +6564,10 @@ error."
'(progn
(dolist (elt '(TeX-master))
(unless (member elt (default-value 'desktop-locals-to-save))
- (setq-default desktop-locals-to-save
- (cons elt (default-value 'desktop-locals-to-save)))))
+ (setq-default desktop-locals-to-save
+ (cons elt (default-value 'desktop-locals-to-save)))))
(add-hook 'desktop-after-read-hook '(lambda ()
- (TeX-set-mode-name t)))))
+ (TeX-set-mode-name t)))))
;; delsel.el, `delete-selection-mode'
(put 'TeX-newline 'delete-selection t)
@@ -6581,20 +6581,20 @@ error."
;; dynamicity has been introduced in Emacs 24.3, for previous versions keep
;; `TeX-insert-dollar' without this property.
(if (or (> emacs-major-version 24)
- (and (= emacs-major-version 24)
- (>= emacs-minor-version 3)))
+ (and (= emacs-major-version 24)
+ (>= emacs-minor-version 3)))
(put 'TeX-insert-dollar 'delete-selection
- (lambda () (null TeX-electric-math))))
+ (lambda () (null TeX-electric-math))))
(defun TeX--list-of-string-p (lst)
"Return non-nil iff `LST' is a list of strings.
Used as function for validating a variable's `safe-local-variable' property."
(and (listp lst)
(let ((all-strings t))
- (while (and all-strings lst)
- (setq all-strings (stringp (car lst)))
- (setq lst (cdr lst)))
- all-strings)))
+ (while (and all-strings lst)
+ (setq all-strings (stringp (car lst)))
+ (setq lst (cdr lst)))
+ all-strings)))
;; add-log.el: This function is a variation of
;; `tex-current-defun-name' defined in `tex-mode.el'. In `latex.el',
@@ -6619,7 +6619,7 @@ Used as function for validating a variable's
`safe-local-variable' property."
(when (re-search-backward
(if (local-variable-p 'LaTeX-section-label)
(concat "\\\\"
- (regexp-opt
+ (regexp-opt
(remove "part" (mapcar #'car LaTeX-section-label)))
"\\*?")
"\\\\\\(sub\\)*\\(section\\|paragraph\\|chapter\\)\\*?")
- [elpa] externals/auctex updated (b7c3a5f -> 0844fa2), Tassilo Horn, 2020/12/29
- [elpa] externals/auctex b4d5367 1/7: Indent additional texts, Tassilo Horn, 2020/12/29
- [elpa] externals/auctex a402058 2/7: * .dir-locals.el: Add new file., Tassilo Horn, 2020/12/29
- [elpa] externals/auctex a98121b 3/7: Untabify tex.el.,
Tassilo Horn <=
- [elpa] externals/auctex c8d5756 4/7: URI-encode ? in filename to %3F (bug#45510), Tassilo Horn, 2020/12/29
- [elpa] externals/auctex 700839d 5/7: Convert tabs to spaces in all lisp files according to .dir-locals.el, Tassilo Horn, 2020/12/29
- [elpa] externals/auctex d4165cf 6/7: Convert tabs to spaces in all *.el.in files according to .dir-locals.el, Tassilo Horn, 2020/12/29
- [elpa] externals/auctex 0844fa2 7/7: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2020/12/29