aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2001-03-02 20:31:48 +0000
committerStefan Monnier2001-03-02 20:31:48 +0000
commit75ed43a6a2c1fe63f0021e2aa4a42942a2fbc522 (patch)
treefa8142a819133786a236638cc2d98413c8377e1d
parentb1f865ae18a7c04e37c0e2dddab79b586265afb8 (diff)
downloademacs-75ed43a6a2c1fe63f0021e2aa4a42942a2fbc522.tar.gz
emacs-75ed43a6a2c1fe63f0021e2aa4a42942a2fbc522.zip
(comment-normalize-vars): Use [ \t] for the trailing
spaces in default comment-start-skip settings rather than \s-.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/newcomment.el27
2 files changed, 21 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 12abcfb2502..ddd6105ccad 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12001-03-02 Stefan Monnier <monnier@cs.yale.edu>
2
3 * newcomment.el (comment-normalize-vars): Use [ \t] for the trailing
4 spaces in default comment-start-skip settings rather than \s-.
5
12001-03-02 Eli Zaretskii <eliz@is.elta.co.il> 62001-03-02 Eli Zaretskii <eliz@is.elta.co.il>
2 7
3 * term/pc-win.el (msdos-handle-reverse-video): Look for reverse in 8 * term/pc-win.el (msdos-handle-reverse-video): Look for reverse in
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 09b928dea26..9ddcda42769 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -5,7 +5,7 @@
5;; Author: code extracted from Emacs-20's simple.el 5;; Author: code extracted from Emacs-20's simple.el
6;; Maintainer: Stefan Monnier <monnier@cs.yale.edu> 6;; Maintainer: Stefan Monnier <monnier@cs.yale.edu>
7;; Keywords: comment uncomment 7;; Keywords: comment uncomment
8;; Revision: $Id: newcomment.el,v 1.29 2000/12/18 03:17:31 monnier Exp $ 8;; Revision: $Id: newcomment.el,v 1.30 2001/02/22 01:47:40 monnier Exp $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -233,7 +233,9 @@ This is obsolete because you might as well use \\[newline-and-indent]."
233 (set (make-local-variable 'comment-start-skip) 233 (set (make-local-variable 'comment-start-skip)
234 (concat "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(\\s<+\\|" 234 (concat "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(\\s<+\\|"
235 (regexp-quote (comment-string-strip comment-start t t)) 235 (regexp-quote (comment-string-strip comment-start t t))
236 "+\\)\\s-*"))) 236 ;; Let's not allow any \s- but only [ \t] since \n
237 ;; might be both a comment-end marker and \s-.
238 "+\\)[ \t]*")))
237 (unless comment-end-skip 239 (unless comment-end-skip
238 (let ((ce (if (string= "" comment-end) "\n" 240 (let ((ce (if (string= "" comment-end) "\n"
239 (comment-string-strip comment-end t t)))) 241 (comment-string-strip comment-end t t))))
@@ -346,15 +348,18 @@ and raises an error or returns nil of NOERROR is non-nil."
346 "Find the beginning of the enclosing comment. 348 "Find the beginning of the enclosing comment.
347Returns nil if not inside a comment, else moves point and returns 349Returns nil if not inside a comment, else moves point and returns
348the same as `comment-search-forward'." 350the same as `comment-search-forward'."
349 (let ((pt (point)) 351 ;; HACK ATTACK!
350 (cs (comment-search-backward nil t))) 352 ;; We should really test `in-string-p' but that can be expensive.
351 (when cs 353 (unless (eq (get-text-property (point) 'face) 'font-lock-string-face)
352 (if (save-excursion 354 (let ((pt (point))
353 (goto-char cs) 355 (cs (comment-search-backward nil t)))
354 (if (comment-forward 1) (> (point) pt) (eobp))) 356 (when cs
355 cs 357 (if (save-excursion
356 (goto-char pt) 358 (goto-char cs)
357 nil)))) 359 (if (comment-forward 1) (> (point) pt) (eobp)))
360 cs
361 (goto-char pt)
362 nil)))))
358 363
359(defun comment-forward (&optional n) 364(defun comment-forward (&optional n)
360 "Skip forward over N comments. 365 "Skip forward over N comments.