2004-02-29 Dave Love * newcomment.el (comment-search-forward): Use syntax-ppss to DTRT in strings. --- /home/fx/esrc/lisp/newcomment.el~ 2004-02-20 21:46:38.000000000 +0000 +++ /home/fx/esrc/lisp/newcomment.el 2004-02-29 19:51:19.000000000 +0000 @@ -347,22 +347,15 @@ "Find a comment start between point and LIMIT. Moves point to inside the comment and returns the position of the comment-starter. If no comment is found, moves point to LIMIT -and raises an error or returns nil of NOERROR is non-nil." +and raises an error, or returns nil of NOERROR is non-nil." (if (not comment-use-syntax) (if (re-search-forward comment-start-skip limit noerror) (or (match-end 1) (match-beginning 0)) (goto-char limit) (unless noerror (error "No comment"))) (let* ((pt (point)) - ;; Assume (at first) that pt is outside of any string. - (s (parse-partial-sexp pt (or limit (point-max)) nil nil nil t))) - (when (and (nth 8 s) (nth 3 s)) - ;; The search ended inside a string. Try to see if it - ;; works better when we assume that pt is inside a string. - (setq s (parse-partial-sexp - pt (or limit (point-max)) nil nil - (list nil nil nil (nth 3 s) nil nil nil nil) - t))) + (s (parse-partial-sexp pt (or limit (point-max)) nil nil + (syntax-ppss) t))) (if (not (and (nth 8 s) (not (nth 3 s)))) (unless noerror (error "No comment")) ;; We found the comment.