[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r116790: Further tweaks for comment-start-skip behav
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] trunk r116790: Further tweaks for comment-start-skip behavior |
Date: |
Tue, 18 Mar 2014 06:06:46 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116790
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16971
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-03-18 08:06:33 +0200
message:
Further tweaks for comment-start-skip behavior
* lisp/newcomment.el (comment-normalize-vars): Only add escaping check
to `comment-start-skip' if not `comment-use-syntax'.
(comment-beginning): Use `narrow-to-region' instead of moving back
one character.
(http://lists.gnu.org/archive/html/emacs-devel/2014-03/msg00488.html)
(comment-start-skip): Update the docstring.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/newcomment.el
newcomment.el-20091113204419-o5vbwnq5f7feedwu-1719
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-03-18 01:51:12 +0000
+++ b/lisp/ChangeLog 2014-03-18 06:06:33 +0000
@@ -1,3 +1,12 @@
+2014-03-18 Dmitry Gutov <address@hidden>
+
+ * newcomment.el (comment-normalize-vars): Only add escaping check
+ to `comment-start-skip' if not `comment-use-syntax'. (Bug#16971)
+ (comment-beginning): Use `narrow-to-region' instead of moving back
+ one character.
+ (http://lists.gnu.org/archive/html/emacs-devel/2014-03/msg00488.html)
+ (comment-start-skip): Update the docstring.
+
2014-03-18 Daniel Colascione <address@hidden>
* startup.el (tty-handle-args): Remove debug message from 2007.
=== modified file 'lisp/newcomment.el'
--- a/lisp/newcomment.el 2014-03-17 06:48:09 +0000
+++ b/lisp/newcomment.el 2014-03-18 06:06:33 +0000
@@ -120,8 +120,9 @@
;;;###autoload
(defvar comment-start-skip nil
"Regexp to match the start of a comment plus everything up to its body.
-If there are any \\(...\\) pairs, the comment delimiter text is held to begin
-at the place matched by the close of the first pair.")
+If there are any \\(...\\) pairs and `comment-use-syntax' is nil,
+the comment delimiter text is held to begin at the place matched
+by the close of the first pair.")
;;;###autoload
(put 'comment-start-skip 'safe-local-variable 'stringp)
@@ -378,7 +379,10 @@
;; In case comment-start has changed since last time.
(string-match comment-start-skip comment-start))
(set (make-local-variable 'comment-start-skip)
- (concat "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(\\s<+\\|"
+ (concat (unless (eq comment-use-syntax t)
+ ;; `syntax-ppss' will detect escaping.
+ "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)")
+ "\\(\\s<+\\|"
(regexp-quote (comment-string-strip comment-start t t))
;; Let's not allow any \s- but only [ \t] since \n
;; might be both a comment-end marker and \s-.
@@ -523,12 +527,11 @@
(when (nth 4 state)
(goto-char (nth 8 state))
(prog1 (point)
- (when (or (looking-at comment-start-skip)
- ;; Some older modes use regexps that check the
- ;; char before the comment for quoting. (Bug#16971)
- (save-excursion
- (forward-char -1)
- (looking-at comment-start-skip)))
+ (when (save-restriction
+ ;; `comment-start-skip' sometimes checks that the
+ ;; comment char is not escaped. (Bug#16971)
+ (narrow-to-region (point) (point-max))
+ (looking-at comment-start-skip))
(goto-char (match-end 0))))))
;; Can't rely on the syntax table, let's guess based on font-lock.
(unless (eq (get-text-property (point) 'face) 'font-lock-string-face)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r116790: Further tweaks for comment-start-skip behavior,
Dmitry Gutov <=