diff options
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index e9b1a30d32e..67e11e5d65a 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -1,8 +1,9 @@ | |||
| 1 | ;;; cc-defs.el --- compile time definitions for CC Mode | 1 | ;;; cc-defs.el --- compile time definitions for CC Mode |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985,1987,1992-1999 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1985,1987,1992-2000 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Authors: 1998-1999 Barry A. Warsaw and Martin Stjernholm | 5 | ;; Authors: 2000- Martin Stjernholm |
| 6 | ;; 1998-1999 Barry A. Warsaw and Martin Stjernholm | ||
| 6 | ;; 1992-1997 Barry A. Warsaw | 7 | ;; 1992-1997 Barry A. Warsaw |
| 7 | ;; 1987 Dave Detlefs and Stewart Clamen | 8 | ;; 1987 Dave Detlefs and Stewart Clamen |
| 8 | ;; 1985 Richard M. Stallman | 9 | ;; 1985 Richard M. Stallman |
| @@ -153,13 +154,16 @@ | |||
| 153 | 154 | ||
| 154 | (defsubst c-end-of-defun-1 () | 155 | (defsubst c-end-of-defun-1 () |
| 155 | ;; Replacement for end-of-defun that use c-beginning-of-defun-1. | 156 | ;; Replacement for end-of-defun that use c-beginning-of-defun-1. |
| 156 | (while (and (c-safe (down-list 1) t) | 157 | (let ((start (point))) |
| 157 | (not (eq (char-before) ?{))) | 158 | ;; Skip forward into the next defun block. Don't bother to avoid |
| 158 | ;; skip down into the next defun-block | 159 | ;; comments, literals etc, since beginning-of-defun doesn't do that |
| 159 | (forward-char -1) | 160 | ;; anyway. |
| 160 | (c-forward-sexp)) | 161 | (skip-chars-forward "^}") |
| 161 | (c-beginning-of-defun-1) | 162 | (c-beginning-of-defun-1) |
| 162 | (c-forward-sexp)) | 163 | (if (eq (char-after) ?{) |
| 164 | (c-forward-sexp)) | ||
| 165 | (if (< (point) start) | ||
| 166 | (goto-char (point-max))))) | ||
| 163 | 167 | ||
| 164 | (defmacro c-forward-sexp (&optional arg) | 168 | (defmacro c-forward-sexp (&optional arg) |
| 165 | ;; like forward-sexp except | 169 | ;; like forward-sexp except |
| @@ -245,13 +249,6 @@ | |||
| 245 | (if (and c-inexpr-class-key (c-looking-at-inexpr-block)) | 249 | (if (and c-inexpr-class-key (c-looking-at-inexpr-block)) |
| 246 | (c-add-syntax 'inexpr-class)))))) | 250 | (c-add-syntax 'inexpr-class)))))) |
| 247 | 251 | ||
| 248 | (defmacro c-auto-newline () | ||
| 249 | ;; if auto-newline feature is turned on, insert a newline character | ||
| 250 | ;; and return t, otherwise return nil. | ||
| 251 | `(and c-auto-newline | ||
| 252 | (not (c-in-literal)) | ||
| 253 | (not (newline)))) | ||
| 254 | |||
| 255 | (defsubst c-intersect-lists (list alist) | 252 | (defsubst c-intersect-lists (list alist) |
| 256 | ;; return the element of ALIST that matches the first element found | 253 | ;; return the element of ALIST that matches the first element found |
| 257 | ;; in LIST. Uses assq. | 254 | ;; in LIST. Uses assq. |
| @@ -269,12 +266,14 @@ | |||
| 269 | (defsubst c-langelem-col (langelem &optional preserve-point) | 266 | (defsubst c-langelem-col (langelem &optional preserve-point) |
| 270 | ;; convenience routine to return the column of langelem's relpos. | 267 | ;; convenience routine to return the column of langelem's relpos. |
| 271 | ;; Leaves point at the relpos unless preserve-point is non-nil. | 268 | ;; Leaves point at the relpos unless preserve-point is non-nil. |
| 272 | (let ((here (point))) | 269 | (if (cdr langelem) |
| 273 | (goto-char (cdr langelem)) | 270 | (let ((here (point))) |
| 274 | (prog1 (current-column) | 271 | (goto-char (cdr langelem)) |
| 275 | (if preserve-point | 272 | (prog1 (current-column) |
| 276 | (goto-char here)) | 273 | (if preserve-point |
| 277 | ))) | 274 | (goto-char here)) |
| 275 | )) | ||
| 276 | 0)) | ||
| 278 | 277 | ||
| 279 | (defmacro c-update-modeline () | 278 | (defmacro c-update-modeline () |
| 280 | ;; set the c-auto-hungry-string for the correct designation on the modeline | 279 | ;; set the c-auto-hungry-string for the correct designation on the modeline |