;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
(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)
(backward-char)
(skip-chars-backward " \t")
(setq beg (point))
- (c-save-buffer-state () (c-on-identifier))
- ;; Don't add a space into #define FOO()....
- (not (and (c-beginning-of-macro)
- (c-forward-over-cpp-define-id)
- (eq (point) beg)))))
+ (and (c-save-buffer-state () (c-on-identifier))
+ ;; Don't add a space into #define FOO()....
+ (not (and (c-beginning-of-macro)
+ (c-forward-over-cpp-define-id)
+ (eq (point) beg))))))
(save-excursion
(delete-region beg end)
(goto-char beg)
(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
(or arg (setq arg 1))
(c-save-buffer-state
- ((start (point))
+ (beginning-of-defun-function end-of-defun-function
+ (start (point))
where paren-state pos)
;; Move back out of any macro/comment/string we happen to be in.
(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)
(or arg (setq arg 1))
(c-save-buffer-state
- ((start (point))
+ (beginning-of-defun-function end-of-defun-function
+ (start (point))
where paren-state pos)
;; Move back out of any macro/comment/string we happen to be in.
(setq arg (1+ arg)))
(if (< arg 0)
(setq arg (c-backward-to-nth-BOF-{ (- arg) where)))
- (when (and (= arg 0)
- (c-syntactic-skip-backward "^}")
- (eq (char-before) ?\}))
- t))
+ (if (= arg 0)
+ (c-syntactic-skip-backward "^}")))
;; Move forward to the } of a function
(if (> arg 0)