Mercurial > emacs
comparison lisp/progmodes/cc-defs.el @ 30404:3393922ea102
(c-end-of-defun-1): Fixed forward scanning into
defun block.
(c-auto-newline): Removed this macro since it's
not used anymore.
(c-forward-comment): Removed the workaround
introduced in 5.38 since it had worse side-effects. If a line
contains the string "//\"", it regarded the // as a comment
start since the \ temporarily doesn't have escape syntax.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 24 Jul 2000 11:11:36 +0000 |
parents | 03befb219d03 |
children | dd613770eb0f |
comparison
equal
deleted
inserted
replaced
30403:68e734ab7d5d | 30404:3393922ea102 |
---|---|
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 |
9 ;; Maintainer: bug-cc-mode@gnu.org | 10 ;; Maintainer: bug-cc-mode@gnu.org |
10 ;; Created: 22-Apr-1997 (split from cc-mode.el) | 11 ;; Created: 22-Apr-1997 (split from cc-mode.el) |
151 (looking-at defun-prompt-regexp) | 152 (looking-at defun-prompt-regexp) |
152 (goto-char (match-end 0)))) | 153 (goto-char (match-end 0)))) |
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 |
166 ;; 1. this is much stripped down from the XEmacs version | 170 ;; 1. this is much stripped down from the XEmacs version |
167 ;; 2. this cannot be used as a command, so we're insulated from | 171 ;; 2. this cannot be used as a command, so we're insulated from |
243 (c-add-syntax symbol (point)) | 247 (c-add-syntax symbol (point)) |
244 (c-add-syntax symbol (aref classkey 0)) | 248 (c-add-syntax symbol (aref classkey 0)) |
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. |
258 (let (match) | 255 (let (match) |
259 (while (and list | 256 (while (and list |
267 (assq (car (c-intersect-lists list alist1)) alist2)) | 264 (assq (car (c-intersect-lists list alist1)) alist2)) |
268 | 265 |
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 |
281 `(progn | 280 `(progn |
282 (setq c-auto-hungry-string | 281 (setq c-auto-hungry-string |