Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
f37dc9fb
Commit
f37dc9fb
authored
Sep 20, 1992
by
Richard M. Stallman
Browse files
*** empty log message ***
parent
de946e5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
13 deletions
+27
-13
lisp/progmodes/c-mode.el
lisp/progmodes/c-mode.el
+27
-13
No files found.
lisp/progmodes/c-mode.el
View file @
f37dc9fb
...
@@ -251,13 +251,14 @@ preserving the comment indentation or line-starting decorations."
...
@@ -251,13 +251,14 @@ preserving the comment indentation or line-starting decorations."
;; t if we enter a comment between start of function and this line.
;; t if we enter a comment between start of function and this line.
(eq (calculate-c-indent) t)
(eq (calculate-c-indent) t)
;; t if this line contains a comment starter.
;; t if this line contains a comment starter.
(save-excursion (beginning-of-line)
(setq first-line
(prog1
(save-excursion (beginning-of-line)
(re-search-forward comment-start-skip
(prog1
(save-excursion (end-of-line)
(re-search-forward comment-start-skip
(point))
(save-excursion (end-of-line)
t)
(point))
(setq comment-start-place (point)))))
t)
(setq comment-start-place (point))))))
;; Inside a comment: fill one comment paragraph.
;; Inside a comment: fill one comment paragraph.
(let ((fill-prefix
(let ((fill-prefix
;; The prefix for each line of this paragraph
;; The prefix for each line of this paragraph
...
@@ -282,26 +283,39 @@ preserving the comment indentation or line-starting decorations."
...
@@ -282,26 +283,39 @@ preserving the comment indentation or line-starting decorations."
"\\|^[
\t]*/\\*[
\t]*$\\|^[ \t]*\\*/[ \t]*$\\|^[^
\t/*]
"))
"\\|^[
\t]*/\\*[
\t]*$\\|^[ \t]*\\*/[ \t]*$\\|^[^
\t/*]
"))
(paragraph-separate
(paragraph-separate
(concat paragraph-separate
(concat paragraph-separate
"
\\|^[ \t]*/\\*[ \t]*$\\|^[
\t]*\\*/[
\t]*$\\|^[^ \t/*]")))
"
\\|^[ \t]*/\\*[ \t]*$\\|^[
\t]*\\*/[
\t]*$\\|^[^ \t/*]"))
(chars-to-delete 0))
(save-restriction
(save-restriction
;; Don't fill the comment together with the code following it.
;; Don't fill the comment together with the code following it.
;; So temporarily exclude everything before the comment start,
;; So temporarily exclude everything before the comment start,
;; and everything after the line where the comment ends.
;; and everything after the line where the comment ends.
;; If comment-start-place is non-nil, the comment starter is there.
;; If comment-start-place is non-nil, the comment starter is there.
;; Otherwise, point is inside the comment.
;; Otherwise, point is inside the comment.
(narrow-to-region (or comment-start-place
(narrow-to-region (save-excursion
(save-excursion
(if comment-start-place
(search-backward "/*")
(goto-char comment-start-place)
(beginning-of-line)
(search-backward "/*"))
(point)))
;; Protect text before the comment start
;; by excluding it. Add spaces to bring back
;; proper indentation of that point.
(let ((column (current-column)))
(prog1 (point)
(setq chars-to-delete column)
(insert-char ?\ column))))
(save-excursion
(save-excursion
(if comment-start-place
(if comment-start-place
(goto-char (+ comment-start-place 2)))
(goto-char (+ comment-start-place 2)))
(search-forward "*/" nil 'move)
(search-forward "*/" nil 'move)
(forward-line 1)
(forward-line 1)
(point)))
(point)))
(fill-paragraph arg)
(fill-paragraph arg)
(save-excursion
(save-excursion
;; Delete the chars we inserted to avoid clobbering
;; the stuff before the comment start.
(goto-char (point-min))
(if (> chars-to-delete 0)
(delete-region (point) (+ (point) chars-to-delete)))
;; Find the comment ender (should be on last line of buffer,
;; Find the comment ender (should be on last line of buffer,
;; given the narrowing) and don't leave it on its own line.
;; given the narrowing) and don't leave it on its own line.
(goto-char (point-max))
(goto-char (point-max))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment