annotate lisp/progmodes/cc-defs.el @ 21794:1a370f7cc0c1 gcc-2_8_1-980402 gcc-2_8_1-980502 gcc-2_8_1-980513

automatically generated from GPLed version
author Ulrich Drepper <drepper@redhat.com>
date Mon, 27 Apr 1998 23:48:59 +0000
parents b113342cb7ad
children 5b0864259a4b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21112
b113342cb7ad (c-emacs-features): Var moved to cc-vars.el.
Richard M. Stallman <rms@gnu.org>
parents: 20913
diff changeset
1 ;;; cc-defs.el --- compile time definitions for CC Mode
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
20913
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
3 ;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc.
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Authors: 1992-1997 Barry A. Warsaw
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; 1987 Dave Detlefs and Stewart Clamen
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; 1985 Richard M. Stallman
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; Maintainer: cc-mode-help@python.org
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; Created: 22-Apr-1997 (split from cc-mode.el)
20141
1a85b213eb6d Remove version number.
Karl Heuer <kwzh@gnu.org>
parents: 20140
diff changeset
10 ;; Version: See cc-mode.el
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; Keywords: c languages oop
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; This file is part of GNU Emacs.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; it under the terms of the GNU General Public License as published by
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; the Free Software Foundation; either version 2, or (at your option)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; any later version.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; GNU Emacs is distributed in the hope that it will be useful,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; GNU General Public License for more details.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; You should have received a copy of the GNU General Public License
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; Boston, MA 02111-1307, USA.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 (defsubst c-point (position)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; Returns the value of point at certain commonly referenced POSITIONs.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; POSITION can be one of the following symbols:
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;;
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; bol -- beginning of line
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; eol -- end of line
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; bod -- beginning of defun
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; boi -- back to indentation
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; ionl -- indentation of next line
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; iopl -- indentation of previous line
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; bonl -- beginning of next line
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; bopl -- beginning of previous line
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;;
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; This function does not modify point or mark.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 (let ((here (point)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 (cond
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ((eq position 'bol) (beginning-of-line))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ((eq position 'eol) (end-of-line))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ((eq position 'boi) (back-to-indentation))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ((eq position 'bonl) (forward-line 1))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ((eq position 'bopl) (forward-line -1))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ((eq position 'iopl)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 (forward-line -1)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 (back-to-indentation))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ((eq position 'ionl)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 (forward-line 1)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 (back-to-indentation))
20913
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
58 ((eq position 'bod)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
59 (if (and (fboundp 'buffer-syntactic-context-depth)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
60 c-enable-xemacs-performance-kludge-p)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
61 ;; XEmacs only. This can improve the performance of
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
62 ;; c-parse-state to between 3 and 60 times faster when
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
63 ;; braces are hung. It can cause c-parse-state to be
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
64 ;; slightly slower when braces are not hung, but general
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
65 ;; editing appears to be still about as fast.
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
66 (let (pos)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
67 (while (not pos)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
68 (save-restriction
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
69 (widen)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
70 (setq pos (scan-lists (point) -1
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
71 (buffer-syntactic-context-depth)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
72 nil t)))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
73 (cond
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
74 ((bobp) (setq pos (point-min)))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
75 ((not pos)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
76 (let ((distance (skip-chars-backward "^{")))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
77 ;; unbalanced parenthesis, while illegal C code,
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
78 ;; shouldn't cause an infloop! See unbal.c
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
79 (when (zerop distance)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
80 ;; Punt!
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
81 (beginning-of-defun)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
82 (setq pos (point)))))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
83 ((= pos 0))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
84 ((not (eq (char-after pos) ?{))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
85 (goto-char pos)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
86 (setq pos nil))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
87 ))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
88 (goto-char pos))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
89 ;; Emacs, which doesn't have buffer-syntactic-context-depth
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
90 ;;
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
91 ;; NOTE: This should be the only explicit use of
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
92 ;; beginning-of-defun in CC Mode. Eventually something better
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
93 ;; than b-o-d will be available and this should be the only
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
94 ;; place the code needs to change. Everything else should use
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
95 ;; (goto-char (c-point 'bod))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
96 (beginning-of-defun)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
97 ;; if defun-prompt-regexp is non-nil, b-o-d won't leave us at
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
98 ;; the open brace.
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
99 (and defun-prompt-regexp
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
100 (looking-at defun-prompt-regexp)
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
101 (goto-char (match-end 0)))
c7ee864ae985 (c-point): In XEmacs, use scan-lists + buffer-syntactic-context-depth.
Richard M. Stallman <rms@gnu.org>
parents: 20141
diff changeset
102 ))
18720
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (t (error "unknown buffer position requested: %s" position))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 )
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (prog1
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (point)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (goto-char here))))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (defmacro c-safe (&rest body)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ;; safely execute BODY, return nil if an error occurred
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (` (condition-case nil
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (progn (,@ body))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (error nil))))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (defmacro c-add-syntax (symbol &optional relpos)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 ;; a simple macro to append the syntax in symbol to the syntax list.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 ;; try to increase performance by using this macro
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (` (setq syntax (cons (cons (, symbol) (, relpos)) syntax))))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (defsubst c-auto-newline ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 ;; if auto-newline feature is turned on, insert a newline character
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 ;; and return t, otherwise return nil.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 (and c-auto-newline
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 (not (c-in-literal))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 (not (newline))))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (defsubst c-intersect-lists (list alist)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 ;; return the element of ALIST that matches the first element found
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 ;; in LIST. Uses assq.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (let (match)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (while (and list
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (not (setq match (assq (car list) alist))))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 (setq list (cdr list)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 match))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 (defsubst c-lookup-lists (list alist1 alist2)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 ;; first, find the first entry from LIST that is present in ALIST1,
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 ;; then find the entry in ALIST2 for that entry.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 (assq (car (c-intersect-lists list alist1)) alist2))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 (defsubst c-langelem-col (langelem &optional preserve-point)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 ;; convenience routine to return the column of langelem's relpos.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 ;; Leaves point at the relpos unless preserve-point is non-nil.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (let ((here (point)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 (goto-char (cdr langelem))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (prog1 (current-column)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 (if preserve-point
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 (goto-char here))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 )))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 (defsubst c-update-modeline ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 ;; set the c-auto-hungry-string for the correct designation on the modeline
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 (setq c-auto-hungry-string
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (if c-auto-newline
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (if c-hungry-delete-key "/ah" "/a")
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 (if c-hungry-delete-key "/h" nil)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 (force-mode-line-update))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (defsubst c-keep-region-active ()
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 ;; Do whatever is necessary to keep the region active in XEmacs.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 ;; Ignore byte-compiler warnings you might see. This is not needed
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 ;; for Emacs.
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (and (boundp 'zmacs-region-stays)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 (setq zmacs-region-stays t)))
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 (provide 'cc-defs)
fc6d08b9bbe2 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 ;;; cc-defs.el ends here