aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/octave-mod.el
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2003-10-24 18:58:28 +0000
committerStefan Monnier <[email protected]>2003-10-24 18:58:28 +0000
commitcb3d3ec192d67e0799919123da6eb0cd46e09776 (patch)
tree2169947bd3843396b3afa4d47897aa41d5b20515 /lisp/progmodes/octave-mod.el
parent418b094bd56cc761a13954d5f0d583fdf8f4bc5e (diff)
(octave-comment-start): Simplify.
(octave-mode-syntax-table): Add % as a comment starter. (octave-point): Remove. (octave-in-comment-p, octave-in-string-p) (octave-not-in-string-or-comment-p, calculate-octave-indent) (octave-blink-matching-block-open, octave-auto-fill): Use line-(beginning|end)-position instead.
Diffstat (limited to 'lisp/progmodes/octave-mod.el')
-rw-r--r--lisp/progmodes/octave-mod.el38
1 files changed, 12 insertions, 26 deletions
diff --git a/lisp/progmodes/octave-mod.el b/lisp/progmodes/octave-mod.el
index 6cd6b03bc0..281edfd693 100644
--- a/lisp/progmodes/octave-mod.el
+++ b/lisp/progmodes/octave-mod.el
@@ -1,6 +1,6 @@
;;; octave-mod.el --- editing Octave source files under Emacs
-;; Copyright (C) 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2003 Free Software Foundation, Inc.
;; Author: Kurt Hornik <[email protected]>
;; Author: John Eaton <[email protected]>
@@ -94,7 +94,7 @@ All Octave abbrevs start with a grave accent (`).")
(defvar octave-comment-char ?#
"Character to start an Octave comment.")
(defvar octave-comment-start
- (concat (make-string 1 octave-comment-char) " ")
+ (string octave-comment-char ?\ )
"String to insert to start a new Octave in-line comment.")
(defvar octave-comment-start-skip "\\s<+\\s-*"
"Regexp to match the start of an Octave comment up to its body.")
@@ -287,10 +287,7 @@ parenthetical grouping.")
["Lookup Octave Index" octave-help t])
"Menu for Octave mode.")
-(defvar octave-mode-syntax-table nil
- "Syntax table in use in octave-mode buffers.")
-(if octave-mode-syntax-table
- ()
+(defvar octave-mode-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\r " " table)
(modify-syntax-entry ?+ "." table)
@@ -309,10 +306,11 @@ parenthetical grouping.")
(modify-syntax-entry ?\" "\"" table)
(modify-syntax-entry ?. "w" table)
(modify-syntax-entry ?_ "w" table)
- (modify-syntax-entry ?\% "." table)
+ (modify-syntax-entry ?\% "<" table)
(modify-syntax-entry ?\# "<" table)
(modify-syntax-entry ?\n ">" table)
- (setq octave-mode-syntax-table table)))
+ table)
+ "Syntax table in use in `octave-mode' buffers.")
(defcustom octave-auto-indent nil
"*Non-nil means indent line after a semicolon or space in Octave mode."
@@ -565,33 +563,21 @@ including a reproducible test case and send the message."
(interactive)
(describe-function major-mode))
-(defun octave-point (position)
- "Returns the value of point at certain positions."
- (save-excursion
- (cond
- ((eq position 'bol) (beginning-of-line))
- ((eq position 'eol) (end-of-line))
- ((eq position 'boi) (back-to-indentation))
- ((eq position 'bonl) (forward-line 1))
- ((eq position 'bopl) (forward-line -1))
- (t (error "unknown buffer position requested: %s" position)))
- (point)))
-
(defsubst octave-in-comment-p ()
"Returns t if point is inside an Octave comment, nil otherwise."
(interactive)
(save-excursion
- (nth 4 (parse-partial-sexp (octave-point 'bol) (point)))))
+ (nth 4 (parse-partial-sexp (line-beginning-position) (point)))))
(defsubst octave-in-string-p ()
"Returns t if point is inside an Octave string, nil otherwise."
(interactive)
(save-excursion
- (nth 3 (parse-partial-sexp (octave-point 'bol) (point)))))
+ (nth 3 (parse-partial-sexp (line-beginning-position) (point)))))
(defsubst octave-not-in-string-or-comment-p ()
"Returns t iff point is not inside an Octave string or comment."
- (let ((pps (parse-partial-sexp (octave-point 'bol) (point))))
+ (let ((pps (parse-partial-sexp (line-beginning-position) (point))))
(not (or (nth 3 pps) (nth 4 pps)))))
(defun octave-in-block-p ()
@@ -682,7 +668,7 @@ level."
(back-to-indentation)
(setq icol (current-column))
(let ((bot (point))
- (eol (octave-point 'eol)))
+ (eol (line-end-position)))
(while (< (point) eol)
(if (octave-not-in-string-or-comment-p)
(cond
@@ -1017,7 +1003,7 @@ Signal an error if the keywords are incompatible."
(buffer-substring-no-properties
(match-beginning 0) pos)
pos (+ pos 1)
- eol (octave-point 'eol)
+ eol (line-end-position)
bb-arg
(save-excursion
(save-restriction
@@ -1123,7 +1109,7 @@ otherwise."
(if (save-excursion
(skip-syntax-backward " <")
(bolp))
- (re-search-forward "[ \t]" (octave-point 'eol)
+ (re-search-forward "[ \t]" (line-end-position)
'move))
;; If we're not in a comment line and just ahead the
;; continuation string, don't break here.