[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/octave-mod.el,v
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/octave-mod.el,v |
Date: |
Sat, 13 Oct 2007 20:01:20 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Glenn Morris <gm> 07/10/13 20:01:20
Index: octave-mod.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/octave-mod.el,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- octave-mod.el 6 Oct 2007 01:48:02 -0000 1.39
+++ octave-mod.el 13 Oct 2007 20:01:20 -0000 1.40
@@ -581,13 +581,25 @@
(error nil))
(< pos (point)))))
+(defun octave-looking-at-kw (regexp)
+ (let ((case-fold-search nil))
+ (looking-at regexp)))
+
+(defun octave-re-search-forward-kw (regexp)
+ (let ((case-fold-search nil))
+ (re-search-forward regexp nil 'move inc)))
+
+(defun octave-re-search-backward-kw (regexp)
+ (let ((case-fold-search nil))
+ (re-search-backward regexp nil 'move inc)))
+
(defun octave-in-defun-p ()
"Return t if point is inside an Octave function declaration.
The function is taken to start at the `f' of `function' and to end after
the end keyword."
(let ((pos (point)))
(save-excursion
- (or (and (looking-at "\\<function\\>")
+ (or (and (octave-looking-at-kw "\\<function\\>")
(octave-not-in-string-or-comment-p))
(and (octave-beginning-of-defun)
(condition-case nil
@@ -658,14 +670,14 @@
(while (< (point) eol)
(if (octave-not-in-string-or-comment-p)
(cond
- ((looking-at "\\<switch\\>")
+ ((octave-looking-at-kw "\\<switch\\>")
(setq icol (+ icol (* 2 octave-block-offset))))
- ((looking-at octave-block-begin-regexp)
+ ((octave-looking-at-kw octave-block-begin-regexp)
(setq icol (+ icol octave-block-offset)))
- ((looking-at octave-block-else-regexp)
+ ((octave-looking-at-kw octave-block-else-regexp)
(if (= bot (point))
(setq icol (+ icol octave-block-offset))))
- ((looking-at octave-block-end-regexp)
+ ((octave-looking-at-kw octave-block-end-regexp)
(if (not (= bot (point)))
(setq icol (- icol
(octave-block-end-offset)))))))
@@ -675,10 +687,10 @@
(save-excursion
(back-to-indentation)
(cond
- ((and (looking-at octave-block-else-regexp)
+ ((and (octave-looking-at-kw octave-block-else-regexp)
(octave-not-in-string-or-comment-p))
(setq icol (- icol octave-block-offset)))
- ((and (looking-at octave-block-end-regexp)
+ ((and (octave-looking-at-kw octave-block-end-regexp)
(octave-not-in-string-or-comment-p))
(setq icol (- icol (octave-block-end-offset))))
((or (looking-at "\\s<\\s<\\s<\\S<")
@@ -854,8 +866,8 @@
(save-excursion
(while (/= count 0)
(catch 'foo
- (while (or (re-search-forward
- octave-block-begin-or-end-regexp nil 'move inc)
+ (while (or (octave-re-search-forward-kw
+ octave-block-begin-or-end-regexp)
(if (/= depth 0)
(error "Unbalanced block")))
(if (octave-not-in-string-or-comment-p)
@@ -974,7 +986,7 @@
(looking-at "\\>")
(save-excursion
(skip-syntax-backward "w")
- (looking-at octave-block-else-or-end-regexp)))
+ (octave-looking-at-kw octave-block-else-or-end-regexp)))
(save-excursion
(cond
((match-end 1)
@@ -1021,11 +1033,11 @@
(inc (if (> arg 0) 1 -1))
(found))
(and (not (eobp))
- (not (and (> arg 0) (looking-at "\\<function\\>")))
+ (not (and (> arg 0) (octave-looking-at-kw "\\<function\\>")))
(skip-syntax-forward "w"))
(while (and (/= arg 0)
(setq found
- (re-search-backward "\\<function\\>" nil 'move inc)))
+ (octave-re-search-backward-kw "\\<function\\>")))
(if (octave-not-in-string-or-comment-p)
(setq arg (- arg inc))))
(if found
@@ -1078,7 +1090,7 @@
(save-excursion
(beginning-of-line)
(and auto-fill-inhibit-regexp
- (looking-at auto-fill-inhibit-regexp))))
+ (octave-looking-at-kw auto-fill-inhibit-regexp))))
nil ; Can't do anything
(if (and (not (octave-in-comment-p))
(> (current-column) fc))