diff options
| author | Stefan Monnier | 2000-11-22 21:38:04 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-11-22 21:38:04 +0000 |
| commit | 1598a9616b673651a8cc3905c0c98dc253e899e9 (patch) | |
| tree | 3701381d4b34f1ffb8974f8aff47337d8c63326f | |
| parent | 0c6456adc8dfe36a4f27ebbc8ea19d587eced653 (diff) | |
| download | emacs-1598a9616b673651a8cc3905c0c98dc253e899e9.tar.gz emacs-1598a9616b673651a8cc3905c0c98dc253e899e9.zip | |
(tex-font-lock-keywords-1): Fix ARG regexp to skip quoted braces.
(tex-font-lock-keywords-2): Fix ARG regexp to skip quoted braces.
Remove `bf' and `it' from `bold' and `italic' (they were wrong and
are (correctly) handled separately).
Remove `caption' and `footnote' from `citations': they contain text.
Don't highlight `textmd', `texttt' and `textrm' with bold-italic.
(latex-skeleton-end-hook): New function.
(latex-mode): Use it.
(tex-start-tex-marker): Remove.
(tex-send-tex-command): Don't set tex-start-tex-marker.
(tex-error-parse-syntax-table): New var.
(tex-compilation-parse-errors): Use it.
Ignore tex-start-tex-marker. Don't bother with marker-position.
(tex-validate-buffer): Don't bother with marker-position.
| -rw-r--r-- | lisp/ChangeLog | 29 | ||||
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 66 |
2 files changed, 58 insertions, 37 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 91f5994f0b1..e73ff7926a2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,24 @@ | |||
| 1 | 2000-11-22 Stefan Monnier <monnier@cs.yale.edu> | ||
| 2 | |||
| 3 | * textmodes/tex-mode.el (tex-font-lock-keywords-1): | ||
| 4 | Fix ARG regexp to skip quoted braces. | ||
| 5 | (tex-font-lock-keywords-2): Fix ARG regexp to skip quoted braces. | ||
| 6 | Remove `bf' and `it' from `bold' and `italic' (they were wrong and | ||
| 7 | are (correctly) handled separately). | ||
| 8 | Remove `caption' and `footnote' from `citations': they contain text. | ||
| 9 | Don't highlight `textmd', `texttt' and `textrm' with bold-italic. | ||
| 10 | (latex-skeleton-end-hook): New function. | ||
| 11 | (latex-mode): Use it. | ||
| 12 | (tex-start-tex-marker): Remove. | ||
| 13 | (tex-send-tex-command): Don't set tex-start-tex-marker. | ||
| 14 | (tex-error-parse-syntax-table): New var. | ||
| 15 | (tex-compilation-parse-errors): Use it. | ||
| 16 | Ignore tex-start-tex-marker. Don't bother with marker-position. | ||
| 17 | (tex-validate-buffer): Don't bother with marker-position. | ||
| 18 | |||
| 19 | * textmodes/flyspell.el (flyspell-prog-text-faces): New var. | ||
| 20 | (flyspell-generic-progmode-verify): Use it.n | ||
| 21 | |||
| 1 | 2000-11-22 Sam Steingold <sds@gnu.org> | 22 | 2000-11-22 Sam Steingold <sds@gnu.org> |
| 2 | 23 | ||
| 3 | * simple.el (delete-trailing-whitespace): New interactive function. | 24 | * simple.el (delete-trailing-whitespace): New interactive function. |
| @@ -5,9 +26,8 @@ | |||
| 5 | `ada-remove-trailing-spaces' | 26 | `ada-remove-trailing-spaces' |
| 6 | (ada-remove-trailing-spaces): Removed. | 27 | (ada-remove-trailing-spaces): Removed. |
| 7 | * textmodes/two-column.el (2C-merge): Recommend it in the doc. | 28 | * textmodes/two-column.el (2C-merge): Recommend it in the doc. |
| 8 | * textmodes/picture.el (picture-mode-exit): Call it instead of | 29 | * textmodes/picture.el (picture-clean): Removed. |
| 9 | `picture-clean'. | 30 | (picture-mode-exit): Call it instead of `picture-clean'. |
| 10 | (picture-clean): Removed. | ||
| 11 | 31 | ||
| 12 | 2000-11-22 Gerd Moellmann <gerd@gnu.org> | 32 | 2000-11-22 Gerd Moellmann <gerd@gnu.org> |
| 13 | 33 | ||
| @@ -10878,8 +10898,7 @@ | |||
| 10878 | column-number items. Add help-echo for the background. | 10898 | column-number items. Add help-echo for the background. |
| 10879 | (mode-line-mule-info): Modify help-echo. | 10899 | (mode-line-mule-info): Modify help-echo. |
| 10880 | 10900 | ||
| 10881 | * avoid.el (mouse-avoidance-mode): Add autoload cookie to | 10901 | * avoid.el (mouse-avoidance-mode): Add autoload cookie to defcustom. |
| 10882 | defcustom. | ||
| 10883 | 10902 | ||
| 10884 | * files.el (load-file): Allow completion to .elc. | 10903 | * files.el (load-file): Allow completion to .elc. |
| 10885 | 10904 | ||
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 507d31c3a1e..47b18f9d8a0 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -442,7 +442,7 @@ An alternative value is \" . \", if you use a font with a narrow period." | |||
| 442 | ;; Miscellany. | 442 | ;; Miscellany. |
| 443 | (slash "\\\\") | 443 | (slash "\\\\") |
| 444 | (opt "\\(\\[[^]]*\\]\\)?") | 444 | (opt "\\(\\[[^]]*\\]\\)?") |
| 445 | (arg "{\\(\\(?:[^{}]+\\(?:{[^}]*}\\)?\\)+\\)")) | 445 | (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")) |
| 446 | (list | 446 | (list |
| 447 | ;; Heading args. | 447 | ;; Heading args. |
| 448 | (list (concat slash headings "\\*?" opt arg) | 448 | (list (concat slash headings "\\*?" opt arg) |
| @@ -473,16 +473,18 @@ An alternative value is \" . \", if you use a font with a narrow period." | |||
| 473 | (eval-when-compile | 473 | (eval-when-compile |
| 474 | (let* (;; | 474 | (let* (;; |
| 475 | ;; Names of commands whose arg should be fontified with fonts. | 475 | ;; Names of commands whose arg should be fontified with fonts. |
| 476 | (bold (regexp-opt '("bf" "textbf" "textsc" "textup" | 476 | (bold (regexp-opt '("textbf" "textsc" "textup" |
| 477 | "boldsymbol" "pmb") t)) | 477 | "boldsymbol" "pmb") t)) |
| 478 | (italic (regexp-opt '("it" "textit" "textsl" "emph") t)) | 478 | (italic (regexp-opt '("textit" "textsl" "emph") t)) |
| 479 | (type (regexp-opt '("texttt" "textmd" "textrm" "textsf") t)) | 479 | (type (regexp-opt '("texttt" "textmd" "textrm" "textsf") t)) |
| 480 | ;; | 480 | ;; |
| 481 | ;; Names of commands whose arg should be fontified as a citation. | 481 | ;; Names of commands whose arg should be fontified as a citation. |
| 482 | (citations (regexp-opt | 482 | (citations (regexp-opt |
| 483 | '("label" "ref" "pageref" "vref" "eqref" | 483 | '("label" "ref" "pageref" "vref" "eqref" |
| 484 | "cite" "nocite" "caption" "index" "glossary" | 484 | "cite" "nocite" "index" "glossary" |
| 485 | "footnote" "footnotemark" "footnotetext") | 485 | ;; These are text, rather than citations. |
| 486 | ;; "caption" "footnote" "footnotemark" "footnotetext" | ||
| 487 | ) | ||
| 486 | t)) | 488 | t)) |
| 487 | ;; | 489 | ;; |
| 488 | ;; Names of commands that should be fontified. | 490 | ;; Names of commands that should be fontified. |
| @@ -497,7 +499,7 @@ An alternative value is \" . \", if you use a font with a narrow period." | |||
| 497 | ;; Miscellany. | 499 | ;; Miscellany. |
| 498 | (slash "\\\\") | 500 | (slash "\\\\") |
| 499 | (opt "\\(\\[[^]]*\\]\\)?") | 501 | (opt "\\(\\[[^]]*\\]\\)?") |
| 500 | (arg "{\\(\\(?:[^{}]+\\(?:{[^}]*}\\)?\\)+\\)")) | 502 | (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")) |
| 501 | (list | 503 | (list |
| 502 | ;; | 504 | ;; |
| 503 | ;; Citation args. | 505 | ;; Citation args. |
| @@ -511,7 +513,7 @@ An alternative value is \" . \", if you use a font with a narrow period." | |||
| 511 | ;; since we might not be able to display those fonts. | 513 | ;; since we might not be able to display those fonts. |
| 512 | (list (concat slash bold arg) 2 '(quote bold) 'append) | 514 | (list (concat slash bold arg) 2 '(quote bold) 'append) |
| 513 | (list (concat slash italic arg) 2 '(quote italic) 'append) | 515 | (list (concat slash italic arg) 2 '(quote italic) 'append) |
| 514 | (list (concat slash type arg) 2 '(quote bold-italic) 'append) | 516 | ;; (list (concat slash type arg) 2 '(quote bold-italic) 'append) |
| 515 | ;; | 517 | ;; |
| 516 | ;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for tables. | 518 | ;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for tables. |
| 517 | (list (concat "\\\\\\(\\(bf\\)\\|em\\|it\\|sl\\)\\>" | 519 | (list (concat "\\\\\\(\\(bf\\)\\|em\\|it\\|sl\\)\\>" |
| @@ -784,6 +786,7 @@ subshell is initiated, `tex-shell-hook' is run." | |||
| 784 | (set (make-local-variable 'outline-regexp) latex-outline-regexp) | 786 | (set (make-local-variable 'outline-regexp) latex-outline-regexp) |
| 785 | (set (make-local-variable 'outline-level) 'latex-outline-level) | 787 | (set (make-local-variable 'outline-level) 'latex-outline-level) |
| 786 | (set (make-local-variable 'forward-sexp-function) 'latex-forward-sexp) | 788 | (set (make-local-variable 'forward-sexp-function) 'latex-forward-sexp) |
| 789 | (set (make-local-variable 'skeleton-end-hook) 'latex-skeleton-end-hook) | ||
| 787 | (run-hooks 'tex-mode-hook)) | 790 | (run-hooks 'tex-mode-hook)) |
| 788 | 791 | ||
| 789 | ;;;###autoload | 792 | ;;;###autoload |
| @@ -970,11 +973,9 @@ on the line for the invalidity you want to see." | |||
| 970 | (forward-char (- start end)) | 973 | (forward-char (- start end)) |
| 971 | (setq text-beg (point-marker)) | 974 | (setq text-beg (point-marker)) |
| 972 | (insert (format "%3d: " linenum)) | 975 | (insert (format "%3d: " linenum)) |
| 973 | (put-text-property (marker-position text-beg) | 976 | (put-text-property text-beg (- text-end 1) |
| 974 | (- (marker-position text-end) 1) | ||
| 975 | 'mouse-face 'highlight) | 977 | 'mouse-face 'highlight) |
| 976 | (put-text-property (marker-position text-beg) | 978 | (put-text-property text-beg (- text-end 1) |
| 977 | (- (marker-position text-end) 1) | ||
| 978 | 'occur tem))))) | 979 | 'occur tem))))) |
| 979 | (goto-char prev-end)))) | 980 | (goto-char prev-end)))) |
| 980 | (with-current-buffer standard-output | 981 | (with-current-buffer standard-output |
| @@ -1052,6 +1053,11 @@ A prefix arg inhibits the checking." | |||
| 1052 | 1053 | ||
| 1053 | (defvar latex-block-default "enumerate") | 1054 | (defvar latex-block-default "enumerate") |
| 1054 | 1055 | ||
| 1056 | (defun latex-skeleton-end-hook () | ||
| 1057 | (unless (or (eolp) (save-excursion (move-to-left-margin) | ||
| 1058 | (not (looking-at paragraph-separate)))) | ||
| 1059 | (newline-and-indent))) | ||
| 1060 | |||
| 1055 | ;;; Like tex-insert-braces, but for LaTeX. | 1061 | ;;; Like tex-insert-braces, but for LaTeX. |
| 1056 | (define-skeleton tex-latex-block | 1062 | (define-skeleton tex-latex-block |
| 1057 | "Create a matching pair of lines \\begin[OPT]{NAME} and \\end{NAME} at point. | 1063 | "Create a matching pair of lines \\begin[OPT]{NAME} and \\end{NAME} at point. |
| @@ -1316,9 +1322,6 @@ If NOT-ALL is non-nil, save the `.dvi' file." | |||
| 1316 | 1322 | ||
| 1317 | (add-hook 'kill-emacs-hook 'tex-delete-last-temp-files) | 1323 | (add-hook 'kill-emacs-hook 'tex-delete-last-temp-files) |
| 1318 | 1324 | ||
| 1319 | (defvar tex-start-tex-marker nil | ||
| 1320 | "Marker pointing after last TeX-running command in the TeX shell buffer.") | ||
| 1321 | |||
| 1322 | (defun tex-guess-main-file (&optional all) | 1325 | (defun tex-guess-main-file (&optional all) |
| 1323 | "Find a likely `tex-main-file'. | 1326 | "Find a likely `tex-main-file'. |
| 1324 | Looks for hints in other buffers in the same directory or in | 1327 | Looks for hints in other buffers in the same directory or in |
| @@ -1394,17 +1397,29 @@ with extension." | |||
| 1394 | (let (shell-dirtrack-verbose) | 1397 | (let (shell-dirtrack-verbose) |
| 1395 | (tex-send-command tex-shell-cd-command dir))) | 1398 | (tex-send-command tex-shell-cd-command dir))) |
| 1396 | (with-current-buffer (process-buffer (tex-send-command cmd)) | 1399 | (with-current-buffer (process-buffer (tex-send-command cmd)) |
| 1397 | (save-excursion | ||
| 1398 | (forward-line -1) | ||
| 1399 | (setq tex-start-tex-marker (point-marker))) | ||
| 1400 | (make-local-variable 'compilation-parse-errors-function) | 1400 | (make-local-variable 'compilation-parse-errors-function) |
| 1401 | (setq compilation-parse-errors-function 'tex-compilation-parse-errors) | 1401 | (setq compilation-parse-errors-function 'tex-compilation-parse-errors) |
| 1402 | (setq compilation-last-buffer (current-buffer)) | 1402 | (setq compilation-last-buffer (current-buffer)) |
| 1403 | (compilation-forget-errors) | 1403 | (compilation-forget-errors) |
| 1404 | ;; Don't parse previous compilations. | ||
| 1404 | (set-marker compilation-parsing-end (1- (point-max)))) | 1405 | (set-marker compilation-parsing-end (1- (point-max)))) |
| 1405 | (tex-display-shell) | 1406 | (tex-display-shell) |
| 1406 | (setq tex-last-buffer-texed (current-buffer))) | 1407 | (setq tex-last-buffer-texed (current-buffer))) |
| 1407 | 1408 | ||
| 1409 | (defvar tex-error-parse-syntax-table | ||
| 1410 | (let ((st (make-syntax-table))) | ||
| 1411 | (modify-syntax-entry ?\( "()" st) | ||
| 1412 | (modify-syntax-entry ?\) ")(" st) | ||
| 1413 | (modify-syntax-entry ?\\ "\\" st) | ||
| 1414 | (modify-syntax-entry ?\{ "_" st) | ||
| 1415 | (modify-syntax-entry ?\} "_" st) | ||
| 1416 | (modify-syntax-entry ?\[ "_" st) | ||
| 1417 | (modify-syntax-entry ?\] "_" st) | ||
| 1418 | ;; Single quotations may appear in errors | ||
| 1419 | (modify-syntax-entry ?\" "_" st) | ||
| 1420 | st) | ||
| 1421 | "Syntax-table used while parsing TeX error messages.") | ||
| 1422 | |||
| 1408 | (defun tex-compilation-parse-errors (limit-search find-at-least) | 1423 | (defun tex-compilation-parse-errors (limit-search find-at-least) |
| 1409 | "Parse the current buffer as TeX error messages. | 1424 | "Parse the current buffer as TeX error messages. |
| 1410 | See the variable `compilation-parse-errors-function' for the interface it uses. | 1425 | See the variable `compilation-parse-errors-function' for the interface it uses. |
| @@ -1418,20 +1433,9 @@ for the error messages." | |||
| 1418 | (message "Parsing error messages...") | 1433 | (message "Parsing error messages...") |
| 1419 | (let ((default-directory ; Perhaps dir has changed meanwhile. | 1434 | (let ((default-directory ; Perhaps dir has changed meanwhile. |
| 1420 | (file-name-directory (buffer-file-name tex-last-buffer-texed))) | 1435 | (file-name-directory (buffer-file-name tex-last-buffer-texed))) |
| 1421 | (old-syntax-table (syntax-table)) | ||
| 1422 | (tex-error-parse-syntax-table (copy-syntax-table (syntax-table))) | ||
| 1423 | found-desired (num-errors-found 0) | 1436 | found-desired (num-errors-found 0) |
| 1424 | last-filename last-linenum last-position | 1437 | last-filename last-linenum last-position |
| 1425 | begin-of-error end-of-error) | 1438 | begin-of-error end-of-error) |
| 1426 | (modify-syntax-entry ?\{ "_" tex-error-parse-syntax-table) | ||
| 1427 | (modify-syntax-entry ?\} "_" tex-error-parse-syntax-table) | ||
| 1428 | (modify-syntax-entry ?\[ "_" tex-error-parse-syntax-table) | ||
| 1429 | (modify-syntax-entry ?\] "_" tex-error-parse-syntax-table) | ||
| 1430 | ;; Single quotations may appear in errors | ||
| 1431 | (modify-syntax-entry ?\" "_" tex-error-parse-syntax-table) | ||
| 1432 | ;; Don't parse previous compilations. | ||
| 1433 | (set-marker compilation-parsing-end | ||
| 1434 | (max compilation-parsing-end tex-start-tex-marker)) | ||
| 1435 | ;; Don't reparse messages already seen at last parse. | 1439 | ;; Don't reparse messages already seen at last parse. |
| 1436 | (goto-char compilation-parsing-end) | 1440 | (goto-char compilation-parsing-end) |
| 1437 | ;; Parse messages. | 1441 | ;; Parse messages. |
| @@ -1463,16 +1467,14 @@ for the error messages." | |||
| 1463 | (set-buffer tex-last-buffer-texed) | 1467 | (set-buffer tex-last-buffer-texed) |
| 1464 | (set-buffer (find-file-noselect filename))) | 1468 | (set-buffer (find-file-noselect filename))) |
| 1465 | (if new-file | 1469 | (if new-file |
| 1466 | (goto-line linenum) | 1470 | (progn (goto-line linenum) (setq last-position nil)) |
| 1467 | (goto-char last-position) | 1471 | (goto-char last-position) |
| 1468 | (forward-line (- linenum last-linenum))) | 1472 | (forward-line (- linenum last-linenum))) |
| 1469 | ;; first try a forward search for the error text, | 1473 | ;; first try a forward search for the error text, |
| 1470 | ;; then a backward search limited by the last error. | 1474 | ;; then a backward search limited by the last error. |
| 1471 | (let ((starting-point (point))) | 1475 | (let ((starting-point (point))) |
| 1472 | (or (re-search-forward error-text nil t) | 1476 | (or (re-search-forward error-text nil t) |
| 1473 | (re-search-backward | 1477 | (re-search-backward error-text last-position t) |
| 1474 | error-text | ||
| 1475 | (marker-position last-position) t) | ||
| 1476 | (goto-char starting-point))) | 1478 | (goto-char starting-point))) |
| 1477 | (point-marker)))) | 1479 | (point-marker)))) |
| 1478 | (goto-char this-error) | 1480 | (goto-char this-error) |