diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2005-11-20 18:09:09 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2005-11-20 18:09:09 +0000 |
commit | 3cc4b07630a868e42c3ca30aec47e0654989a978 (patch) | |
tree | 0f2124ba556d1439182e83e2729eee3689a2c348 /lisp/newcomment.el | |
parent | 1c4b7278d6d3c405e06eacb735d588112bc463d8 (diff) | |
download | emacs-3cc4b07630a868e42c3ca30aec47e0654989a978.tar.gz |
*** empty log message ***
Diffstat (limited to 'lisp/newcomment.el')
-rw-r--r-- | lisp/newcomment.el | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 938cd5fe141..7716a704359 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -478,19 +478,22 @@ Point is assumed to be just at the end of a comment." (if (bolp) ;; comment-end = "" (progn (backward-char) (skip-syntax-backward " ")) - (let ((end (point))) - (beginning-of-line) - (save-restriction - (narrow-to-region (point) end) - (if (re-search-forward (concat comment-end-skip "\\'") nil t) - (goto-char (match-beginning 0)) - ;; comment-end-skip not found probably because it was not set right. - ;; Since \\s> should catch the single-char case, we'll blindly - ;; assume we're at the end of a two-char comment-end. - (goto-char (point-max)) - (backward-char 2) - (skip-chars-backward (string (char-after))) - (skip-syntax-backward " ")))))) + (cond + ((save-restriction + (beginning-of-line) + (narrow-to-region (point) end) + (re-search-forward (concat comment-end-skip "\\'") nil t)) + (goto-char (match-beginning 0))) + ;; comment-end-skip not found. Maybe we're at EOB which implicitly + ;; closes the comment. + ((eobp) (skip-syntax-backward " ")) + (t + ;; else comment-end-skip was not found probably because it was not + ;; set right. Since \\s> should catch the single-char case, we'll + ;; blindly assume we're at the end of a two-char comment-end. + (backward-char 2) + (skip-chars-backward (string (char-after))) + (skip-syntax-backward " "))))) ;;;; ;;;; Commands |