summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-cmds.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1997-10-23 07:48:34 +0000
committerKarl Heuer <kwzh@gnu.org>1997-10-23 07:48:34 +0000
commita7c7b186ff3b8bd18929d84237899dbdda7c0912 (patch)
tree3a52d227341c3c86df3de1b599497c695671edaf /lisp/progmodes/cc-cmds.el
parent6430c434e3d5e2fb74f3cd01f92cee64ab94864d (diff)
downloademacs-a7c7b186ff3b8bd18929d84237899dbdda7c0912.tar.gz
(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.
Diffstat (limited to 'lisp/progmodes/cc-cmds.el')
-rw-r--r--lisp/progmodes/cc-cmds.el52
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 @@
;; 1985 Richard M. Stallman
;; Maintainer: cc-mode-help@python.org
;; Created: 22-Apr-1997 (split from cc-mode.el)
-;; Version: 5.18
+;; Version: See cc-mode.el
;; Keywords: c languages oop
;; This file is part of GNU Emacs.
@@ -757,7 +757,8 @@ comment."
;; for proposed new variable comment-line-break-function
(defun c-comment-line-break-function (&optional soft)
;; we currently don't do anything with soft line breaks
- (let ((literal (c-in-literal)))
+ (let ((literal (c-in-literal))
+ at-comment-col)
(cond
((eq literal 'string))
((or (not c-comment-continuation-stars)
@@ -766,6 +767,12 @@ comment."
(t (let ((here (point))
(leader c-comment-continuation-stars))
(back-to-indentation)
+ ;; comment could be hanging
+ (if (not (c-in-literal))
+ (progn
+ (forward-line 1)
+ (forward-comment -1)
+ (setq at-comment-col (= (current-column) comment-column))))
;; are we looking at a block or lines style comment?
(if (and (looking-at (concat "\\(" c-comment-start-regexp
"\\)[ \t]+"))
@@ -779,6 +786,8 @@ comment."
;; to avoid having an anchored comment that c-indent-line will
;; trip up on
(insert " " leader)
+ (if at-comment-col
+ (indent-for-comment))
(c-indent-line))))))
;; 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."
(defvar c-progress-info nil)
(defun c-progress-init (start end context)
- ;; start the progress update messages. if this emacs doesn't have a
- ;; built-in timer, just be dumb about it
- (if (not (fboundp 'current-time))
- (message "indenting region... (this may take a while)")
- ;; if progress has already been initialized, do nothing. otherwise
- ;; initialize the counter with a vector of:
- ;; [start end lastsec context]
- (if c-progress-info
- ()
- (setq c-progress-info (vector start
+ (cond
+ ;; Be silent
+ ((not c-progress-interval))
+ ;; Start the progress update messages. If this Emacs doesn't have
+ ;; a built-in timer, just be dumb about it.
+ ((not (fboundp 'current-time))
+ (message "indenting region... (this may take a while)"))
+ ;; If progress has already been initialized, do nothing. otherwise
+ ;; initialize the counter with a vector of:
+ ;; [start end lastsec context]
+ (c-progress-info)
+ (t (setq c-progress-info (vector start
(save-excursion
(goto-char end)
(point-marker))
(nth 1 (current-time))
context))
- (message "indenting region..."))))
+ (message "indenting region..."))
+ ))
(defun c-progress-update ()
;; update progress
@@ -1169,12 +1181,14 @@ Optional SHUTUP-P if non-nil, inhibits message printing and error checking."
(defun c-progress-fini (context)
;; finished
- (if (or (eq context (aref c-progress-info 3))
- (eq context t))
- (progn
- (set-marker (aref c-progress-info 1) nil)
- (setq c-progress-info nil)
- (message "indenting region...done"))))
+ (if (not c-progress-interval)
+ nil
+ (if (or (eq context (aref c-progress-info 3))
+ (eq context t))
+ (progn
+ (set-marker (aref c-progress-info 1) nil)
+ (setq c-progress-info nil)
+ (message "indenting region...done")))))