diff options
| author | Alan Mackenzie | 2007-02-15 22:31:52 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2007-02-15 22:31:52 +0000 |
| commit | 94dd9d6dc94bcea09d78aedde0a02975be8d705f (patch) | |
| tree | 8dcd5c5d93532275c19f21b0e73da2caf552b9dc | |
| parent | 0535d51b4c2fd08dea93483d2daea7fd5f993941 (diff) | |
| download | emacs-94dd9d6dc94bcea09d78aedde0a02975be8d705f.tar.gz emacs-94dd9d6dc94bcea09d78aedde0a02975be8d705f.zip | |
(c-indent-new-comment-line): When splitting an empty one-line C-style
comment, post-position point properly.
| -rw-r--r-- | lisp/progmodes/cc-cmds.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index f8375d7fe36..4f9e1947738 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el | |||
| @@ -4238,6 +4238,7 @@ If a fill prefix is specified, it overrides all the above." | |||
| 4238 | (c-collect-line-comments c-lit-limits)) | 4238 | (c-collect-line-comments c-lit-limits)) |
| 4239 | c-lit-type))) | 4239 | c-lit-type))) |
| 4240 | (pos (point)) | 4240 | (pos (point)) |
| 4241 | (start-col (current-column)) | ||
| 4241 | (comment-text-end | 4242 | (comment-text-end |
| 4242 | (or (and (eq c-lit-type 'c) | 4243 | (or (and (eq c-lit-type 'c) |
| 4243 | (save-excursion | 4244 | (save-excursion |
| @@ -4254,6 +4255,11 @@ If a fill prefix is specified, it overrides all the above." | |||
| 4254 | ;; | 4255 | ;; |
| 4255 | ;; If point is on the 'B' then the line will be | 4256 | ;; If point is on the 'B' then the line will be |
| 4256 | ;; broken after "Bla b". | 4257 | ;; broken after "Bla b". |
| 4258 | ;; | ||
| 4259 | ;; If we have an empty comment, /* */, the next | ||
| 4260 | ;; lot of code pushes point to the */. We fix | ||
| 4261 | ;; this by never allowing point to end up to the | ||
| 4262 | ;; right of where it started. | ||
| 4257 | (while (and (< (current-column) (cdr fill)) | 4263 | (while (and (< (current-column) (cdr fill)) |
| 4258 | (not (eolp))) | 4264 | (not (eolp))) |
| 4259 | (forward-char 1)) | 4265 | (forward-char 1)) |
| @@ -4276,7 +4282,10 @@ If a fill prefix is specified, it overrides all the above." | |||
| 4276 | ((< (point) (+ (car c-lit-limits) 2)) | 4282 | ((< (point) (+ (car c-lit-limits) 2)) |
| 4277 | (goto-char (+ (car c-lit-limits) 2)))) | 4283 | (goto-char (+ (car c-lit-limits) 2)))) |
| 4278 | (funcall do-line-break) | 4284 | (funcall do-line-break) |
| 4279 | (insert-and-inherit (car fill)))) | 4285 | (insert-and-inherit (car fill)) |
| 4286 | (if (> (current-column) start-col) | ||
| 4287 | (move-to-column start-col)))) ; can this hit the | ||
| 4288 | ; middle of a TAB? | ||
| 4280 | ;; Inside a comment that should be broken. | 4289 | ;; Inside a comment that should be broken. |
| 4281 | (let ((comment-start comment-start) | 4290 | (let ((comment-start comment-start) |
| 4282 | (comment-end comment-end) | 4291 | (comment-end comment-end) |