-;;; tex-mode.el --- TeX, LaTeX, and SliTeX mode commands -*- coding: utf-8 -*-
+;;; tex-mode.el --- TeX, LaTeX, and SliTeX mode commands -*- lexical-binding:t -*-
-;; Copyright (C) 1985-1986, 1989, 1992, 1994-1999, 2001-2015 Free
+;; Copyright (C) 1985-1986, 1989, 1992, 1994-1999, 2001-2016 Free
;; Software Foundation, Inc.
;; Maintainer: emacs-devel@gnu.org
for example,
(setq tex-alt-dvi-print-command
- '(format \"lpr -P%s\" (read-string \"Use printer: \")))
+ \\='(format \"lpr -P%s\" (read-string \"Use printer: \")))
would tell \\[tex-print] with a prefix argument to ask you which printer to
use."
(match-end 1))
latex-section-alist))))
(backward-char 1)
- (condition-case err
+ (condition-case nil
(progn
;; Using sexps allows some use of matching {...} inside
;; titles.
,@tex-face-alist)
"Alist of face and LaTeX font name for facemenu.")
-(defun tex-facemenu-add-face-function (face end)
+(defun tex-facemenu-add-face-function (face _end)
(or (cdr (assq face tex-face-alist))
(or (and (consp face)
(consp (car face))
(display-buffer (tex-shell-buf))
(tex-recenter-output-buffer nil))
-(defun tex-shell-sentinel (proc msg)
+(defun tex-shell-sentinel (proc _msg)
(cond ((null (buffer-name (process-buffer proc)))
;; buffer killed
(set-process-buffer proc nil)
st)
"Syntax table used while computing indentation.")
-(defun latex-indent (&optional arg)
+(defun latex-indent (&optional _arg)
(if (and (eq (get-text-property (if (and (eobp) (bolp))
(max (point-min) (1- (point)))
- (line-beginning-position)) 'face)
+ (line-beginning-position))
+ 'face)
'tex-verbatim))
'noindent
(with-syntax-table tex-latex-indent-syntax-table
("\\beta" . ?β)
("\\gamma" . ?γ)
("\\delta" . ?δ)
- ("\\epsilon" . ?ε)
+ ("\\epsilon" . ?ϵ)
("\\zeta" . ?ζ)
("\\eta" . ?η)
("\\theta" . ?θ)
("\\rightthreetimes" . ?⋌)
("\\risingdotseq" . ?≓)
("\\rtimes" . ?⋊)
+ ("\\times" . ?×)
("\\sbs" . ?﹨)
("\\searrow" . ?↘)
("\\setminus" . ?∖)
("\\urcorner" . ?⌝)
("\\u{i}" . ?ĭ)
("\\vDash" . ?⊨)
+ ("\\varepsilon" . ?ε)
("\\varprime" . ?′)
("\\varpropto" . ?∝)
("\\varrho" . ?ϱ)
("\\wr" . ?≀)
("\\Bbb{N}" . ?ℕ) ; AMS commands for blackboard bold
("\\Bbb{P}" . ?ℙ) ; Also sometimes \mathbb.
+ ("\\Bbb{Q}" . ?ℚ)
("\\Bbb{R}" . ?ℝ)
("\\Bbb{Z}" . ?ℤ)
("--" . ?–)
("\\textreferencemark" . ?※))
"A `prettify-symbols-alist' usable for (La)TeX modes.")
-(defun tex--prettify-symbols-compose-p (start end _match)
- (let* ((after-char (char-after end))
- (after-syntax (char-syntax after-char)))
- (not (or
- ;; Don't compose \alpha@foo.
- (eq after-syntax ?_)
- ;; Don't compose inside verbatim blocks!
- (nth 8 (syntax-ppss))
- ;; The \alpha in \alpha2 may be composed but of course \alphax may not.
- (and (eq after-syntax ?w)
- (or (< after-char ?0)
- (> after-char ?9)))))))
+(defun tex--prettify-symbols-compose-p (_start end _match)
+ (or
+ ;; If the matched symbol doesn't end in a word character, then we
+ ;; simply allow composition. The symbol is probably something like
+ ;; \|, \(, etc.
+ (not (eq ?w (char-syntax (char-before end))))
+ ;; Else we look at what follows the match in order to decide.
+ (let* ((after-char (char-after end))
+ (after-syntax (char-syntax after-char)))
+ (not (or
+ ;; Don't compose \alpha@foo.
+ (eq after-char ?@)
+ ;; The \alpha in \alpha2 or \alpha-\beta may be composed but
+ ;; of course \alphax may not.
+ (and (eq after-syntax ?w)
+ (not (memq after-char
+ '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?+ ?- ?' ?\"))))
+ ;; Don't compose inside verbatim blocks.
+ (eq 2 (nth 7 (syntax-ppss))))))))
(run-hooks 'tex-mode-load-hook)