Mercurial > hg > xemacs-beta
comparison lisp/cc-mode/cc-compat.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 |
comparison
equal
deleted
inserted
replaced
170:98a42ee61975 | 171:929b76928fce |
---|---|
3 ;; Copyright (C) 1985,87,92,93,94,95,96,97 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1985,87,92,93,94,95,96,97 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: 1994-1997 Barry A. Warsaw | 5 ;; Author: 1994-1997 Barry A. Warsaw |
6 ;; Maintainer: cc-mode-help@python.org | 6 ;; Maintainer: cc-mode-help@python.org |
7 ;; Created: August 1994, split from cc-mode.el | 7 ;; Created: August 1994, split from cc-mode.el |
8 ;; Version: 5.11 | 8 ;; Version: 5.12 |
9 ;; Keywords: c languages oop | 9 ;; Keywords: c languages oop |
10 | 10 |
11 ;; This file is part of GNU Emacs. | 11 ;; This file is part of GNU Emacs. |
12 | 12 |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | 13 ;; GNU Emacs is free software; you can redistribute it and/or modify |
38 ;; (c-set-style "BOCM") | 38 ;; (c-set-style "BOCM") |
39 | 39 |
40 ;;; Code: | 40 ;;; Code: |
41 | 41 |
42 (eval-when-compile | 42 (eval-when-compile |
43 (load-file "./cc-styles.el") | 43 (require 'cc-styles) |
44 (load-file "./cc-engine.el")) | 44 (require 'cc-engine)) |
45 | 45 |
46 | 46 |
47 ;; In case c-mode.el isn't loaded | 47 ;; In case c-mode.el isn't loaded |
48 (defvar c-indent-level 2 | 48 (defvar c-indent-level 2 |
49 "*Indentation of C statements with respect to containing block.") | 49 "*Indentation of C statements with respect to containing block.") |
86 | 86 |
87 (defun cc-block-intro-offset (langelem) | 87 (defun cc-block-intro-offset (langelem) |
88 ;; taken directly from calculate-c-indent confusion | 88 ;; taken directly from calculate-c-indent confusion |
89 (save-excursion | 89 (save-excursion |
90 (c-backward-syntactic-ws) | 90 (c-backward-syntactic-ws) |
91 (if (= (preceding-char) ?{) | 91 (if (eq (char-before) ?{) |
92 (forward-char -1) | 92 (forward-char -1) |
93 (goto-char (cdr langelem))) | 93 (goto-char (cdr langelem))) |
94 (let* ((curcol (save-excursion | 94 (let* ((curcol (save-excursion |
95 (goto-char (cdr langelem)) | 95 (goto-char (cdr langelem)) |
96 (current-column))) | 96 (current-column))) |
111 (if (bolp) 0 c-brace-imaginary-offset)) | 111 (if (bolp) 0 c-brace-imaginary-offset)) |
112 ;; If the openbrace is preceded by a parenthesized exp, | 112 ;; If the openbrace is preceded by a parenthesized exp, |
113 ;; move to the beginning of that; possibly a different | 113 ;; move to the beginning of that; possibly a different |
114 ;; line | 114 ;; line |
115 (progn | 115 (progn |
116 (if (eq (preceding-char) ?\)) | 116 (if (eq (char-before) ?\)) |
117 (forward-sexp -1)) | 117 (forward-sexp -1)) |
118 ;; Get initial indentation of the line we are on. | 118 ;; Get initial indentation of the line we are on. |
119 (current-indentation))))) | 119 (current-indentation))))) |
120 (- bocm-lossage curcol)))) | 120 (- bocm-lossage curcol)))) |
121 | 121 |
127 (curcol (progn | 127 (curcol (progn |
128 (goto-char (cdr langelem)) | 128 (goto-char (cdr langelem)) |
129 (current-column))) | 129 (current-column))) |
130 (bocm-lossage (progn | 130 (bocm-lossage (progn |
131 (goto-char (cdr langelem)) | 131 (goto-char (cdr langelem)) |
132 (if (= (following-char) ?{) | 132 (if (eq (char-after) ?{) |
133 (setq bracep t) | 133 (setq bracep t) |
134 (goto-char here) | 134 (goto-char here) |
135 (beginning-of-line) | 135 (beginning-of-line) |
136 (backward-up-list 1) | 136 (backward-up-list 1) |
137 (forward-char 1) | 137 (forward-char 1) |