summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-cmds.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/cc-cmds.el')
-rw-r--r--lisp/progmodes/cc-cmds.el28
1 files changed, 21 insertions, 7 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 79043c87b63..079ebb02622 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -856,8 +856,8 @@ is inhibited."
(narrow-to-region (point-min) (point))
(back-to-indentation)
(looking-at (concat c-current-comment-prefix "[ \t]*$")))))
- (kill-region (progn (forward-line 0) (point))
- (progn (end-of-line) (point)))
+ (delete-region (progn (forward-line 0) (point))
+ (progn (end-of-line) (point)))
(insert-char ?* 1)) ; the / comes later. ; Do I need a t (retain sticky properties) here?
(setq indentp (and (not arg)
@@ -1360,10 +1360,24 @@ No indentation or other \"electric\" behavior is performed."
(and c-opt-block-decls-with-vars-key
(save-excursion
(c-syntactic-skip-backward "^;}" lim)
- (and (eq (char-before) ?\})
- (eq (car (c-beginning-of-decl-1 lim)) 'previous)
- (looking-at c-opt-block-decls-with-vars-key)
- (point)))))
+ (let ((eo-block (point))
+ bod)
+ (and (eq (char-before) ?\})
+ (eq (car (c-beginning-of-decl-1 lim)) 'previous)
+ (setq bod (point))
+ ;; Look for struct or union or ... If we find one, it might
+ ;; be the return type of a function, or the like. Exclude
+ ;; this case.
+ (c-syntactic-re-search-forward
+ (concat "[;=\(\[{]\\|\\("
+ c-opt-block-decls-with-vars-key
+ "\\)")
+ eo-block t t t)
+ (match-beginning 1) ; Is there a "struct" etc., somewhere?
+ (not (eq (char-before) ?_))
+ (c-syntactic-re-search-forward "[;=\(\[{]" eo-block t t t)
+ (eq (char-before) ?\{)
+ bod)))))
(defun c-where-wrt-brace-construct ()
;; Determine where we are with respect to functions (or other brace
@@ -1531,7 +1545,7 @@ defun."
(setq arg (c-forward-to-nth-EOF-} (- arg) where)))
;; Move forward to the next opening brace....
(when (and (= arg 0)
- (c-syntactic-re-search-forward "{" nil t))
+ (c-syntactic-re-search-forward "{" nil 'eob))
(backward-char)
;; ... and backward to the function header.
(c-beginning-of-decl-1)