[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r103948: * lisp/progmodes/octave-mod.
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r103948: * lisp/progmodes/octave-mod.el (octave-in-comment-p, octave-in-string-p) |
Date: |
Tue, 19 Apr 2011 12:33:34 -0300 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 103948
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2011-04-19 12:33:34 -0300
message:
* 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.
modified:
lisp/ChangeLog
lisp/progmodes/octave-mod.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-04-19 13:44:55 +0000
+++ b/lisp/ChangeLog 2011-04-19 15:33:34 +0000
@@ -1,3 +1,9 @@
+2011-04-19 Stefan Monnier <address@hidden>
+
+ * 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 <address@hidden>
Lexical-binding cleanup.
=== modified file 'lisp/progmodes/octave-mod.el'
--- a/lisp/progmodes/octave-mod.el 2011-01-25 04:08:28 +0000
+++ b/lisp/progmodes/octave-mod.el 2011-04-19 15:33:34 +0000
@@ -182,7 +182,7 @@
(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 @@
(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 @@
(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 @@
nil
(delete-horizontal-space)
(insert (concat " " octave-continuation-string))))
-
;;; Indentation
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r103948: * lisp/progmodes/octave-mod.el (octave-in-comment-p, octave-in-string-p),
Stefan Monnier <=