diff options
| author | Glenn Morris | 2007-10-13 20:01:54 +0000 |
|---|---|---|
| committer | Glenn Morris | 2007-10-13 20:01:54 +0000 |
| commit | a584f30f1dbb67345e354da06a549a5fb20581ba (patch) | |
| tree | 505c894dfc80d4265d4febd5c9c715dcb9aa036c | |
| parent | 6b1e222c47d27d2c71a7e6578a799973237cb7db (diff) | |
| download | emacs-a584f30f1dbb67345e354da06a549a5fb20581ba.tar.gz emacs-a584f30f1dbb67345e354da06a549a5fb20581ba.zip | |
John W. Eaton <jwe at octave.org>
(octave-looking-at-kw)
(octave-re-search-forward-kw, octave-re-search-backward-kw): New functions.
(octave-in-defun-p, calculate-octave-indent)
(octave-blink-matching-block-open, octave-beginning-of-defun)
(octave-auto-fill): Use octave-looking-at-kw instead of looking-at,
to search for regexps that contain case-sensitive keywords.
(octave-beginning-of-defun): Likewise, for octave-re-search-backward-kw.
(octave-scan-blocks): Likewise, for octave-re-search-forward-kw.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/progmodes/octave-mod.el | 38 |
2 files changed, 37 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 70c46cffd3b..3f71450cd24 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2007-10-13 John W. Eaton <jwe@octave.org> | ||
| 2 | |||
| 3 | * progmodes/octave-mod.el (octave-looking-at-kw) | ||
| 4 | (octave-re-search-forward-kw, octave-re-search-backward-kw): | ||
| 5 | New functions. | ||
| 6 | (octave-in-defun-p, calculate-octave-indent) | ||
| 7 | (octave-blink-matching-block-open, octave-beginning-of-defun) | ||
| 8 | (octave-auto-fill): Use octave-looking-at-kw instead of looking-at, | ||
| 9 | to search for regexps that contain case-sensitive keywords. | ||
| 10 | (octave-beginning-of-defun): Likewise, for octave-re-search-backward-kw. | ||
| 11 | (octave-scan-blocks): Likewise, for octave-re-search-forward-kw. | ||
| 12 | |||
| 1 | 2007-10-13 Glenn Morris <rgm@gnu.org> | 13 | 2007-10-13 Glenn Morris <rgm@gnu.org> |
| 2 | 14 | ||
| 3 | * faces.el (face-spec-set): When FRAME is nil, set the default for | 15 | * faces.el (face-spec-set): When FRAME is nil, set the default for |
diff --git a/lisp/progmodes/octave-mod.el b/lisp/progmodes/octave-mod.el index 4630fe1856d..fe44fcaf4fe 100644 --- a/lisp/progmodes/octave-mod.el +++ b/lisp/progmodes/octave-mod.el | |||
| @@ -581,13 +581,25 @@ to end after the end keyword." | |||
| 581 | (error nil)) | 581 | (error nil)) |
| 582 | (< pos (point))))) | 582 | (< pos (point))))) |
| 583 | 583 | ||
| 584 | (defun octave-looking-at-kw (regexp) | ||
| 585 | (let ((case-fold-search nil)) | ||
| 586 | (looking-at regexp))) | ||
| 587 | |||
| 588 | (defun octave-re-search-forward-kw (regexp) | ||
| 589 | (let ((case-fold-search nil)) | ||
| 590 | (re-search-forward regexp nil 'move inc))) | ||
| 591 | |||
| 592 | (defun octave-re-search-backward-kw (regexp) | ||
| 593 | (let ((case-fold-search nil)) | ||
| 594 | (re-search-backward regexp nil 'move inc))) | ||
| 595 | |||
| 584 | (defun octave-in-defun-p () | 596 | (defun octave-in-defun-p () |
| 585 | "Return t if point is inside an Octave function declaration. | 597 | "Return t if point is inside an Octave function declaration. |
| 586 | The function is taken to start at the `f' of `function' and to end after | 598 | The function is taken to start at the `f' of `function' and to end after |
| 587 | the end keyword." | 599 | the end keyword." |
| 588 | (let ((pos (point))) | 600 | (let ((pos (point))) |
| 589 | (save-excursion | 601 | (save-excursion |
| 590 | (or (and (looking-at "\\<function\\>") | 602 | (or (and (octave-looking-at-kw "\\<function\\>") |
| 591 | (octave-not-in-string-or-comment-p)) | 603 | (octave-not-in-string-or-comment-p)) |
| 592 | (and (octave-beginning-of-defun) | 604 | (and (octave-beginning-of-defun) |
| 593 | (condition-case nil | 605 | (condition-case nil |
| @@ -658,14 +670,14 @@ level." | |||
| 658 | (while (< (point) eol) | 670 | (while (< (point) eol) |
| 659 | (if (octave-not-in-string-or-comment-p) | 671 | (if (octave-not-in-string-or-comment-p) |
| 660 | (cond | 672 | (cond |
| 661 | ((looking-at "\\<switch\\>") | 673 | ((octave-looking-at-kw "\\<switch\\>") |
| 662 | (setq icol (+ icol (* 2 octave-block-offset)))) | 674 | (setq icol (+ icol (* 2 octave-block-offset)))) |
| 663 | ((looking-at octave-block-begin-regexp) | 675 | ((octave-looking-at-kw octave-block-begin-regexp) |
| 664 | (setq icol (+ icol octave-block-offset))) | 676 | (setq icol (+ icol octave-block-offset))) |
| 665 | ((looking-at octave-block-else-regexp) | 677 | ((octave-looking-at-kw octave-block-else-regexp) |
| 666 | (if (= bot (point)) | 678 | (if (= bot (point)) |
| 667 | (setq icol (+ icol octave-block-offset)))) | 679 | (setq icol (+ icol octave-block-offset)))) |
| 668 | ((looking-at octave-block-end-regexp) | 680 | ((octave-looking-at-kw octave-block-end-regexp) |
| 669 | (if (not (= bot (point))) | 681 | (if (not (= bot (point))) |
| 670 | (setq icol (- icol | 682 | (setq icol (- icol |
| 671 | (octave-block-end-offset))))))) | 683 | (octave-block-end-offset))))))) |
| @@ -675,10 +687,10 @@ level." | |||
| 675 | (save-excursion | 687 | (save-excursion |
| 676 | (back-to-indentation) | 688 | (back-to-indentation) |
| 677 | (cond | 689 | (cond |
| 678 | ((and (looking-at octave-block-else-regexp) | 690 | ((and (octave-looking-at-kw octave-block-else-regexp) |
| 679 | (octave-not-in-string-or-comment-p)) | 691 | (octave-not-in-string-or-comment-p)) |
| 680 | (setq icol (- icol octave-block-offset))) | 692 | (setq icol (- icol octave-block-offset))) |
| 681 | ((and (looking-at octave-block-end-regexp) | 693 | ((and (octave-looking-at-kw octave-block-end-regexp) |
| 682 | (octave-not-in-string-or-comment-p)) | 694 | (octave-not-in-string-or-comment-p)) |
| 683 | (setq icol (- icol (octave-block-end-offset)))) | 695 | (setq icol (- icol (octave-block-end-offset)))) |
| 684 | ((or (looking-at "\\s<\\s<\\s<\\S<") | 696 | ((or (looking-at "\\s<\\s<\\s<\\S<") |
| @@ -854,8 +866,8 @@ an error is signaled." | |||
| 854 | (save-excursion | 866 | (save-excursion |
| 855 | (while (/= count 0) | 867 | (while (/= count 0) |
| 856 | (catch 'foo | 868 | (catch 'foo |
| 857 | (while (or (re-search-forward | 869 | (while (or (octave-re-search-forward-kw |
| 858 | octave-block-begin-or-end-regexp nil 'move inc) | 870 | octave-block-begin-or-end-regexp) |
| 859 | (if (/= depth 0) | 871 | (if (/= depth 0) |
| 860 | (error "Unbalanced block"))) | 872 | (error "Unbalanced block"))) |
| 861 | (if (octave-not-in-string-or-comment-p) | 873 | (if (octave-not-in-string-or-comment-p) |
| @@ -974,7 +986,7 @@ Signal an error if the keywords are incompatible." | |||
| 974 | (looking-at "\\>") | 986 | (looking-at "\\>") |
| 975 | (save-excursion | 987 | (save-excursion |
| 976 | (skip-syntax-backward "w") | 988 | (skip-syntax-backward "w") |
| 977 | (looking-at octave-block-else-or-end-regexp))) | 989 | (octave-looking-at-kw octave-block-else-or-end-regexp))) |
| 978 | (save-excursion | 990 | (save-excursion |
| 979 | (cond | 991 | (cond |
| 980 | ((match-end 1) | 992 | ((match-end 1) |
| @@ -1021,11 +1033,11 @@ Returns t unless search stops at the beginning or end of the buffer." | |||
| 1021 | (inc (if (> arg 0) 1 -1)) | 1033 | (inc (if (> arg 0) 1 -1)) |
| 1022 | (found)) | 1034 | (found)) |
| 1023 | (and (not (eobp)) | 1035 | (and (not (eobp)) |
| 1024 | (not (and (> arg 0) (looking-at "\\<function\\>"))) | 1036 | (not (and (> arg 0) (octave-looking-at-kw "\\<function\\>"))) |
| 1025 | (skip-syntax-forward "w")) | 1037 | (skip-syntax-forward "w")) |
| 1026 | (while (and (/= arg 0) | 1038 | (while (and (/= arg 0) |
| 1027 | (setq found | 1039 | (setq found |
| 1028 | (re-search-backward "\\<function\\>" nil 'move inc))) | 1040 | (octave-re-search-backward-kw "\\<function\\>"))) |
| 1029 | (if (octave-not-in-string-or-comment-p) | 1041 | (if (octave-not-in-string-or-comment-p) |
| 1030 | (setq arg (- arg inc)))) | 1042 | (setq arg (- arg inc)))) |
| 1031 | (if found | 1043 | (if found |
| @@ -1078,7 +1090,7 @@ otherwise." | |||
| 1078 | (save-excursion | 1090 | (save-excursion |
| 1079 | (beginning-of-line) | 1091 | (beginning-of-line) |
| 1080 | (and auto-fill-inhibit-regexp | 1092 | (and auto-fill-inhibit-regexp |
| 1081 | (looking-at auto-fill-inhibit-regexp)))) | 1093 | (octave-looking-at-kw auto-fill-inhibit-regexp)))) |
| 1082 | nil ; Can't do anything | 1094 | nil ; Can't do anything |
| 1083 | (if (and (not (octave-in-comment-p)) | 1095 | (if (and (not (octave-in-comment-p)) |
| 1084 | (> (current-column) fc)) | 1096 | (> (current-column) fc)) |