diff options
| author | Karl Heuer | 1997-10-23 07:48:34 +0000 |
|---|---|---|
| committer | Karl Heuer | 1997-10-23 07:48:34 +0000 |
| commit | a7c7b186ff3b8bd18929d84237899dbdda7c0912 (patch) | |
| tree | 3a52d227341c3c86df3de1b599497c695671edaf | |
| parent | 6430c434e3d5e2fb74f3cd01f92cee64ab94864d (diff) | |
| download | emacs-a7c7b186ff3b8bd18929d84237899dbdda7c0912.tar.gz emacs-a7c7b186ff3b8bd18929d84237899dbdda7c0912.zip | |
(c-progress-init, c-progress-fini):
Be slient if c-progress-interval
is nil.
(c-comment-line-break-function):
Fix for when comment starts at
comment-column and there is non-whitespace preceding this on the
current line.
| -rw-r--r-- | lisp/progmodes/cc-cmds.el | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 6cfc211c7b6..1e5db017389 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; 1985 Richard M. Stallman | 7 | ;; 1985 Richard M. Stallman |
| 8 | ;; Maintainer: cc-mode-help@python.org | 8 | ;; Maintainer: cc-mode-help@python.org |
| 9 | ;; Created: 22-Apr-1997 (split from cc-mode.el) | 9 | ;; Created: 22-Apr-1997 (split from cc-mode.el) |
| 10 | ;; Version: 5.18 | 10 | ;; Version: See cc-mode.el |
| 11 | ;; Keywords: c languages oop | 11 | ;; Keywords: c languages oop |
| 12 | 12 | ||
| 13 | ;; This file is part of GNU Emacs. | 13 | ;; This file is part of GNU Emacs. |
| @@ -757,7 +757,8 @@ comment." | |||
| 757 | ;; for proposed new variable comment-line-break-function | 757 | ;; for proposed new variable comment-line-break-function |
| 758 | (defun c-comment-line-break-function (&optional soft) | 758 | (defun c-comment-line-break-function (&optional soft) |
| 759 | ;; we currently don't do anything with soft line breaks | 759 | ;; we currently don't do anything with soft line breaks |
| 760 | (let ((literal (c-in-literal))) | 760 | (let ((literal (c-in-literal)) |
| 761 | at-comment-col) | ||
| 761 | (cond | 762 | (cond |
| 762 | ((eq literal 'string)) | 763 | ((eq literal 'string)) |
| 763 | ((or (not c-comment-continuation-stars) | 764 | ((or (not c-comment-continuation-stars) |
| @@ -766,6 +767,12 @@ comment." | |||
| 766 | (t (let ((here (point)) | 767 | (t (let ((here (point)) |
| 767 | (leader c-comment-continuation-stars)) | 768 | (leader c-comment-continuation-stars)) |
| 768 | (back-to-indentation) | 769 | (back-to-indentation) |
| 770 | ;; comment could be hanging | ||
| 771 | (if (not (c-in-literal)) | ||
| 772 | (progn | ||
| 773 | (forward-line 1) | ||
| 774 | (forward-comment -1) | ||
| 775 | (setq at-comment-col (= (current-column) comment-column)))) | ||
| 769 | ;; are we looking at a block or lines style comment? | 776 | ;; are we looking at a block or lines style comment? |
| 770 | (if (and (looking-at (concat "\\(" c-comment-start-regexp | 777 | (if (and (looking-at (concat "\\(" c-comment-start-regexp |
| 771 | "\\)[ \t]+")) | 778 | "\\)[ \t]+")) |
| @@ -779,6 +786,8 @@ comment." | |||
| 779 | ;; to avoid having an anchored comment that c-indent-line will | 786 | ;; to avoid having an anchored comment that c-indent-line will |
| 780 | ;; trip up on | 787 | ;; trip up on |
| 781 | (insert " " leader) | 788 | (insert " " leader) |
| 789 | (if at-comment-col | ||
| 790 | (indent-for-comment)) | ||
| 782 | (c-indent-line)))))) | 791 | (c-indent-line)))))) |
| 783 | 792 | ||
| 784 | ;; advice for indent-new-comment-line for older Emacsen | 793 | ;; advice for indent-new-comment-line for older Emacsen |
| @@ -1133,22 +1142,25 @@ Optional SHUTUP-P if non-nil, inhibits message printing and error checking." | |||
| 1133 | (defvar c-progress-info nil) | 1142 | (defvar c-progress-info nil) |
| 1134 | 1143 | ||
| 1135 | (defun c-progress-init (start end context) | 1144 | (defun c-progress-init (start end context) |
| 1136 | ;; start the progress update messages. if this emacs doesn't have a | 1145 | (cond |
| 1137 | ;; built-in timer, just be dumb about it | 1146 | ;; Be silent |
| 1138 | (if (not (fboundp 'current-time)) | 1147 | ((not c-progress-interval)) |
| 1139 | (message "indenting region... (this may take a while)") | 1148 | ;; Start the progress update messages. If this Emacs doesn't have |
| 1140 | ;; if progress has already been initialized, do nothing. otherwise | 1149 | ;; a built-in timer, just be dumb about it. |
| 1141 | ;; initialize the counter with a vector of: | 1150 | ((not (fboundp 'current-time)) |
| 1142 | ;; [start end lastsec context] | 1151 | (message "indenting region... (this may take a while)")) |
| 1143 | (if c-progress-info | 1152 | ;; If progress has already been initialized, do nothing. otherwise |
| 1144 | () | 1153 | ;; initialize the counter with a vector of: |
| 1145 | (setq c-progress-info (vector start | 1154 | ;; [start end lastsec context] |
| 1155 | (c-progress-info) | ||
| 1156 | (t (setq c-progress-info (vector start | ||
| 1146 | (save-excursion | 1157 | (save-excursion |
| 1147 | (goto-char end) | 1158 | (goto-char end) |
| 1148 | (point-marker)) | 1159 | (point-marker)) |
| 1149 | (nth 1 (current-time)) | 1160 | (nth 1 (current-time)) |
| 1150 | context)) | 1161 | context)) |
| 1151 | (message "indenting region...")))) | 1162 | (message "indenting region...")) |
| 1163 | )) | ||
| 1152 | 1164 | ||
| 1153 | (defun c-progress-update () | 1165 | (defun c-progress-update () |
| 1154 | ;; update progress | 1166 | ;; update progress |
| @@ -1169,12 +1181,14 @@ Optional SHUTUP-P if non-nil, inhibits message printing and error checking." | |||
| 1169 | 1181 | ||
| 1170 | (defun c-progress-fini (context) | 1182 | (defun c-progress-fini (context) |
| 1171 | ;; finished | 1183 | ;; finished |
| 1172 | (if (or (eq context (aref c-progress-info 3)) | 1184 | (if (not c-progress-interval) |
| 1173 | (eq context t)) | 1185 | nil |
| 1174 | (progn | 1186 | (if (or (eq context (aref c-progress-info 3)) |
| 1175 | (set-marker (aref c-progress-info 1) nil) | 1187 | (eq context t)) |
| 1176 | (setq c-progress-info nil) | 1188 | (progn |
| 1177 | (message "indenting region...done")))) | 1189 | (set-marker (aref c-progress-info 1) nil) |
| 1190 | (setq c-progress-info nil) | ||
| 1191 | (message "indenting region...done"))))) | ||
| 1178 | 1192 | ||
| 1179 | 1193 | ||
| 1180 | 1194 | ||