;;; cc-align.el --- custom indentation functions for CC Mode
-;; Copyright (C) 1985,1987,1992-2003 Free Software Foundation, Inc.
+;; Copyright (C) 1985,1987,1992-2003, 2004, 2005 Free Software Foundation, Inc.
;; Authors: 1998- Martin Stjernholm
;; 1992-1999 Barry A. Warsaw
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with this program; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; like "({".
(when c-special-brace-lists
(let ((special-list (c-looking-at-special-brace-list)))
- (when special-list
+ (when (and special-list (< (car (car special-list)) (point)))
(goto-char (+ (car (car special-list)) 2)))))
(let ((savepos (point))
Only continuation lines like this are touched, nil is returned on lines
which are the start of an argument.
-Within a gcc asm block, \":\" is recognised as an argument separator,
+Within a gcc asm block, \":\" is recognized as an argument separator,
but of course only between operand specifications, not in the expressions
for the operands.
(let ((open-paren (elt c-syntactic-element 2))
(paren-state (c-parse-state)))
(while (not (eq (car paren-state) open-paren))
- (goto-char (car paren-state))
+ (unless (consp (car paren-state)) ;; ignore matched braces
+ (goto-char (car paren-state)))
(setq paren-state (cdr paren-state)))))
(let ((start (point)) c)
(back-to-indentation)
(let* ((eol (c-point 'eol))
(here (point))
- (char-after-ip (progn
- (skip-chars-forward " \t")
- (char-after))))
+ (char-after-ip (char-after)))
(if (cdr langelem) (goto-char (cdr langelem)))
;; This kludge is necessary to support both inher-cont and
(backward-char)
(c-backward-syntactic-ws))
- (skip-chars-forward "^:" eol)
- (if (eq char-after-ip ?,)
- (skip-chars-forward " \t" eol)
- (skip-chars-forward " \t:" eol))
- (if (or (eolp)
- (looking-at c-comment-start-regexp))
- (c-forward-syntactic-ws here))
+ (c-syntactic-re-search-forward ":" eol 'move)
+ (if (looking-at c-syntactic-eol)
+ (c-forward-syntactic-ws here)
+ (if (eq char-after-ip ?,)
+ (backward-char)
+ (skip-chars-forward " \t" eol)))
(if (< (point) here)
(vector (current-column)))
)))
brace-list-close, brace-list-intro, statement-block-intro and all in*
symbols, e.g. inclass and inextern-lang."
(save-excursion
- (goto-char (cdr langelem))
- (back-to-indentation)
- (if (eq (char-syntax (char-after)) ?\()
- 0
- c-basic-offset)))
+ (+ (progn
+ (back-to-indentation)
+ (if (eq (char-syntax (char-after)) ?\()
+ c-basic-offset
+ 0))
+ (progn
+ (goto-char (cdr langelem))
+ (back-to-indentation)
+ (if (eq (char-syntax (char-after)) ?\()
+ 0
+ c-basic-offset)))))
(defun c-lineup-cpp-define (langelem)
"Line up macro continuation lines according to the indentation of
;;(/= (point-max)
;; (save-excursion (skip-syntax-forward " ") (point))
(zerop (forward-line 1))
+ (bolp) ; forward-line has funny behavior at eob.
(not (looking-at "^[ \t]*$")))
'stop
nil)))