annotate lisp/packages/mic-paren.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents bcdc7deadc19
children 441bb1e64a06 a145efe76779
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
1 ;;; mic-paren.el --- highlight matching paren.
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
2 ;;; Version 1.2 - 96-09-19
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 12
diff changeset
3 ;;; Copyright (C) 1996 Mikael Sjödin (mic@docs.uu.se)
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
4 ;;;
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 12
diff changeset
5 ;;; Author: Mikael Sjödin -- mic@docs.uu.se
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
6 ;;; Keywords: languages, faces
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
7 ;;;
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
8 ;;; This file is NOT part of GNU Emacs.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
9 ;;; You may however redistribute it and/or modify it under the terms of the GNU
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
10 ;;; General Public License as published by the Free Software Foundation; either
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
11 ;;; version 2, or (at your option) any later version.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
12 ;;;
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
13 ;;; mic-paren is distributed in the hope that it will be useful,
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
14 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
16 ;;; GNU General Public License for more details.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
17
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
18 ;;; ----------------------------------------------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
19 ;;; Short Description:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
20 ;;;
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
21 ;;; Load this file and Emacs will display highlighting on whatever
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
22 ;;; parenthesis matches the one before or after point. This is an extension to
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
23 ;;; the paren.el file distributed with Emacs. The default behaviour is similar
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
24 ;;; to paren.el but try the authors favourite options:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
25 ;;; (setq paren-face 'bold)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
26 ;;; (setq paren-sexp-mode t)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
27
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
28 ;;; ----------------------------------------------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
29 ;;; Installation:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
30 ;;;
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
31 ;;; o Place this file in a directory in your 'load-path.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
32 ;;; o Put the following in your .emacs file:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
33 ;;; (if window-system
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
34 ;;; (require 'mic-paren))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
35 ;;; o Restart your Emacs. mic-paren is now installed and activated!
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
36 ;;; o To list the possible customisation enter `C-h f paren-activate'
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
37
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
38 ;;; ----------------------------------------------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
39 ;;; Long Description:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
40 ;;;
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
41 ;;; mic-paren.el is an extension to the packages paren.el and stig-paren.el for
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
42 ;;; Emacs. When mic-paren is active (it is activated when loaded) Emacs normal
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
43 ;;; parenthesis matching is deactivated. Instead parenthesis matching will be
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
44 ;;; performed as soon as the cursor is positioned at a parenthesis. The
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
45 ;;; matching parenthesis (or the entire expression between the parenthesises)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
46 ;;; is highlighted until the cursor is moved away from the parenthesis.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
47 ;;; Features include:
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
48 ;;; o Both forward and backward parenthesis matching (simultaneously if
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
49 ;;; cursor is between two expressions).
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
50 ;;; o Indication of mismatched parenthesises.
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
51 ;;; o Recognition of "escaped" parenthesises.
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
52 ;;; o Option to select if only the matching parenthesis or the entire
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
53 ;;; expression should be highlighted.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
54 ;;; o Message describing the match when the matching parenthesis is
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
55 ;;; off-screen.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
56 ;;; o Optional delayed highlighting (useful on slow systems),
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
57 ;;; o Functions to activate/deactivate mic-paren.el is provided.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
58 ;;; o Numerous options to control the behaviour and appearance of
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
59 ;;; mic-paren.el.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
60 ;;;
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
61 ;;; mic-paren.el is developed and tested under Emacs 19.28 - 19.34. It should
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
62 ;;; work on earlier and forthcoming Emacs versions. XEmacs compatibility has
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
63 ;;; been provided by Steven L Baur <steve@altair.xemacs.org>.
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
64 ;;;
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
65 ;;; This file can be obtained from http://www.docs.uu.se/~mic/emacs.html
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
66
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
67 ;;; ======================================================================
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
68 ;;; User Options:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
69
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
70 (defvar paren-priority nil
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
71 "*Defines the behaviour of mic-paren when point is between a closing and an
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
72 opening parenthesis.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
73
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
74 A value of 'close means highlight the parenthesis matching the
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
75 close-parenthesis before the point.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
76
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
77 A value of 'open means highlight the parenthesis matching the open-parenthesis
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
78 after the point.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
79
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
80 Any other value means highlight both parenthesis matching the parenthesis
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
81 beside the point.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
82
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
83
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
84 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
85
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
86 (defvar paren-sexp-mode nil
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
87 "*If nil only the matching parenthesis is highlighted.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
88 If non-nil the whole s-expression between the matching parenthesis is
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
89 highlighted.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
90
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
91 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
92
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
93 (defvar paren-highlight-at-point t
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
94 "*If non-nil and point is after a close parenthesis, both the close and
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
95 open parenthesis is highlighted. If nil, only the open parenthesis is
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
96 highlighted.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
97
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
98 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
99
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
100 (defvar paren-highlight-offscreen nil
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
101 "*If non-nil stig-paren will highlight text which is not visible in the
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
102 current buffer.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
103
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
104 This is useful if you regularly display the current buffer in multiple windows
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
105 or frames. For instance if you use follow-mode (by andersl@csd.uu.se), however
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
106 it may slow down your Emacs.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
107
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
108 (This variable is ignored (treated as non-nil) if you set paren-sexp-mode to
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
109 non-nil.)")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
110
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
111 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
112
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
113 (defvar paren-message-offscreen t
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
114 "*Display message if matching parenthesis is off-screen.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
115
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
116 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
117
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
118 (defvar paren-message-no-match t
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
119 "*Display message if no matching parenthesis is found.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
120
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
121 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
122
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
123 (defvar paren-ding-unmatched nil
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
124 "*Make noise if the cursor is at an unmatched parenthesis or no matching
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
125 parenthesis is found.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
126
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
127 Even if nil, typing an unmatched parenthesis produces a ding.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
128
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
129 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
130
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
131 (defvar paren-delay nil
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
132 "*This variable controls when highlighting is done. The variable has
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
133 different meaning in different versions of Emacs.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
134
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
135 In Emacs 19.29 and below:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
136 This variable is ignored.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
137
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
138 In Emacs 19.30:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
139 A value of nil will make highlighting happen immediately (this may slow down
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
140 your Emacs if running on a slow system). Any non-nil value will delay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
141 highlighting for the time specified by post-command-idle-delay.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
142
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
143 In Emacs 19.31 and above:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
144 A value of nil will make highlighting happen immediately (this may slow down
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
145 your Emacs if running on a slow system). If not nil, the value should be a
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
146 number (possible a floating point number if your Emacs support floating point
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
147 numbers). The number is the delay before mic-paren performs highlighting.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
148
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
149 If you change this variable when mic-paren is active you have to re-activate
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
150 (with M-x paren-activate) mic-paren for the change to take effect.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
151
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
152
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
153 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
154
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
155 (defvar paren-dont-touch-blink nil
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
156 "*If non-nil mic-paren will not change the value of blink-matching-paren when
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
157 activated of deactivated.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
158
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
159 If nil mic-paren turns of blinking when activated and turns on blinking when
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
160 deactivated.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
161
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
162 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
163
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
164 (defvar paren-dont-activate-on-load nil
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
165 "*If non-nil mic-paren will not activate itself when loaded.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
166
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
167 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
168
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
169 (defvar paren-face (if (x-display-color-p) 'highlight 'underline)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
170 "*Face to use for showing the matching parenthesis.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
171
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
172 ;;; ------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
173
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
174 (defvar paren-mismatch-face (if (x-display-color-p)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
175 (let ((fn 'paren-mismatch-face))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
176 (copy-face 'default fn)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
177 (set-face-background fn "DeepPink")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
178 fn)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
179 'modeline)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
180 "*Face to use when highlighting a mismatched parenthesis.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
181
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
182 ;;; ======================================================================
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
183 ;;; User Functions:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
184
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
185 ;; XEmacs compatibility (by Steven L Baur <steve@altair.xemacs.org>)
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
186 (eval-and-compile
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
187 (if (fboundp 'make-extent)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
188 (progn
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
189 (fset 'mic-make-overlay 'make-extent)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
190 (fset 'mic-delete-overlay 'delete-extent)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
191 (fset 'mic-overlay-put 'set-extent-property)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
192 (defun mic-cancel-timer (timer) (delete-itimer timer))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
193 (defun mic-run-with-idle-timer (secs repeat function &rest args)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
194 (start-itimer "mic-paren-idle" function secs nil))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
195 )
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
196 (fset 'mic-make-overlay 'make-overlay)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
197 (fset 'mic-delete-overlay 'delete-overlay)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
198 (fset 'mic-overlay-put 'overlay-put)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
199 (fset 'mic-cancel-timer 'cancel-timer)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
200 (fset 'mic-run-with-idle-timer 'run-with-idle-timer)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
201 ))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
202
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
203
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
204 (defun paren-activate ()
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
205 "Activates mic-paren parenthesis highlighting.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
206 paren-activate deactivates the paren.el and stig-paren.el packages if they are
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
207 active
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
208 Options:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
209 paren-priority
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
210 paren-sexp-mode
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
211 paren-highlight-at-point
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
212 paren-highlight-offscreen
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
213 paren-message-offscreen
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
214 paren-message-no-match
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
215 paren-ding-unmatched
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
216 paren-delay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
217 paren-dont-touch-blink
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
218 paren-dont-activate-on-load
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
219 paren-face
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
220 paren-mismatch-face"
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
221 (interactive)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
222 ;; Deactivate mic-paren.el (To remove redundant hooks)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
223 (paren-deactivate)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
224 ;; Deactivate paren.el if loaded
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
225 (if (boundp 'post-command-idle-hook)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
226 (remove-hook 'post-command-idle-hook 'show-paren-command-hook))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
227 (remove-hook 'post-command-hook 'show-paren-command-hook)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
228 (and (boundp 'show-paren-overlay)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
229 show-paren-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
230 (mic-delete-overlay show-paren-overlay))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
231 (and (boundp 'show-paren-overlay-1)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
232 show-paren-overlay-1
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
233 (mic-delete-overlay show-paren-overlay-1))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
234 ;; Deactivate stig-paren.el if loaded
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
235 (if (boundp 'post-command-idle-hook)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
236 (remove-hook 'post-command-idle-hook 'stig-paren-command-hook))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
237 (remove-hook 'post-command-hook 'stig-paren-command-hook)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
238 (remove-hook 'post-command-hook 'stig-paren-safe-command-hook)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
239 (remove-hook 'pre-command-hook 'stig-paren-delete-overlay)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
240 ;; Deactivate Emacs standard parenthesis blinking
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
241 (or paren-dont-touch-blink
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
242 (setq blink-matching-paren nil))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
243
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
244 (cond(
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
245 ;; If timers are available use them
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
246 ;; (Emacs 19.31 and above)
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
247 (featurep 'timer)
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
248 (if (numberp paren-delay)
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
249 (setq mic-paren-idle-timer
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
250 (mic-run-with-idle-timer paren-delay t
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
251 'mic-paren-command-idle-hook))
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 6
diff changeset
252 (add-hook 'post-command-hook 'mic-paren-command-hook)))
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
253 ;; If the idle hook exists assume it is functioning and use it
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
254 ;; (Emacs 19.30)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
255 ((and (boundp 'post-command-idle-hook)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
256 (boundp 'post-command-idle-delay))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
257 (if paren-delay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
258 (add-hook 'post-command-idle-hook 'mic-paren-command-idle-hook)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
259 (add-hook 'post-command-hook 'mic-paren-command-hook)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
260 ;; Check if we (at least) have a post-comand-hook, and use it
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
261 ;; (Emacs 19.29 and below)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
262 ((boundp 'post-command-hook)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
263 (add-hook 'post-command-hook 'mic-paren-command-hook))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
264 ;; Not possible to install mic-paren hooks
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
265 (t (error "Cannot activate mic-paren in this Emacs version"))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
266
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
267
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
268
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
269 (defun paren-deactivate ()
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
270 "Deactivates mic-paren parenthesis highlighting"
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
271 (interactive)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
272 ;; Deactivate (don't bother to check where/if mic-paren is acivte, just
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
273 ;; delete all possible hooks and timers)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
274 (if (boundp 'post-command-idle-hook)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
275 (remove-hook 'post-command-idle-hook 'mic-paren-command-idle-hook))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
276 (if mic-paren-idle-timer
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
277 (mic-cancel-timer mic-paren-idle-timer))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
278 (remove-hook 'post-command-hook 'mic-paren-command-hook)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
279
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
280 ;; Remove any old highlighs
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
281 (mic-delete-overlay mic-paren-backw-overlay)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
282 (mic-delete-overlay mic-paren-point-overlay)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
283 (mic-delete-overlay mic-paren-forw-overlay)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
284
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
285 ;; Reactivate Emacs standard parenthesis blinking
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
286 (or paren-dont-touch-blink
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
287 (setq blink-matching-paren t))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
288 )
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
289
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
290 ;;; ======================================================================
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
291 ;;; Internal variables:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
292
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
293 (defvar mic-paren-backw-overlay (mic-make-overlay (point-min) (point-min))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
294 "Overlay for the open-paren which matches the close-paren before
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
295 point. When in sexp-mode this is the overlay for the expression before point.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
296
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
297 (defvar mic-paren-point-overlay (mic-make-overlay (point-min) (point-min))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
298 "Overlay for the close-paren before point.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
299 (Not used when is sexp-mode.)")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
300
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
301 (defvar mic-paren-forw-overlay (mic-make-overlay (point-min) (point-min))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
302 "Overlay for the close-paren which matches the open-paren after
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
303 point. When in sexp-mode this is the overlay for the expression after point.")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
304
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
305 (defvar mic-paren-idle-timer nil
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
306 "Idle-timer. Used only in Emacs 19.31 and above (and if paren-delay is nil)")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
307
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
308
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
309
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
310
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
311 ;;; ======================================================================
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
312 ;;; Internal function:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
313
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
314
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
315
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
316 (defun mic-paren-command-hook ()
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
317 (or executing-kbd-macro
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
318 (input-pending-p) ;[This might cause trouble since the
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
319 ; function is unreliable]
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
320 (condition-case paren-error
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 12
diff changeset
321 (mic-paren-highlight)
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
322 (error
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
323 (if (not (window-minibuffer-p (selected-window)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
324 (message "mic-paren catched error (please report): %s"
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
325 paren-error))))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
326
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
327 (defun mic-paren-command-idle-hook ()
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
328 (condition-case paren-error
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 12
diff changeset
329 (mic-paren-highlight)
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
330 (error
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
331 (if (not (window-minibuffer-p (selected-window)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
332 (message "mic-paren catched error (please report): %s"
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
333 paren-error)))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
334
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
335
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 12
diff changeset
336 (defun mic-paren-highlight ()
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
337 "The main-function of mic-paren. Does all highlighting, dinging, messages,
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
338 cleaning-up."
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
339 ;; Remove any old highlighting
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
340 (mic-delete-overlay mic-paren-forw-overlay)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
341 (mic-delete-overlay mic-paren-point-overlay)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
342 (mic-delete-overlay mic-paren-backw-overlay)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
343
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
344 ;; Handle backward highlighting (when after a close-paren):
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
345 ;; If positioned after a close-paren, and
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
346 ;; not before an open-paren when priority=open, and
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
347 ;; the close-paren is not escaped then
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
348 ;; perform highlighting
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
349 ;; else
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
350 ;; remove any old backward highlights
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
351 (if (and (eq (char-syntax (preceding-char)) ?\))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
352 (not (and (eq (char-syntax (following-char)) ?\()
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
353 (eq paren-priority 'open)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
354 (paren-evenp (paren-backslashes-before-char (1- (point)))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
355 (let (open)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
356 ;; Find the position for the open-paren
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
357 (save-excursion
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
358 (save-restriction
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
359 (if blink-matching-paren-distance
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
360 (narrow-to-region
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
361 (max (point-min)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
362 (- (point) blink-matching-paren-distance))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
363 (point-max)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
364 (condition-case ()
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
365 (setq open (scan-sexps (point) -1))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
366 (error nil))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
367
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
368 ;; If match found
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
369 ;; highlight and/or print messages
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
370 ;; else
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
371 ;; print no-match message
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
372 ;; remove any old highlights
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
373 (if open
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
374 (let ((mismatch (/= (matching-paren (preceding-char))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
375 (char-after open)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
376 (visible (pos-visible-in-window-p open)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
377 ;; If highlight is appropriate
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 12
diff changeset
378 ;; highlight
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
379 ;; else
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
380 ;; remove any old highlight
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
381 (if (or visible paren-highlight-offscreen paren-sexp-mode)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
382 ;; If sexp-mode
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
383 ;; highlight sexp
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
384 ;; else
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
385 ;; highlight the two parens
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
386 (if paren-sexp-mode
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
387 (progn
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
388 (setq mic-paren-backw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
389 (mic-make-overlay open (point)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
390 (if mismatch
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
391 (mic-overlay-put mic-paren-backw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
392 'face paren-mismatch-face)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
393 (mic-overlay-put mic-paren-backw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
394 'face paren-face)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
395 (setq mic-paren-backw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
396 (mic-make-overlay open (1+ open)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
397 (and paren-highlight-at-point
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
398 (setq mic-paren-point-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
399 (mic-make-overlay (1- (point)) (point))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
400 (if mismatch
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
401 (progn
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
402 (mic-overlay-put mic-paren-backw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
403 'face paren-mismatch-face)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
404 (and paren-highlight-at-point
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
405 (mic-overlay-put mic-paren-point-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
406 'face paren-mismatch-face)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
407 (mic-overlay-put mic-paren-backw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
408 'face paren-face)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
409 (and paren-highlight-at-point
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
410 (mic-overlay-put mic-paren-point-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
411 'face paren-face)))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
412 ;; Print messages if match is offscreen
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
413 (and paren-message-offscreen
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
414 (not visible)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
415 (not (window-minibuffer-p (selected-window)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
416 (message "%s %s"
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
417 (if mismatch "MISMATCH:" "Matches")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
418 (mic-paren-get-matching-open-text open)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
419 ;; Ding if mismatch
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
420 (and mismatch
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
421 paren-ding-unmatched
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
422 (ding)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
423 (and paren-message-no-match
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
424 (not (window-minibuffer-p (selected-window)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
425 (message "No opening parenthesis found"))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
426 (and paren-message-no-match
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
427 paren-ding-unmatched
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
428 (ding)))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
429
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
430 ;; Handle forward highlighting (when before an open-paren):
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
431 ;; If positioned before an open-paren, and
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
432 ;; not after a close-paren when priority=close, and
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
433 ;; the open-paren is not escaped then
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
434 ;; perform highlighting
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
435 ;; else
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
436 ;; remove any old forward highlights
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
437 (if (and (eq (char-syntax (following-char)) ?\()
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
438 (not (and (eq (char-syntax (preceding-char)) ?\))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
439 (eq paren-priority 'close)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
440 (paren-evenp (paren-backslashes-before-char (point))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
441 (let (close)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
442 ;; Find the position for the close-paren
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
443 (save-excursion
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
444 (save-restriction
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
445 (if blink-matching-paren-distance
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
446 (narrow-to-region
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
447 (point-min)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
448 (min (point-max)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
449 (+ (point) blink-matching-paren-distance))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
450 (condition-case ()
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
451 (setq close (scan-sexps (point) 1))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
452 (error nil))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
453 ;; If match found
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
454 ;; highlight and/or print messages
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
455 ;; else
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
456 ;; print no-match message
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
457 ;; remove any old highlights
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
458 (if close
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
459 (let ((mismatch (/= (matching-paren (following-char))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
460 (char-after (1- close))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
461 (visible (pos-visible-in-window-p close)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
462 ;; If highlight is appropriate
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents: 12
diff changeset
463 ;; highlight
6
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
464 ;; else
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
465 ;; remove any old highlight
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
466 (if (or visible paren-highlight-offscreen paren-sexp-mode)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
467 ;; If sexp-mode
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
468 ;; highlight sexp
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
469 ;; else
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
470 ;; highlight the two parens
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
471 (if paren-sexp-mode
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
472 (progn
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
473 (setq mic-paren-forw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
474 (mic-make-overlay (point) close))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
475 (if mismatch
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
476 (mic-overlay-put mic-paren-forw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
477 'face paren-mismatch-face)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
478 (mic-overlay-put mic-paren-forw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
479 'face paren-face)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
480 (setq mic-paren-forw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
481 (mic-make-overlay (1- close) close))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
482 (if mismatch
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
483 (mic-overlay-put mic-paren-forw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
484 'face paren-mismatch-face)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
485 (mic-overlay-put mic-paren-forw-overlay
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
486 'face paren-face))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
487
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
488 ;; Print messages if match is offscreen
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
489 (and paren-message-offscreen
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
490 (not visible)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
491 (not (window-minibuffer-p (selected-window)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
492 (message "%s %s"
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
493 (if mismatch "MISMATCH:" "Matches")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
494 (mic-paren-get-matching-close-text close)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
495 ;; Ding if mismatch
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
496 (and mismatch
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
497 paren-ding-unmatched
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
498 (ding)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
499 (and paren-message-no-match
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
500 (not (window-minibuffer-p (selected-window)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
501 (message "No closing parenthesis found"))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
502 (and paren-message-no-match
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
503 paren-ding-unmatched
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
504 (ding))))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
505
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
506 ;;; --------------------------------------------------
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
507
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
508 (defun mic-paren-get-matching-open-text (open)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
509 "Returns a string with the context around OPEN-paren."
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
510 ;; If there's stuff on this line preceding the paren, then display text from
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
511 ;; beginning of line to paren.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
512 ;;
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
513 ;; If, however, the paren is at the beginning of a line, then skip whitespace
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
514 ;; forward and display text from paren to end of the next line containing
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
515 ;; non-space text.
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
516 ;;
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
517 ;; (Same as in stig-paren.el)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
518 (save-excursion
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
519 (goto-char open)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
520 (if (save-excursion
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
521 (skip-chars-backward " \t")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
522 (not (bolp)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
523 (progn
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
524 (beginning-of-line)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
525 (concat (buffer-substring (point) (1+ open)) "..."))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
526 (forward-char 1) ;From the beginning-of-line
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
527 (skip-chars-forward "\n \t")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
528 (end-of-line)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
529 (buffer-substring open (point)))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
530
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
531
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
532 (defun mic-paren-get-matching-close-text (close)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
533 "Returns a string with the context around CLOSE-paren."
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
534 ;; The whole line up until the close-paren with "..." appended if there are
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
535 ;; more text after the close-paren
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
536 (save-excursion
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
537 (goto-char close)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
538 (beginning-of-line)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
539 (concat
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
540 (buffer-substring (point) close)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
541 (progn
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
542 (goto-char close)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
543 (if (looking-at "[ \t]*$")
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
544 ""
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
545 "...")))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
546
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
547
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
548 (defun paren-evenp (number)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
549 "Returns t if NUMBER is an even number, nil otherwise"
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
550 (eq 0 (% number 2)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
551
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
552 (defun paren-backslashes-before-char (pnt)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
553 (setq pnt (1- pnt))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
554 (let ((n 0))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
555 (while (and (>= pnt (point-min))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
556 (eq (char-syntax (char-after pnt)) ?\\))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
557 (setq n (1+ n))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
558 (setq pnt (1- pnt)))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
559 n))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
560
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
561
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
562
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
563 ;;; ======================================================================
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
564 ;;; Initialisation when loading:
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
565
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
566
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
567 (or paren-dont-activate-on-load
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
568 (paren-activate))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
569
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
570 ;;; This is in case mic-paren.el is preloaded. [Does this work? /Mic]
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
571 (add-hook 'window-setup-hook
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
572 (function (lambda ()
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
573 (and window-system
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
574 (not paren-dont-activate-on-load)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
575 (paren-activate)))))
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
576
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
577 (provide 'mic-paren)
27bc7f280385 Import from CVS: tag r19-15b4
cvs
parents:
diff changeset
578 (provide 'paren)