changeset 4570:32b491743d40

[project @ 2003-10-30 15:28:08 by jwe]
author jwe
date Thu, 30 Oct 2003 15:28:09 +0000
parents 01e4957409a4
children ef4bdde0805d
files ChangeLog emacs/octave-mod.el
diffstat 2 files changed, 19 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Oct 30 05:48:17 2003 +0000
+++ b/ChangeLog	Thu Oct 30 15:28:09 2003 +0000
@@ -1,3 +1,12 @@
+2003-10-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* emacs/octave-mod.el (octave-comment-start): Simplify.
+	(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.
+
 2003-10-29  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* emacs/octave-inf.el (inferior-octave-prompt): Don't bother
--- a/emacs/octave-mod.el	Thu Oct 30 05:48:17 2003 +0000
+++ b/emacs/octave-mod.el	Thu Oct 30 15:28:09 2003 +0000
@@ -96,7 +96,7 @@
 (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.")
@@ -292,10 +292,7 @@
 	["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)
@@ -317,7 +314,8 @@
     (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."
@@ -571,33 +569,21 @@
   (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 ()
@@ -688,7 +674,7 @@
 	      (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
@@ -1023,7 +1009,7 @@
 		(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
@@ -1129,7 +1115,7 @@
 		  (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.