From bbfbe5ec33f604d95834195898d2ca5a71aa3b32 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Mon, 24 Jul 2000 11:11:36 +0000 Subject: [PATCH] (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. --- lisp/progmodes/cc-defs.el | 43 +++++++++++++++++++-------------------- 1 file 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 @@ ;;; 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 -- 2.39.2