aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2013-05-18 06:46:10 +0800
committerLeo Liu2013-05-18 06:46:10 +0800
commit42caeb895d159d7b3d32e5f4873b063b6759e244 (patch)
tree6a47930d7c1547d35ee318693ffe36306e7316b7
parent0a1691786d832afd0e0b681ecc71538fb63eec2b (diff)
downloademacs-42caeb895d159d7b3d32e5f4873b063b6759e244.tar.gz
emacs-42caeb895d159d7b3d32e5f4873b063b6759e244.zip
* newcomment.el (comment-search-backward): Stricter in finding
comment start. * progmodes/octave.el (octave-comment-start): Remove the SPC char. (octave-comment-start-skip): Properly anchored. Fixes: debbugs:14303
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/newcomment.el44
-rw-r--r--lisp/progmodes/octave.el9
3 files changed, 35 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 12ae5239f13..f07354cfe5d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
12013-05-17 Leo Liu <sdl.web@gmail.com> 12013-05-17 Leo Liu <sdl.web@gmail.com>
2 2
3 * newcomment.el (comment-search-backward): Stricter in finding
4 comment start. (Bug#14303)
5
6 * progmodes/octave.el (octave-comment-start): Remove the SPC char.
7 (octave-comment-start-skip): Properly anchored.
8
92013-05-17 Leo Liu <sdl.web@gmail.com>
10
3 * emacs-lisp/smie.el (smie-highlight-matching-block-mode): Clean 11 * emacs-lisp/smie.el (smie-highlight-matching-block-mode): Clean
4 up when turned off. (Bug#14395) 12 up when turned off. (Bug#14395)
5 (smie--highlight-matching-block-overlay): No longer buffer-local. 13 (smie--highlight-matching-block-overlay): No longer buffer-local.
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index bcb5f721ae8..e10b96f97f9 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -485,27 +485,29 @@ and raises an error or returns nil if NOERROR is non-nil."
485Moves point to inside the comment and returns the position of the 485Moves point to inside the comment and returns the position of the
486comment-starter. If no comment is found, moves point to LIMIT 486comment-starter. If no comment is found, moves point to LIMIT
487and raises an error or returns nil if NOERROR is non-nil." 487and raises an error or returns nil if NOERROR is non-nil."
488 ;; FIXME: If a comment-start appears inside a comment, we may erroneously 488 (let (found end)
489 ;; stop there. This can be rather bad in general, but since 489 (while (and (not found)
490 ;; comment-search-backward is only used to find the comment-column (in 490 (re-search-backward comment-start-skip limit t))
491 ;; comment-set-column) and to find the comment-start string (via 491 (setq end (match-end 0))
492 ;; comment-beginning) in indent-new-comment-line, it should be harmless. 492 (unless (and comment-use-syntax
493 (if (not (re-search-backward comment-start-skip limit t)) 493 (nth 8 (syntax-ppss (or (match-end 1)
494 (unless noerror (error "No comment")) 494 (match-beginning 0)))))
495 (beginning-of-line) 495 (setq found t)))
496 (let* ((end (match-end 0)) 496 (if (not found)
497 (cs (comment-search-forward end t)) 497 (unless noerror (error "No comment"))
498 (pt (point))) 498 (beginning-of-line)
499 (if (not cs) 499 (let ((cs (comment-search-forward end t))
500 (progn (beginning-of-line) 500 (pt (point)))
501 (comment-search-backward limit noerror)) 501 (if (not cs)
502 (while (progn (goto-char cs) 502 (progn (beginning-of-line)
503 (comment-forward) 503 (comment-search-backward limit noerror))
504 (and (< (point) end) 504 (while (progn (goto-char cs)
505 (setq cs (comment-search-forward end t)))) 505 (comment-forward)
506 (setq pt (point))) 506 (and (< (point) end)
507 (goto-char pt) 507 (setq cs (comment-search-forward end t))))
508 cs)))) 508 (setq pt (point)))
509 (goto-char pt)
510 cs)))))
509 511
510(defun comment-beginning () 512(defun comment-beginning ()
511 "Find the beginning of the enclosing comment. 513 "Find the beginning of the enclosing comment.
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index 451ac2791a7..26fb254af5f 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -62,12 +62,11 @@ Used in `octave-mode' and `inferior-octave-mode' buffers.")
62(defvar octave-comment-char ?# 62(defvar octave-comment-char ?#
63 "Character to start an Octave comment.") 63 "Character to start an Octave comment.")
64 64
65(defvar octave-comment-start 65(defvar octave-comment-start (char-to-string octave-comment-char)
66 (string octave-comment-char ?\s) 66 "Octave-specific `comment-start' (which see).")
67 "String to insert to start a new Octave in-line comment.")
68 67
69(defvar octave-comment-start-skip "\\(?:%!\\|\\s<+\\)\\s-*" 68(defvar octave-comment-start-skip "\\(^\\|\\S<\\)\\(?:%!\\|\\s<+\\)\\s-*"
70 "Regexp to match the start of an Octave comment up to its body.") 69 "Octave-specific `comment-start-skip' (which see).")
71 70
72(defvar octave-begin-keywords 71(defvar octave-begin-keywords
73 '("classdef" "do" "enumeration" "events" "for" "function" "if" "methods" 72 '("classdef" "do" "enumeration" "events" "for" "function" "if" "methods"