aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2011-04-19 12:33:34 -0300
committerStefan Monnier <[email protected]>2011-04-19 12:33:34 -0300
commit602ea69dc7a93969742958ee6af3feae23cd1e02 (patch)
tree044639275d20a34534c7442dd72b5807dfedbcda
parent06b605171f1c9d8b42bd3326a243b8b03d2e4e58 (diff)
* lisp/progmodes/octave-mod.el (octave-in-comment-p, octave-in-string-p)
(octave-not-in-string-or-comment-p): Use syntax-ppss so it works with multi-line comments as well.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/progmodes/octave-mod.el26
2 files changed, 16 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 22c9813b5c..66f854da5e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-19 Stefan Monnier <[email protected]>
+
+ * progmodes/octave-mod.el (octave-in-comment-p, octave-in-string-p)
+ (octave-not-in-string-or-comment-p): Use syntax-ppss so it works with
+ multi-line comments as well.
+
2011-04-19 Juanma Barranquero <[email protected]>
Lexical-binding cleanup.
diff --git a/lisp/progmodes/octave-mod.el b/lisp/progmodes/octave-mod.el
index 7ec4cf3d94..8bf9ff299d 100644
--- a/lisp/progmodes/octave-mod.el
+++ b/lisp/progmodes/octave-mod.el
@@ -182,7 +182,7 @@ parenthetical grouping.")
(goto-char start)
(octave-syntax-propertize-sqs end)
(funcall (syntax-propertize-rules
- ;; Try to distinguish the string-quotes from the transpose-quotes.
+ ;; Try to distinguish the string-quotes from the transpose-quotes.
("[[({,; ]\\('\\)"
(1 (prog1 "\"'" (octave-syntax-propertize-sqs end)))))
(point) end))
@@ -190,15 +190,15 @@ parenthetical grouping.")
(defun octave-syntax-propertize-sqs (end)
"Propertize the content/end of single-quote strings."
(when (eq (nth 3 (syntax-ppss)) ?\')
- ;; A '..' string.
+ ;; A '..' string.
(when (re-search-forward
"\\(?:\\=\\|[^']\\)\\(?:''\\)*\\('\\)\\($\\|[^']\\)" end 'move)
(goto-char (match-beginning 2))
- (when (eq (char-before (match-beginning 1)) ?\\)
- ;; Backslash cannot escape a single quote.
- (put-text-property (1- (match-beginning 1)) (match-beginning 1)
- 'syntax-table (string-to-syntax ".")))
- (put-text-property (match-beginning 1) (match-end 1)
+ (when (eq (char-before (match-beginning 1)) ?\\)
+ ;; Backslash cannot escape a single quote.
+ (put-text-property (1- (match-beginning 1)) (match-beginning 1)
+ 'syntax-table (string-to-syntax ".")))
+ (put-text-property (match-beginning 1) (match-end 1)
'syntax-table (string-to-syntax "\"'")))))
(defcustom inferior-octave-buffer "*Inferior Octave*"
@@ -668,20 +668,15 @@ Look up symbol in the function, operator and variable indices of the info files.
(defsubst octave-in-comment-p ()
"Return t if point is inside an Octave comment."
- (save-excursion
- ;; FIXME: use syntax-ppss?
- (nth 4 (parse-partial-sexp (line-beginning-position) (point)))))
+ (nth 4 (syntax-ppss)))
(defsubst octave-in-string-p ()
"Return t if point is inside an Octave string."
- (save-excursion
- ;; FIXME: use syntax-ppss?
- (nth 3 (parse-partial-sexp (line-beginning-position) (point)))))
+ (nth 3 (syntax-ppss)))
(defsubst octave-not-in-string-or-comment-p ()
"Return t if point is not inside an Octave string or comment."
- ;; FIXME: Use syntax-ppss?
- (let ((pps (parse-partial-sexp (line-beginning-position) (point))))
+ (let ((pps (syntax-ppss)))
(not (or (nth 3 pps) (nth 4 pps)))))
@@ -698,7 +693,6 @@ Look up symbol in the function, operator and variable indices of the info files.
nil
(delete-horizontal-space)
(insert (concat " " octave-continuation-string))))
-
;;; Indentation