changeset 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 68e734ab7d5d
children f1a6dfd30c21
files lisp/progmodes/cc-defs.el
diffstat 1 files changed, 21 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/cc-defs.el	Mon Jul 24 11:11:20 2000 +0000
+++ b/lisp/progmodes/cc-defs.el	Mon Jul 24 11:11:36 2000 +0000
@@ -1,8 +1,9 @@
 ;;; cc-defs.el --- compile time definitions for CC Mode
 
-;; Copyright (C) 1985,1987,1992-1999 Free Software Foundation, Inc.
+;; Copyright (C) 1985,1987,1992-2000 Free Software Foundation, Inc.
 
-;; Authors:    1998-1999 Barry A. Warsaw and Martin Stjernholm
+;; Authors:    2000- Martin Stjernholm
+;;	       1998-1999 Barry A. Warsaw and Martin Stjernholm
 ;;             1992-1997 Barry A. Warsaw
 ;;             1987 Dave Detlefs and Stewart Clamen
 ;;             1985 Richard M. Stallman
@@ -153,13 +154,16 @@
 
 (defsubst c-end-of-defun-1 ()
   ;; Replacement for end-of-defun that use c-beginning-of-defun-1.
-  (while (and (c-safe (down-list 1) t)
-	      (not (eq (char-before) ?{)))
-    ;; skip down into the next defun-block
-    (forward-char -1)
-    (c-forward-sexp))
-  (c-beginning-of-defun-1)
-  (c-forward-sexp))
+  (let ((start (point)))
+    ;; Skip forward into the next defun block. Don't bother to avoid
+    ;; comments, literals etc, since beginning-of-defun doesn't do that
+    ;; anyway.
+    (skip-chars-forward "^}")
+    (c-beginning-of-defun-1)
+    (if (eq (char-after) ?{)
+	(c-forward-sexp))
+    (if (< (point) start)
+	(goto-char (point-max)))))
 
 (defmacro c-forward-sexp (&optional arg)
   ;; like forward-sexp except
@@ -245,13 +249,6 @@
 	 (if (and c-inexpr-class-key (c-looking-at-inexpr-block))
 	     (c-add-syntax 'inexpr-class))))))
 
-(defmacro c-auto-newline ()
-  ;; if auto-newline feature is turned on, insert a newline character
-  ;; and return t, otherwise return nil.
-  `(and c-auto-newline
-	(not (c-in-literal))
-	(not (newline))))
-
 (defsubst c-intersect-lists (list alist)
   ;; return the element of ALIST that matches the first element found
   ;; in LIST.  Uses assq.
@@ -269,12 +266,14 @@
 (defsubst c-langelem-col (langelem &optional preserve-point)
   ;; convenience routine to return the column of langelem's relpos.
   ;; Leaves point at the relpos unless preserve-point is non-nil.
-  (let ((here (point)))
-    (goto-char (cdr langelem))
-    (prog1 (current-column)
-      (if preserve-point
-	  (goto-char here))
-      )))
+  (if (cdr langelem)
+      (let ((here (point)))
+	(goto-char (cdr langelem))
+	(prog1 (current-column)
+	  (if preserve-point
+	      (goto-char here))
+	  ))
+    0))
 
 (defmacro c-update-modeline ()
   ;; set the c-auto-hungry-string for the correct designation on the modeline