comparison lisp/progmodes/c-mode.el @ 1081:4e7d09b779eb

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Fri, 04 Sep 1992 23:38:45 +0000
parents e699ce19609f
children 273918bf0a95
comparison
equal deleted inserted replaced
1080:8f64d3122435 1081:4e7d09b779eb
1 ;;; c-mode.el --- C code editing commands for Emacs 1 ;;; c-mode.el --- C code editing commands for Emacs
2
3 ;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc. 2 ;; Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc.
4 3
5 ;; Maintainer: FSF 4 ;; Maintainer: FSF
6 ;; Keywords: c 5 ;; Keywords: c
7 6
234 (max (1+ (current-column)) ;Else indent at comment column 233 (max (1+ (current-column)) ;Else indent at comment column
235 comment-column))))))) ; except leave at least one space. 234 comment-column))))))) ; except leave at least one space.
236 235
237 (defun c-fill-paragraph (&optional arg) 236 (defun c-fill-paragraph (&optional arg)
238 "Like \\[fill-paragraph] but handle C comments. 237 "Like \\[fill-paragraph] but handle C comments.
239 If point is inside a comment, the current paragraph of the comment 238 If any of the current line is a comment or within a comment,
240 is filled, preserving the comment indentation or line-starting decorations." 239 fill the comment or the paragraph of it that point is in,
240 preserving the comment indentation or line-starting decorations."
241 (interactive "P") 241 (interactive "P")
242 (let ((first-line 242 (let ((first-line
243 ;; Check for obvious entry to comment. 243 ;; Check for obvious entry to comment.
244 (save-excursion 244 (save-excursion
245 (beginning-of-line) 245 (beginning-of-line)
246 (skip-chars-forward " \t") 246 (skip-chars-forward " \t")
247 (looking-at comment-start-skip)))) 247 (looking-at comment-start-skip))))
248 (if (or first-line 248 (if (or first-line
249 ;; t if we enter a comment between start of function and this line. 249 ;; t if we enter a comment between start of function and this line.
250 (eq (calculate-c-indent) t) 250 (eq (calculate-c-indent) t)
251 ;; See if we enter a comment between beg-of-line and here. 251 ;; t if this line contains a comment starter.
252 (nth 4 (parse-partial-sexp (save-excursion (beginning-of-line) (point)) 252 (save-excursion (beginning-of-line)
253 (point) 0))) 253 (re-search-forward comment-start-skip
254 (save-excursion (end-of-line)
255 (point))
256 t)))
254 ;; Inside a comment: fill one comment paragraph. 257 ;; Inside a comment: fill one comment paragraph.
255 (let ((fill-prefix 258 (let ((fill-prefix
256 ;; The prefix for each line of this paragraph 259 ;; The prefix for each line of this paragraph
257 ;; is the appropriate part of the start of this line, 260 ;; is the appropriate part of the start of this line,
258 ;; up to the column at which text should be indented. 261 ;; up to the column at which text should be indented.
532 ;; Go back to the DEFUN, if it is one. 535 ;; Go back to the DEFUN, if it is one.
533 (condition-case nil 536 (condition-case nil
534 (backward-sexp 1) 537 (backward-sexp 1)
535 (error)) 538 (error))
536 (beginning-of-line) 539 (beginning-of-line)
537 (setq tem (point))
538 (looking-at "DEFUN\\b")) 540 (looking-at "DEFUN\\b"))
539 c-argdecl-indent 541 c-argdecl-indent
540 (if (and (looking-at "\\sw\\|\\s_") 542 (if (and (looking-at "\\sw\\|\\s_")
541 (looking-at "[^\"\n=]*(") 543 (looking-at "[^\"\n=]*(")
542 (progn 544 (progn