diff options
| author | Glenn Morris | 2007-09-21 07:56:33 +0000 |
|---|---|---|
| committer | Glenn Morris | 2007-09-21 07:56:33 +0000 |
| commit | 2fb34c68c71f8c84d563cbb9a57dacd88b2ce740 (patch) | |
| tree | fdbe65eac9df36d2217c17622229999c05ac5a52 | |
| parent | 7d86c3808d6f4be7372e990834429fc18c59e256 (diff) | |
| download | emacs-2fb34c68c71f8c84d563cbb9a57dacd88b2ce740.tar.gz emacs-2fb34c68c71f8c84d563cbb9a57dacd88b2ce740.zip | |
(tex-next-unmatched-eparen): Doc fix.
(tex-last-unended-eparen): New function.
(latex-backward-sexp-1): Doc fix. Handle escaped parens.
| -rw-r--r-- | lisp/ChangeLog | 31 | ||||
| -rw-r--r-- | lisp/textmodes/tex-mode.el | 49 |
2 files changed, 48 insertions, 32 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1872f8303ae..e18932e377e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -7,16 +7,6 @@ | |||
| 7 | * faces.el (tty-set-up-initial-frame-faces): | 7 | * faces.el (tty-set-up-initial-frame-faces): |
| 8 | * env.el (setenv): Don't set display-environment-variable. | 8 | * env.el (setenv): Don't set display-environment-variable. |
| 9 | 9 | ||
| 10 | 2007-09-21 Glenn Morris <rgm@gnu.org> | ||
| 11 | |||
| 12 | * emacs-lisp/bytecomp.el (byte-compile-warnings) | ||
| 13 | (byte-compile-warnings-safe-p): Add `mapcar'. | ||
| 14 | (byte-compile-normal-call): Add option to suppress mapcar warning. | ||
| 15 | (top-level): Use mapc rather than mapcar in eval-when-compile. | ||
| 16 | (byte-compile-warning-types): Add mapcar and make-local. | ||
| 17 | |||
| 18 | 2007-09-21 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 19 | |||
| 20 | * server.el (server-getenv-from): Remove. Use getenv-internal instead. | 10 | * server.el (server-getenv-from): Remove. Use getenv-internal instead. |
| 21 | (server-create-tty-frame): Don't set unused `tty' property. | 11 | (server-create-tty-frame): Don't set unused `tty' property. |
| 22 | Set `display' instead of display-environment-variable. | 12 | Set `display' instead of display-environment-variable. |
| @@ -48,16 +38,16 @@ | |||
| 48 | * term/sun-mouse.el (suspend-emacstool): Remove. | 38 | * term/sun-mouse.el (suspend-emacstool): Remove. |
| 49 | * term/sun.el: Remove emacstool-related code. | 39 | * term/sun.el: Remove emacstool-related code. |
| 50 | 40 | ||
| 51 | 2007-09-21 Kevin Ryde <user42@zip.com.au> | 41 | * emacs-lisp/bytecomp.el (byte-compile-warnings) |
| 52 | 42 | (byte-compile-warnings-safe-p): Add `mapcar'. | |
| 53 | * international/mule.el (sgml-html-meta-auto-coding-function): | 43 | (byte-compile-normal-call): Add option to suppress mapcar warning. |
| 54 | Bind `case-fold-search' to t. | 44 | (top-level): Use mapc rather than mapcar in eval-when-compile. |
| 55 | 45 | (byte-compile-warning-types): Add mapcar and make-local. | |
| 56 | 2007-09-21 Glenn Morris <rgm@gnu.org> | ||
| 57 | 46 | ||
| 58 | * textmodes/tex-mode.el (tex-validate-region): Handle escaped parens. | 47 | * textmodes/tex-mode.el (tex-validate-region): Handle escaped parens. |
| 59 | (tex-next-unmatched-eparen): New function. | 48 | (tex-next-unmatched-eparen, tex-last-unended-eparen): New functions. |
| 60 | (latex-forward-sexp-1): Doc fix. Handle escaped parens. | 49 | (latex-forward-sexp-1, latex-backward-sexp-1): Doc fix. |
| 50 | Handle escaped parens. | ||
| 61 | (latex-forward-sexp): Doc fix. | 51 | (latex-forward-sexp): Doc fix. |
| 62 | 52 | ||
| 63 | * eshell/esh-mode.el (eshell-output-filter-functions): Add | 53 | * eshell/esh-mode.el (eshell-output-filter-functions): Add |
| @@ -65,6 +55,11 @@ | |||
| 65 | 55 | ||
| 66 | * loadup.el: Remove termdev. | 56 | * loadup.el: Remove termdev. |
| 67 | 57 | ||
| 58 | 2007-09-21 Kevin Ryde <user42@zip.com.au> | ||
| 59 | |||
| 60 | * international/mule.el (sgml-html-meta-auto-coding-function): | ||
| 61 | Bind `case-fold-search' to t. | ||
| 62 | |||
| 68 | 2007-09-20 Stefan Monnier <monnier@iro.umontreal.ca> | 63 | 2007-09-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 69 | 64 | ||
| 70 | * termdev.el: Remove. | 65 | * termdev.el: Remove. |
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 3da099f2cb3..7be4d1e0bd1 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -1403,7 +1403,7 @@ Return the value returned by the last execution of BODY." | |||
| 1403 | 1403 | ||
| 1404 | (defun tex-next-unmatched-eparen (otype) | 1404 | (defun tex-next-unmatched-eparen (otype) |
| 1405 | "Leave point after the next unmatched escaped closing parenthesis. | 1405 | "Leave point after the next unmatched escaped closing parenthesis. |
| 1406 | The string OPAREN is an opening parenthesis type: `(', `{', or `['." | 1406 | The string OTYPE is an opening parenthesis type: `(', `{', or `['." |
| 1407 | (condition-case nil | 1407 | (condition-case nil |
| 1408 | (let ((ctype (char-to-string (cdr (aref (syntax-table) | 1408 | (let ((ctype (char-to-string (cdr (aref (syntax-table) |
| 1409 | (string-to-char otype)))))) | 1409 | (string-to-char otype)))))) |
| @@ -1416,6 +1416,19 @@ The string OPAREN is an opening parenthesis type: `(', `{', or `['." | |||
| 1416 | (wrong-type-argument (error "Unknown opening parenthesis type: %s" otype)) | 1416 | (wrong-type-argument (error "Unknown opening parenthesis type: %s" otype)) |
| 1417 | (search-failed (error "Couldn't find closing escaped paren")))) | 1417 | (search-failed (error "Couldn't find closing escaped paren")))) |
| 1418 | 1418 | ||
| 1419 | (defun tex-last-unended-eparen (ctype) | ||
| 1420 | "Leave point at the start of the last unended escaped opening parenthesis. | ||
| 1421 | The string CTYPE is a closing parenthesis type: `)', `}', or `]'." | ||
| 1422 | (condition-case nil | ||
| 1423 | (let ((otype (char-to-string (cdr (aref (syntax-table) | ||
| 1424 | (string-to-char ctype)))))) | ||
| 1425 | (while (and (tex-search-noncomment | ||
| 1426 | (re-search-backward (format "\\\\[%s%s]" ctype otype))) | ||
| 1427 | (looking-at (format "\\\\%s" (regexp-quote ctype)))) | ||
| 1428 | (tex-last-unended-eparen ctype))) | ||
| 1429 | (wrong-type-argument (error "Unknown opening parenthesis type: %s" ctype)) | ||
| 1430 | (search-failed (error "Couldn't find unended escaped paren")))) | ||
| 1431 | |||
| 1419 | (defun tex-goto-last-unclosed-latex-block () | 1432 | (defun tex-goto-last-unclosed-latex-block () |
| 1420 | "Move point to the last unclosed \\begin{...}. | 1433 | "Move point to the last unclosed \\begin{...}. |
| 1421 | Mark is left at original location." | 1434 | Mark is left at original location." |
| @@ -1427,26 +1440,32 @@ Mark is left at original location." | |||
| 1427 | (push-mark) | 1440 | (push-mark) |
| 1428 | (goto-char spot))) | 1441 | (goto-char spot))) |
| 1429 | 1442 | ||
| 1443 | ;; Don't think this one actually _needs_ (for the purposes of | ||
| 1444 | ;; tex-mode) to handle escaped parens. | ||
| 1430 | (defun latex-backward-sexp-1 () | 1445 | (defun latex-backward-sexp-1 () |
| 1431 | "Like (backward-sexp 1) but aware of multi-char elements." | 1446 | "Like (backward-sexp 1) but aware of multi-char elements and escaped parens." |
| 1432 | (let ((pos (point)) | 1447 | (let ((pos (point)) |
| 1433 | (forward-sexp-function)) | 1448 | (forward-sexp-function)) |
| 1434 | (backward-sexp 1) | 1449 | (backward-sexp 1) |
| 1435 | (if (looking-at "\\\\begin\\>") | 1450 | (cond ((looking-at "\\\\\\(begin\\>\\|[[({]\\)") |
| 1436 | (signal 'scan-error | 1451 | (signal 'scan-error |
| 1437 | (list "Containing expression ends prematurely" | 1452 | (list "Containing expression ends prematurely" |
| 1438 | (point) (prog1 (point) (goto-char pos)))) | 1453 | (point) (prog1 (point) (goto-char pos))))) |
| 1439 | (when (eq (char-after) ?{) | 1454 | ((looking-at "\\\\\\([])}]\\)") |
| 1440 | (let ((newpos (point))) | 1455 | (tex-last-unended-eparen (match-string 1))) |
| 1441 | (when (ignore-errors (backward-sexp 1) t) | 1456 | ((eq (char-after) ?{) |
| 1442 | (if (or (looking-at "\\\\end\\>") | 1457 | (let ((newpos (point))) |
| 1443 | ;; In case the \\ ends a verbatim section. | 1458 | (when (ignore-errors (backward-sexp 1) t) |
| 1444 | (and (looking-at "end\\>") (eq (char-before) ?\\))) | 1459 | (if (or (looking-at "\\\\end\\>") |
| 1445 | (tex-last-unended-begin) | 1460 | ;; In case the \\ ends a verbatim section. |
| 1446 | (goto-char newpos)))))))) | 1461 | (and (looking-at "end\\>") (eq (char-before) ?\\))) |
| 1462 | (tex-last-unended-begin) | ||
| 1463 | (goto-char newpos)))))))) | ||
| 1447 | 1464 | ||
| 1448 | ;; Note this does not handle things like mismatched brackets inside | 1465 | ;; Note this does not handle things like mismatched brackets inside |
| 1449 | ;; begin/end blocks. | 1466 | ;; begin/end blocks. |
| 1467 | ;; Needs to handle escaped parens for tex-validate-*. | ||
| 1468 | ;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-09/msg00038.html | ||
| 1450 | (defun latex-forward-sexp-1 () | 1469 | (defun latex-forward-sexp-1 () |
| 1451 | "Like (forward-sexp 1) but aware of multi-char elements and escaped parens." | 1470 | "Like (forward-sexp 1) but aware of multi-char elements and escaped parens." |
| 1452 | (let ((pos (point)) | 1471 | (let ((pos (point)) |
| @@ -1465,6 +1484,8 @@ Mark is left at original location." | |||
| 1465 | ((looking-at "\\\\begin\\>") | 1484 | ((looking-at "\\\\begin\\>") |
| 1466 | (goto-char (match-end 0)) | 1485 | (goto-char (match-end 0)) |
| 1467 | (tex-next-unmatched-end)) | 1486 | (tex-next-unmatched-end)) |
| 1487 | ;; A better way to handle this, \( .. \) etc, is probably to | ||
| 1488 | ;; temporarily change the syntax of the \ in \( to punctuation. | ||
| 1468 | ((looking-back "\\\\[])}]") | 1489 | ((looking-back "\\\\[])}]") |
| 1469 | (signal 'scan-error | 1490 | (signal 'scan-error |
| 1470 | (list "Containing expression ends prematurely" | 1491 | (list "Containing expression ends prematurely" |