diff options
| author | Stefan Monnier | 2004-10-03 19:53:23 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-10-03 19:53:23 +0000 |
| commit | dd166d5fa1712b0dda35859c91d89666c2873471 (patch) | |
| tree | aa170d8785d9e943f103750a6c03b15b5b21ed65 | |
| parent | 38fe4f64eda50ce65c8108c4aff665b037358a80 (diff) | |
| download | emacs-dd166d5fa1712b0dda35859c91d89666c2873471.tar.gz emacs-dd166d5fa1712b0dda35859c91d89666c2873471.zip | |
(tex-dvi-view-command): Use `yap' on w32.
(tex-font-lock-keywords-1): Add url and nolinkurl for args with `_'.
(latex-block-args-alist): Add minipage and picture.
(latex-block-body-alist): Use reftex-label if enabled.
(latex-insert-block): Don't insert a \n if not necessary.
(tex-compile-commands): Make sure dvips doesn't send to printer.
(tex-compile-default): Handle the case where no executable is found.
(latex-noindent-environments): New var.
(latex-find-indent): Use it. Take an empty line as an arg-breaker.
If tex-indent-allhanging is non-nil, make sure we only align for macros
at beginning of line.
| -rw-r--r-- | lisp/ChangeLog | 23 | ||||
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 74 |
2 files changed, 73 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d80e70510c0..29abaaf21b8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,7 +1,21 @@ | |||
| 1 | 2004-10-03 Stefan <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * textmodes/tex-mode.el (tex-dvi-view-command): Use `yap' on w32. | ||
| 4 | (tex-font-lock-keywords-1): Add url and nolinkurl for args with `_'. | ||
| 5 | (latex-block-args-alist): Add minipage and picture. | ||
| 6 | (latex-block-body-alist): Use reftex-label if enabled. | ||
| 7 | (latex-insert-block): Don't insert a \n if not necessary. | ||
| 8 | (tex-compile-commands): Make sure dvips doesn't send to printer. | ||
| 9 | (tex-compile-default): Handle the case where no executable is found. | ||
| 10 | (latex-noindent-environments): New var. | ||
| 11 | (latex-find-indent): Use it. Take an empty line as an arg-breaker. | ||
| 12 | If tex-indent-allhanging is non-nil, make sure we only align for macros | ||
| 13 | at beginning of line. | ||
| 14 | |||
| 1 | 2004-10-03 Daniel Pfeiffer <occitan@esperanto.org> | 15 | 2004-10-03 Daniel Pfeiffer <occitan@esperanto.org> |
| 2 | 16 | ||
| 3 | * newcomment.el (comment-beginning): Doc fix and don't choke on | 17 | * newcomment.el (comment-beginning): Doc fix and don't choke on |
| 4 | unset `comment-end-skip' when at beginning of comment | 18 | unset `comment-end-skip' when at beginning of comment. |
| 5 | 19 | ||
| 6 | 2004-10-02 Dan Nicolaescu <dann@ics.uci.edu> | 20 | 2004-10-02 Dan Nicolaescu <dann@ics.uci.edu> |
| 7 | 21 | ||
| @@ -11,8 +25,7 @@ | |||
| 11 | the end of the line. Fix scroll down. Add comments. | 25 | the end of the line. Fix scroll down. Add comments. |
| 12 | (term-handle-ansi-escape): Don't exceed terminal width when moving | 26 | (term-handle-ansi-escape): Don't exceed terminal width when moving |
| 13 | right. | 27 | right. |
| 14 | (term-scroll-region): Move the cursor after setting the scroll | 28 | (term-scroll-region): Move the cursor after setting the scroll region. |
| 15 | region. | ||
| 16 | 29 | ||
| 17 | 2004-10-01 Luc Teirlinck <teirllm@auburn.edu> | 30 | 2004-10-01 Luc Teirlinck <teirllm@auburn.edu> |
| 18 | 31 | ||
| @@ -38,8 +51,8 @@ | |||
| 38 | 51 | ||
| 39 | 2004-09-29 Luc Teirlinck <teirllm@auburn.edu> | 52 | 2004-09-29 Luc Teirlinck <teirllm@auburn.edu> |
| 40 | 53 | ||
| 41 | * textmodes/paragraphs.el (forward-paragraph): Avoid | 54 | * textmodes/paragraphs.el (forward-paragraph): |
| 42 | args-out-of-range error when point winds up at the beginning of | 55 | Avoid args-out-of-range error when point winds up at the beginning of |
| 43 | the buffer and hard newlines are enabled. | 56 | the buffer and hard newlines are enabled. |
| 44 | 57 | ||
| 45 | * newcomment.el (comment-multi-line): Doc fix. | 58 | * newcomment.el (comment-multi-line): Doc fix. |
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 1c4b89f0a62..2a9059e2f56 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; tex-mode.el --- TeX, LaTeX, and SliTeX mode commands -*- coding: utf-8 -*- | 1 | ;;; tex-mode.el --- TeX, LaTeX, and SliTeX mode commands -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985,86,89,92,94,95,96,97,98,1999,2002,03,2004 | 3 | ;; Copyright (C) 1985, 1986, 1989, 1992, 1994, 1995, 1996, 1997, 1998, 1999, |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; 2002, 2003, 2004 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Maintainer: FSF | 6 | ;; Maintainer: FSF |
| 7 | ;; Keywords: tex | 7 | ;; Keywords: tex |
| @@ -196,7 +196,11 @@ use." | |||
| 196 | :group 'tex-view) | 196 | :group 'tex-view) |
| 197 | 197 | ||
| 198 | ;;;###autoload | 198 | ;;;###autoload |
| 199 | (defcustom tex-dvi-view-command '(if (eq window-system 'x) "xdvi" "dvi2tty * | cat -s") | 199 | (defcustom tex-dvi-view-command |
| 200 | '(cond | ||
| 201 | ((eq window-system 'x) "xdvi") | ||
| 202 | ((eq window-system 'w32) "yap") | ||
| 203 | (t "dvi2tty * | cat -s")) | ||
| 200 | "*Command used by \\[tex-view] to display a `.dvi' file. | 204 | "*Command used by \\[tex-view] to display a `.dvi' file. |
| 201 | If it is a string, that specifies the command directly. | 205 | If it is a string, that specifies the command directly. |
| 202 | If this string contains an asterisk (`*'), that is replaced by the file name; | 206 | If this string contains an asterisk (`*'), that is replaced by the file name; |
| @@ -453,7 +457,8 @@ An alternative value is \" . \", if you use a font with a narrow period." | |||
| 453 | '("input" "include" "includeonly" "bibliography" | 457 | '("input" "include" "includeonly" "bibliography" |
| 454 | "epsfig" "psfig" "epsf" "nofiles" "usepackage" | 458 | "epsfig" "psfig" "epsf" "nofiles" "usepackage" |
| 455 | "documentstyle" "documentclass" "verbatiminput" | 459 | "documentstyle" "documentclass" "verbatiminput" |
| 456 | "includegraphics" "includegraphics*") | 460 | "includegraphics" "includegraphics*" |
| 461 | "url" "nolinkurl") | ||
| 457 | t)) | 462 | t)) |
| 458 | ;; Miscellany. | 463 | ;; Miscellany. |
| 459 | (slash "\\\\") | 464 | (slash "\\\\") |
| @@ -771,8 +776,10 @@ Inherits `shell-mode-map' with a few additions.") | |||
| 771 | "part" "chapter" "newcommand" | 776 | "part" "chapter" "newcommand" |
| 772 | "renewcommand") 'words) | 777 | "renewcommand") 'words) |
| 773 | "\\|NeedsTeXFormat{LaTeX"))) | 778 | "\\|NeedsTeXFormat{LaTeX"))) |
| 774 | (if (looking-at | 779 | (if (and (looking-at |
| 775 | "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}") | 780 | "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}") |
| 781 | ;; SliTeX is almost never used any more nowadays. | ||
| 782 | (tex-executable-exists-p slitex-run-command)) | ||
| 776 | 'slitex-mode | 783 | 'slitex-mode |
| 777 | 'latex-mode) | 784 | 'latex-mode) |
| 778 | 'plain-tex-mode)))) | 785 | 'plain-tex-mode)))) |
| @@ -1219,8 +1226,13 @@ A prefix arg inhibits the checking." | |||
| 1219 | (defvar latex-block-default "enumerate") | 1226 | (defvar latex-block-default "enumerate") |
| 1220 | 1227 | ||
| 1221 | (defvar latex-block-args-alist | 1228 | (defvar latex-block-args-alist |
| 1222 | '(("array" nil ?\{ (skeleton-read "[options]: ") ?\}) | 1229 | '(("array" nil ?\{ (skeleton-read "Format: ") ?\}) |
| 1223 | ("tabular" nil ?\{ (skeleton-read "[options]: ") ?\})) | 1230 | ("tabular" nil ?\{ (skeleton-read "Format: ") ?\}) |
| 1231 | ("minipage" nil ?\{ (skeleton-read "Size: ") ?\}) | ||
| 1232 | ("picture" nil ?\( (skeleton-read "SizeX,SizeY: ") ?\)) | ||
| 1233 | ;; FIXME: This is right for Prosper, but not for seminar. | ||
| 1234 | ;; ("slide" nil ?\{ (skeleton-read "Title: ") ?\}) | ||
| 1235 | ) | ||
| 1224 | "Skeleton element to use for arguments to particular environments. | 1236 | "Skeleton element to use for arguments to particular environments. |
| 1225 | Every element of the list has the form (NAME . SKEL-ELEM) where NAME is | 1237 | Every element of the list has the form (NAME . SKEL-ELEM) where NAME is |
| 1226 | the name of the environment and SKEL-ELEM is an element to use in | 1238 | the name of the environment and SKEL-ELEM is an element to use in |
| @@ -1229,8 +1241,11 @@ a skeleton (see `skeleton-insert').") | |||
| 1229 | (defvar latex-block-body-alist | 1241 | (defvar latex-block-body-alist |
| 1230 | '(("enumerate" nil '(latex-insert-item) > _) | 1242 | '(("enumerate" nil '(latex-insert-item) > _) |
| 1231 | ("itemize" nil '(latex-insert-item) > _) | 1243 | ("itemize" nil '(latex-insert-item) > _) |
| 1232 | ("table" nil "\\caption{" > - "}" > \n _) | 1244 | ("table" nil "\\caption{" > (skeleton-read "Caption: ") "}" > \n |
| 1233 | ("figure" nil > _ \n "\\caption{" > _ "}" >)) | 1245 | '(if (and (boundp 'reftex-mode) reftex-mode) (reftex-label "table")) |
| 1246 | \n _) | ||
| 1247 | ("figure" nil > _ \n "\\caption{" > (skeleton-read "Caption: ") "}" > \n | ||
| 1248 | '(if (and (boundp 'reftex-mode) reftex-mode) (reftex-label "table")))) | ||
| 1234 | "Skeleton element to use for the body of particular environments. | 1249 | "Skeleton element to use for the body of particular environments. |
| 1235 | Every element of the list has the form (NAME . SKEL-ELEM) where NAME is | 1250 | Every element of the list has the form (NAME . SKEL-ELEM) where NAME is |
| 1236 | the name of the environment and SKEL-ELEM is an element to use in | 1251 | the name of the environment and SKEL-ELEM is an element to use in |
| @@ -1254,7 +1269,8 @@ Puts point on a blank line between them." | |||
| 1254 | choice) | 1269 | choice) |
| 1255 | \n "\\begin{" str "}" | 1270 | \n "\\begin{" str "}" |
| 1256 | (cdr (assoc str latex-block-args-alist)) | 1271 | (cdr (assoc str latex-block-args-alist)) |
| 1257 | > \n (or (cdr (assoc str latex-block-body-alist)) '(nil > _)) \n | 1272 | > \n (or (cdr (assoc str latex-block-body-alist)) '(nil > _)) |
| 1273 | (unless (bolp) '\n) | ||
| 1258 | "\\end{" str "}" > \n) | 1274 | "\\end{" str "}" > \n) |
| 1259 | 1275 | ||
| 1260 | (define-skeleton latex-insert-item | 1276 | (define-skeleton latex-insert-item |
| @@ -1598,7 +1614,7 @@ If NOT-ALL is non-nil, save the `.dvi' file." | |||
| 1598 | ("texindex %r.??") | 1614 | ("texindex %r.??") |
| 1599 | ("dvipdfm %r" "%r.dvi" "%r.pdf") | 1615 | ("dvipdfm %r" "%r.dvi" "%r.pdf") |
| 1600 | ("dvipdf %r" "%r.dvi" "%r.pdf") | 1616 | ("dvipdf %r" "%r.dvi" "%r.pdf") |
| 1601 | ("dvips %r" "%r.dvi" "%r.ps") | 1617 | ("dvips -o %r.ps %r" "%r.dvi" "%r.ps") |
| 1602 | ("ps2pdf %r.ps" "%r.ps" "%r.pdf") | 1618 | ("ps2pdf %r.ps" "%r.ps" "%r.pdf") |
| 1603 | ("gv %r.ps &" "%r.ps") | 1619 | ("gv %r.ps &" "%r.ps") |
| 1604 | ("gv %r.pdf &" "%r.pdf") | 1620 | ("gv %r.pdf &" "%r.pdf") |
| @@ -1767,7 +1783,7 @@ FILE is typically the output DVI or PDF file." | |||
| 1767 | (not (tex-uptodate-p (format-spec out fspec))))))) | 1783 | (not (tex-uptodate-p (format-spec out fspec))))))) |
| 1768 | 1784 | ||
| 1769 | (defun tex-compile-default (fspec) | 1785 | (defun tex-compile-default (fspec) |
| 1770 | "Guess a default command given the format-spec FSPEC." | 1786 | "Guess a default command given the `format-spec' FSPEC." |
| 1771 | ;; TODO: Learn to do latex+dvips! | 1787 | ;; TODO: Learn to do latex+dvips! |
| 1772 | (let ((cmds nil) | 1788 | (let ((cmds nil) |
| 1773 | (unchanged-in nil)) | 1789 | (unchanged-in nil)) |
| @@ -1777,6 +1793,9 @@ FILE is typically the output DVI or PDF file." | |||
| 1777 | (if (tex-command-active-p cmd fspec) | 1793 | (if (tex-command-active-p cmd fspec) |
| 1778 | (push cmd cmds) | 1794 | (push cmd cmds) |
| 1779 | (push (nth 1 cmd) unchanged-in)))) | 1795 | (push (nth 1 cmd) unchanged-in)))) |
| 1796 | ;; If no command seems to be applicable, arbitrarily pick the first one. | ||
| 1797 | (unless cmds | ||
| 1798 | (setq cmds (list (car tex-compile-commands)))) | ||
| 1780 | ;; Remove those commands whose input was considered stable for | 1799 | ;; Remove those commands whose input was considered stable for |
| 1781 | ;; some other command (typically if (t . "%.pdf") is inactive | 1800 | ;; some other command (typically if (t . "%.pdf") is inactive |
| 1782 | ;; then we're using pdflatex and the fact that the dvi file | 1801 | ;; then we're using pdflatex and the fact that the dvi file |
| @@ -2261,6 +2280,7 @@ Runs the shell command defined by `tex-show-queue-command'." | |||
| 2261 | (defvar tex-indent-basic 2) | 2280 | (defvar tex-indent-basic 2) |
| 2262 | (defvar tex-indent-item tex-indent-basic) | 2281 | (defvar tex-indent-item tex-indent-basic) |
| 2263 | (defvar tex-indent-item-re "\\\\\\(bib\\)?item\\>") | 2282 | (defvar tex-indent-item-re "\\\\\\(bib\\)?item\\>") |
| 2283 | (defvar latex-noindent-environments '("document")) | ||
| 2264 | 2284 | ||
| 2265 | (defvar tex-latex-indent-syntax-table | 2285 | (defvar tex-latex-indent-syntax-table |
| 2266 | (let ((st (make-syntax-table tex-mode-syntax-table))) | 2286 | (let ((st (make-syntax-table tex-mode-syntax-table))) |
| @@ -2311,7 +2331,6 @@ There might be text before point." | |||
| 2311 | (latex-find-indent 'virtual)))) | 2331 | (latex-find-indent 'virtual)))) |
| 2312 | ;; Default (maybe an argument) | 2332 | ;; Default (maybe an argument) |
| 2313 | (let ((pos (point)) | 2333 | (let ((pos (point)) |
| 2314 | (char (char-after)) | ||
| 2315 | ;; Outdent \item if necessary. | 2334 | ;; Outdent \item if necessary. |
| 2316 | (indent (if (looking-at tex-indent-item-re) (- tex-indent-item) 0)) | 2335 | (indent (if (looking-at tex-indent-item-re) (- tex-indent-item) 0)) |
| 2317 | up-list-pos) | 2336 | up-list-pos) |
| @@ -2329,6 +2348,17 @@ There might be text before point." | |||
| 2329 | ;; Have to indent relative to the open-paren. | 2348 | ;; Have to indent relative to the open-paren. |
| 2330 | (goto-char up-list-pos) | 2349 | (goto-char up-list-pos) |
| 2331 | (if (and (not tex-indent-allhanging) | 2350 | (if (and (not tex-indent-allhanging) |
| 2351 | (save-excursion | ||
| 2352 | ;; Make sure we're an argument to a macro and | ||
| 2353 | ;; that the macro is at the beginning of a line. | ||
| 2354 | (condition-case nil | ||
| 2355 | (progn | ||
| 2356 | (while (eq (char-syntax (char-after)) ?\() | ||
| 2357 | (forward-sexp -1)) | ||
| 2358 | (and (eq (char-syntax (char-after)) ?/) | ||
| 2359 | (progn (skip-chars-backward " \t&") | ||
| 2360 | (bolp)))) | ||
| 2361 | (scan-error nil))) | ||
| 2332 | (> pos (progn (latex-down-list) | 2362 | (> pos (progn (latex-down-list) |
| 2333 | (forward-comment (point-max)) | 2363 | (forward-comment (point-max)) |
| 2334 | (point)))) | 2364 | (point)))) |
| @@ -2336,18 +2366,24 @@ There might be text before point." | |||
| 2336 | (current-column) | 2366 | (current-column) |
| 2337 | ;; We're the first element after a hanging brace. | 2367 | ;; We're the first element after a hanging brace. |
| 2338 | (goto-char up-list-pos) | 2368 | (goto-char up-list-pos) |
| 2339 | (+ indent tex-indent-basic (latex-find-indent 'virtual)))) | 2369 | (+ (if (and (looking-at "\\\\begin *{\\([^\n}]+\\)") |
| 2370 | (member (match-string 1) | ||
| 2371 | latex-noindent-environments)) | ||
| 2372 | 0 tex-indent-basic) | ||
| 2373 | indent (latex-find-indent 'virtual)))) | ||
| 2340 | ;; We're now at the "beginning" of a line. | 2374 | ;; We're now at the "beginning" of a line. |
| 2341 | ((not (and (not virtual) (eq (char-after) ?\\))) | 2375 | ((not (and (not virtual) (eq (char-after) ?\\))) |
| 2342 | ;; Nothing particular here: just keep the same indentation. | 2376 | ;; Nothing particular here: just keep the same indentation. |
| 2343 | (+ indent (current-column))) | 2377 | (+ indent (current-column))) |
| 2344 | ;; We're now looking at a macro call. | 2378 | ;; We're now looking at a macro call. |
| 2345 | ((looking-at tex-indent-item-re) | 2379 | ((looking-at tex-indent-item-re) |
| 2346 | ;; Indenting relative to an item, have to re-add the outdenting. | 2380 | ;; Indenting relative to an item, have to re-add the outdenting. |
| 2347 | (+ indent (current-column) tex-indent-item)) | 2381 | (+ indent (current-column) tex-indent-item)) |
| 2348 | (t | 2382 | (t |
| 2349 | (let ((col (current-column))) | 2383 | (let ((col (current-column))) |
| 2350 | (if (or (null char) (not (eq (char-syntax char) ?\())) | 2384 | (if (or (not (eq (char-syntax (or (char-after pos) ?\ )) ?\()) |
| 2385 | ;; Can't be an arg if there's an empty line inbetween. | ||
| 2386 | (save-excursion (re-search-forward "^[ \t]*$" pos t))) | ||
| 2351 | ;; If the first char was not an open-paren, there's | 2387 | ;; If the first char was not an open-paren, there's |
| 2352 | ;; a risk that this is really not an argument to the | 2388 | ;; a risk that this is really not an argument to the |
| 2353 | ;; macro at all. | 2389 | ;; macro at all. |
| @@ -2422,5 +2458,5 @@ There might be text before point." | |||
| 2422 | 2458 | ||
| 2423 | (provide 'tex-mode) | 2459 | (provide 'tex-mode) |
| 2424 | 2460 | ||
| 2425 | ;;; arch-tag: c0a680b1-63aa-4547-84b9-4193c29c0080 | 2461 | ;; arch-tag: c0a680b1-63aa-4547-84b9-4193c29c0080 |
| 2426 | ;;; tex-mode.el ends here | 2462 | ;;; tex-mode.el ends here |