diff lisp/cc-mode/cc-align.el @ 171:929b76928fce r20-3b12

Import from CVS: tag r20-3b12
author cvs
date Mon, 13 Aug 2007 09:47:52 +0200
parents 5a88923fcbfe
children 2d532a89d707
line wrap: on
line diff
--- a/lisp/cc-mode/cc-align.el	Mon Aug 13 09:47:00 2007 +0200
+++ b/lisp/cc-mode/cc-align.el	Mon Aug 13 09:47:52 2007 +0200
@@ -7,7 +7,7 @@
 ;;             1985 Richard M. Stallman
 ;; Maintainer: cc-mode-help@python.org
 ;; Created:    22-Apr-1997 (split from cc-mode.el)
-;; Version:    5.11
+;; Version:    5.12
 ;; Keywords:   c languages oop
 
 ;; This file is part of GNU Emacs.
@@ -27,19 +27,11 @@
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
-
 (eval-when-compile
-  (load-file "./cc-engine.el"))
-
-(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))
-      )))
+  (require 'cc-defs)
+  (require 'cc-vars)
+  (require 'cc-engine)
+  (require 'cc-langs))
 
 
 ;; Standard indentation line-ups
@@ -72,7 +64,7 @@
 		 (- (current-column) langelem-col))
 	(goto-char containing-sexp)
 	(or (eolp)
-	    (not (memq (following-char) '(?{ ?\( )))
+	    (not (memq (char-after) '(?{ ?\( )))
 	    (let ((eol (c-point 'eol))
 		  (here (progn
 			  (forward-char 1)
@@ -225,7 +217,7 @@
 (defun c-lineup-runin-statements (langelem)
   ;; line up statements in coding standards which place the first
   ;; statement on the same line as the block opening brace.
-  (if (= (char-after (cdr langelem)) ?{)
+  (if (eq (char-after (cdr langelem)) ?{)
       (save-excursion
 	(let ((langelem-col (c-langelem-col langelem)))
 	  (forward-char 1)
@@ -239,7 +231,7 @@
     (let ((equalp (save-excursion
 		    (goto-char (c-point 'boi))
 		    (skip-chars-forward "^=" (c-point 'eol))
-		    (and (= (following-char) ?=)
+		    (and (eq (char-after) ?=)
 			 (- (point) (c-point 'boi)))))
 	  (langelem-col (c-langelem-col langelem))
 	  donep)
@@ -249,7 +241,7 @@
 	(if (c-in-literal (cdr langelem))
 	    (forward-char 1)
 	  (setq donep t)))
-      (if (/= (following-char) ?=)
+      (if (not (eq (char-after) ?=))
 	  ;; there's no equal sign on the line
 	  c-basic-offset
 	;; calculate indentation column after equals and ws, unless
@@ -273,7 +265,7 @@
     (let* ((extra (save-excursion
 		    (back-to-indentation)
 		    (c-backward-syntactic-ws (cdr langelem))
-		    (if (= (preceding-char) ?:)
+		    (if (eq (char-before) ?:)
 			(- c-basic-offset)
 		      0)))
 	   (open-bracket-pos (cdr langelem))
@@ -301,13 +293,13 @@
 	   (first-col-column (progn
 			       (goto-char relpos)
 			       (skip-chars-forward "^:" eol)
-			       (and (= (following-char) ?:)
+			       (and (eq (char-after) ?:)
 				    (current-column)))))
       (if (not first-col-column)
 	  c-basic-offset
 	(goto-char here)
 	(skip-chars-forward "^:" eol)
-	(if (= (following-char) ?:)
+	(if (eq (char-after) ?:)
 	    (+ curcol (- first-col-column (current-column)))
 	  c-basic-offset)))))
 
@@ -321,13 +313,13 @@
 	   (relpos (cdr langelem))
 	   (prev-col-column (progn
 			      (skip-chars-backward "^:" relpos)
-			      (and (= (preceding-char) ?:)
+			      (and (eq (char-before) ?:)
 				   (- (current-column) 1)))))
       (if (not prev-col-column)
 	  c-basic-offset
 	(goto-char here)
 	(skip-chars-forward "^:" eol)
-	(if (= (following-char) ?:)
+	(if (eq (char-after) ?:)
 	    (+ curcol (- prev-col-column (current-column)))
 	  c-basic-offset)))))
 
@@ -343,7 +335,7 @@
       (if (and (eq syntax 'block-close)
 	       (setq langelem (assq 'block-close c-syntactic-context))
 	       (progn (goto-char (cdr langelem))
-		      (if (= (following-char) ?{)
+		      (if (eq (char-after) ?{)
 			  (c-safe (forward-sexp -1)))
 		      (looking-at "\\<do\\>[^_]")))
 	  '(before)
@@ -385,12 +377,12 @@
 exactly the old newline insertion behavior."
   ;; newline only after semicolon, but only if that semicolon is not
   ;; inside a parenthesis list (e.g. a for loop statement)
-  (if (/= last-command-char ?\;)
+  (if (not (eq last-command-char ?\;))
       nil				; continue checking
     (if (condition-case nil
 	    (save-excursion
 	      (up-list -1)
-	      (/= (following-char) ?\())
+	      (not (eq (char-after) ?\()))
 	  (error t))
 	t
       'stop)))