diff options
| author | Markus Rost | 1999-01-29 22:06:31 +0000 |
|---|---|---|
| committer | Markus Rost | 1999-01-29 22:06:31 +0000 |
| commit | e6b0b77374980ab1a143e0e1bc77fa66a1145cf5 (patch) | |
| tree | b9226833d71b25a4e5dbab99f89f53e38d703ba5 /lisp | |
| parent | 2d212d873560d74d59e50bbdcb6886f66a90f118 (diff) | |
| download | emacs-e6b0b77374980ab1a143e0e1bc77fa66a1145cf5.tar.gz emacs-e6b0b77374980ab1a143e0e1bc77fa66a1145cf5.zip | |
(tex-mode-map): Replace validate-tex-buffer by
tex-validate-buffer.
(plain-tex-mode, latex-mode, slitex-mode): Likewise.
(tex-validate-buffer): Renamed from validate-tex-buffer. Works
now with recent occur-mode.
(tex-validate-region): Really walk through all Sexps.
(tex-region): Bind shell-dirtrack-verbose.
(tex-file, tex-bibtex-file): Likewise.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 0b246234767..1d3493e10fd 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -379,8 +379,8 @@ subsubsection\\|paragraph\\|subparagraph\\)\\*?[ \t]*{" nil t) | |||
| 379 | '("BibTeX File" . tex-bibtex-file)) | 379 | '("BibTeX File" . tex-bibtex-file)) |
| 380 | (define-key tex-mode-map [menu-bar tex tex-validate-region] | 380 | (define-key tex-mode-map [menu-bar tex tex-validate-region] |
| 381 | '("Validate Region" . tex-validate-region)) | 381 | '("Validate Region" . tex-validate-region)) |
| 382 | (define-key tex-mode-map [menu-bar tex validate-tex-buffer] | 382 | (define-key tex-mode-map [menu-bar tex tex-validate-buffer] |
| 383 | '("Validate Buffer" . validate-tex-buffer)) | 383 | '("Validate Buffer" . tex-validate-buffer)) |
| 384 | (define-key tex-mode-map [menu-bar tex tex-region] | 384 | (define-key tex-mode-map [menu-bar tex tex-region] |
| 385 | '("TeX Region" . tex-region)) | 385 | '("TeX Region" . tex-region)) |
| 386 | (define-key tex-mode-map [menu-bar tex tex-buffer] | 386 | (define-key tex-mode-map [menu-bar tex tex-buffer] |
| @@ -465,7 +465,7 @@ running TeX under a special subshell. \\[tex-buffer] does the whole buffer. | |||
| 465 | \\[tex-view] previews the .dvi file made by any of these. | 465 | \\[tex-view] previews the .dvi file made by any of these. |
| 466 | \\[tex-bibtex-file] runs bibtex on the file of the current buffer. | 466 | \\[tex-bibtex-file] runs bibtex on the file of the current buffer. |
| 467 | 467 | ||
| 468 | Use \\[validate-tex-buffer] to check buffer for paragraphs containing | 468 | Use \\[tex-validate-buffer] to check buffer for paragraphs containing |
| 469 | mismatched $'s or braces. | 469 | mismatched $'s or braces. |
| 470 | 470 | ||
| 471 | Special commands: | 471 | Special commands: |
| @@ -519,7 +519,7 @@ running LaTeX under a special subshell. \\[tex-buffer] does the whole buffer. | |||
| 519 | \\[tex-view] previews the .dvi file made by any of these. | 519 | \\[tex-view] previews the .dvi file made by any of these. |
| 520 | \\[tex-bibtex-file] runs bibtex on the file of the current buffer. | 520 | \\[tex-bibtex-file] runs bibtex on the file of the current buffer. |
| 521 | 521 | ||
| 522 | Use \\[validate-tex-buffer] to check buffer for paragraphs containing | 522 | Use \\[tex-validate-buffer] to check buffer for paragraphs containing |
| 523 | mismatched $'s or braces. | 523 | mismatched $'s or braces. |
| 524 | 524 | ||
| 525 | Special commands: | 525 | Special commands: |
| @@ -597,7 +597,7 @@ running SliTeX under a special subshell. \\[tex-buffer] does the whole buffer. | |||
| 597 | \\[tex-view] previews the .dvi file made by any of these. | 597 | \\[tex-view] previews the .dvi file made by any of these. |
| 598 | \\[tex-bibtex-file] runs bibtex on the file of the current buffer. | 598 | \\[tex-bibtex-file] runs bibtex on the file of the current buffer. |
| 599 | 599 | ||
| 600 | Use \\[validate-tex-buffer] to check buffer for paragraphs containing | 600 | Use \\[tex-validate-buffer] to check buffer for paragraphs containing |
| 601 | mismatched $'s or braces. | 601 | mismatched $'s or braces. |
| 602 | 602 | ||
| 603 | Special commands: | 603 | Special commands: |
| @@ -782,24 +782,24 @@ inserts \" characters." | |||
| 782 | (t | 782 | (t |
| 783 | tex-close-quote))))) | 783 | tex-close-quote))))) |
| 784 | 784 | ||
| 785 | (defun validate-tex-buffer () | 785 | (defun tex-validate-buffer () |
| 786 | "Check current buffer for paragraphs containing mismatched $s. | 786 | "Check current buffer for paragraphs containing mismatched braces or $s. |
| 787 | Their positions are recorded in the buffer `*Occur*'. | 787 | Their positions are recorded in the buffer `*Occur*'. |
| 788 | To find a particular invalidity from `*Occur*', | 788 | To find a particular invalidity from `*Occur*', switch to that buffer |
| 789 | switch to to that buffer and type C-c C-c on the line | 789 | and type C-c C-c or click with mouse-2 |
| 790 | for the invalidity you want to see." | 790 | on the line for the invalidity you want to see." |
| 791 | (interactive) | 791 | (interactive) |
| 792 | (let ((buffer (current-buffer)) | 792 | (let ((buffer (current-buffer)) |
| 793 | (prevpos (point-min)) | 793 | (prevpos (point-min)) |
| 794 | (linenum nil)) | 794 | (linenum nil) |
| 795 | (num-matches 0)) | ||
| 795 | (with-output-to-temp-buffer "*Occur*" | 796 | (with-output-to-temp-buffer "*Occur*" |
| 796 | (princ "Mismatches:\n") | 797 | (princ "Mismatches:\n") |
| 797 | (save-excursion | 798 | (save-excursion |
| 798 | (set-buffer standard-output) | 799 | (set-buffer standard-output) |
| 799 | (occur-mode) | 800 | (occur-mode) |
| 800 | (setq occur-buffer buffer) | 801 | (setq occur-buffer buffer) |
| 801 | (setq occur-nlines 0) | 802 | (setq occur-nlines 0)) |
| 802 | (setq occur-pos-list nil)) | ||
| 803 | (save-excursion | 803 | (save-excursion |
| 804 | (goto-char (point-max)) | 804 | (goto-char (point-max)) |
| 805 | (while (and (not (input-pending-p)) (not (bobp))) | 805 | (while (and (not (input-pending-p)) (not (bobp))) |
| @@ -825,25 +825,32 @@ for the invalidity you want to see." | |||
| 825 | (setq prevpos (point)) | 825 | (setq prevpos (point)) |
| 826 | ;; Mention this mismatch in *Occur*. | 826 | ;; Mention this mismatch in *Occur*. |
| 827 | ;; Since we scan from end of buffer to beginning, | 827 | ;; Since we scan from end of buffer to beginning, |
| 828 | ;; add each mismatch at the beginning of *Occur* | 828 | ;; add each mismatch at the beginning of *Occur*. |
| 829 | ;; and at the beginning of occur-pos-list. | ||
| 830 | (save-excursion | 829 | (save-excursion |
| 831 | (setq tem (point-marker)) | 830 | (setq tem (point-marker)) |
| 832 | (set-buffer standard-output) | 831 | (set-buffer standard-output) |
| 833 | (goto-char (point-min)) | 832 | (goto-char (point-min)) |
| 834 | ;; Skip "Mismatches:" header line. | 833 | ;; Skip "Mismatches:" header line. |
| 835 | (forward-line 1) | 834 | (forward-line 1) |
| 836 | (setq occur-pos-list (cons tem occur-pos-list)) | 835 | (setq num-matches (1+ num-matches)) |
| 837 | (insert-buffer-substring buffer start end) | 836 | (insert-buffer-substring buffer start end) |
| 838 | (forward-char (- start end)) | 837 | (let (text-beg (text-end (point-marker))) |
| 839 | (insert (format "%3d: " linenum))))) | 838 | (forward-char (- start end)) |
| 839 | (setq text-beg (point-marker)) | ||
| 840 | (insert (format "%3d: " linenum)) | ||
| 841 | (put-text-property (marker-position text-beg) | ||
| 842 | (- (marker-position text-end) 1) | ||
| 843 | 'mouse-face 'highlight) | ||
| 844 | (put-text-property (marker-position text-beg) | ||
| 845 | (- (marker-position text-end) 1) | ||
| 846 | 'occur tem))))) | ||
| 840 | (goto-char prev-end)))) | 847 | (goto-char prev-end)))) |
| 841 | (save-excursion | 848 | (save-excursion |
| 842 | (set-buffer standard-output) | 849 | (set-buffer standard-output) |
| 843 | (if (null occur-pos-list) | 850 | (if (eq num-matches 0) |
| 844 | (insert "None!\n")) | 851 | (insert "None!\n")) |
| 845 | (if (interactive-p) | 852 | (if (interactive-p) |
| 846 | (message "%d mismatches found" (length occur-pos-list))))))) | 853 | (message "%d mismatches found" num-matches)))))) |
| 847 | 854 | ||
| 848 | (defun tex-validate-region (start end) | 855 | (defun tex-validate-region (start end) |
| 849 | "Check for mismatched braces or $'s in region. | 856 | "Check for mismatched braces or $'s in region. |
| @@ -857,7 +864,7 @@ area if a mismatch is found." | |||
| 857 | (narrow-to-region start end) | 864 | (narrow-to-region start end) |
| 858 | ;; First check that the open and close parens balance in numbers. | 865 | ;; First check that the open and close parens balance in numbers. |
| 859 | (goto-char start) | 866 | (goto-char start) |
| 860 | (while (< 0 (setq max-possible-sexps (1- max-possible-sexps))) | 867 | (while (<= 0 (setq max-possible-sexps (1- max-possible-sexps))) |
| 861 | (forward-sexp 1)) | 868 | (forward-sexp 1)) |
| 862 | ;; Now check that like matches like. | 869 | ;; Now check that like matches like. |
| 863 | (goto-char start) | 870 | (goto-char start) |
| @@ -1280,7 +1287,8 @@ The value of `tex-command' specifies the command to use to run TeX." | |||
| 1280 | tex-out-file t nil)))) | 1287 | tex-out-file t nil)))) |
| 1281 | ;; Record the file name to be deleted afterward. | 1288 | ;; Record the file name to be deleted afterward. |
| 1282 | (setq tex-last-temp-file tex-out-file) | 1289 | (setq tex-last-temp-file tex-out-file) |
| 1283 | (tex-send-command tex-shell-cd-command zap-directory) | 1290 | (let (shell-dirtrack-verbose) |
| 1291 | (tex-send-command tex-shell-cd-command zap-directory)) | ||
| 1284 | ;; Use a relative file name here because (1) the proper dir | 1292 | ;; Use a relative file name here because (1) the proper dir |
| 1285 | ;; is already current, and (2) the abs file name is sometimes | 1293 | ;; is already current, and (2) the abs file name is sometimes |
| 1286 | ;; too long and can make tex crash. | 1294 | ;; too long and can make tex crash. |
| @@ -1312,7 +1320,8 @@ This function is more useful than \\[tex-buffer] when you need the | |||
| 1312 | (if (tex-shell-running) | 1320 | (if (tex-shell-running) |
| 1313 | (tex-kill-job) | 1321 | (tex-kill-job) |
| 1314 | (tex-start-shell)) | 1322 | (tex-start-shell)) |
| 1315 | (tex-send-command tex-shell-cd-command file-dir) | 1323 | (let (shell-dirtrack-verbose) |
| 1324 | (tex-send-command tex-shell-cd-command file-dir)) | ||
| 1316 | (tex-start-tex tex-command source-file) | 1325 | (tex-start-tex tex-command source-file) |
| 1317 | (tex-display-shell) | 1326 | (tex-display-shell) |
| 1318 | (setq tex-last-buffer-texed (current-buffer)) | 1327 | (setq tex-last-buffer-texed (current-buffer)) |
| @@ -1459,7 +1468,8 @@ Runs the shell command defined by `tex-show-queue-command'." | |||
| 1459 | (if (tex-shell-running) | 1468 | (if (tex-shell-running) |
| 1460 | (tex-kill-job) | 1469 | (tex-kill-job) |
| 1461 | (tex-start-shell)) | 1470 | (tex-start-shell)) |
| 1462 | (let ((tex-out-file | 1471 | (let (shell-dirtrack-verbose |
| 1472 | (tex-out-file | ||
| 1463 | (tex-append (file-name-nondirectory (buffer-file-name)) "")) | 1473 | (tex-append (file-name-nondirectory (buffer-file-name)) "")) |
| 1464 | (file-dir (file-name-directory (buffer-file-name)))) | 1474 | (file-dir (file-name-directory (buffer-file-name)))) |
| 1465 | (tex-send-command tex-shell-cd-command file-dir) | 1475 | (tex-send-command tex-shell-cd-command file-dir) |