aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2001-12-14 21:53:29 +0000
committerStefan Monnier <[email protected]>2001-12-14 21:53:29 +0000
commit7a06b25076fe26a4975da834dd97912bc70c3c32 (patch)
tree7a7341dd7903f8ed50772dd77c55623e31ad9a92
parent47a31c6bab51918c70bc70b6cd0574f9ada1fc9f (diff)
(comment-indent): Jump to the middle of empty comments.
-rw-r--r--lisp/newcomment.el13
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index ed67c12f7f..c5d6849415 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -5,7 +5,7 @@
;; Author: code extracted from Emacs-20's simple.el
;; Maintainer: Stefan Monnier <[email protected]>
;; Keywords: comment uncomment
-;; Revision: $Id: newcomment.el,v 1.41 2001/11/29 21:29:36 monnier Exp $
+;; Revision: $Id: newcomment.el,v 1.42 2001/12/02 04:19:32 monnier Exp $
;; This file is part of GNU Emacs.
@@ -30,7 +30,6 @@
;;; Bugs:
-;; - comment-indent on /* */ jumps to /* ><*/ instead of /* >< */.
;; - nested comments in sgml-mode are not properly quoted.
;; - single-char nestable comment-start can only do the "\\s<+" stuff
;; if the corresponding closing marker happens to be right.
@@ -450,7 +449,15 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any."
(begpos (comment-search-forward eolpos t))
cpos indent)
;; An existing comment?
- (if begpos (setq cpos (point-marker))
+ (if begpos
+ (progn
+ (if (and (not (looking-at "[\t\n ]"))
+ (looking-at comment-end-skip))
+ ;; The comment is empty and we have skipped all its space
+ ;; and landed right before the comment-ender:
+ ;; Go back to the middle of the space.
+ (forward-char (/ (skip-chars-backward " \t") -2)))
+ (setq cpos (point-marker)))
;; If none, insert one.
(save-excursion
;; Some comment-indent-function insist on not moving comments that