Mercurial > emacs
comparison lisp/progmodes/cperl-mode.el @ 20961:79530a618cd3
Commented out line 471 (miniperl entry in interpreter-mode-alist)
Removed stray =06 entry on line 4445.
Customized.
author | Stephen Eglen <stephen@gnu.org> |
---|---|
date | Sun, 22 Feb 1998 20:03:39 +0000 |
parents | f3f9df46d008 |
children | 0544aa57ff27 |
comparison
equal
deleted
inserted
replaced
20960:2f9b7d0689a9 | 20961:79530a618cd3 |
---|---|
61 | 61 |
62 ;; (define-key global-map [M-S-down-mouse-3] 'imenu) | 62 ;; (define-key global-map [M-S-down-mouse-3] 'imenu) |
63 | 63 |
64 ;;; Code: | 64 ;;; Code: |
65 | 65 |
66 (defgroup cperl nil | |
67 "Major mode for editing Perl code." | |
68 :prefix "cperl-" | |
69 :group 'languages) | |
70 | |
66 (defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version)) | 71 (defconst cperl-xemacs-p (string-match "XEmacs\\|Lucid" emacs-version)) |
67 | 72 |
68 (defvar cperl-extra-newline-before-brace nil | 73 (defcustom cperl-extra-newline-before-brace nil |
69 "*Non-nil means that if, elsif, while, until, else, for, foreach | 74 "*Non-nil means that if, elsif, while, until, else, for, foreach |
70 and do constructs look like: | 75 and do constructs look like: |
71 | 76 |
72 if () | 77 if () |
73 { | 78 { |
75 | 80 |
76 instead of: | 81 instead of: |
77 | 82 |
78 if () { | 83 if () { |
79 } | 84 } |
80 ") | 85 " |
81 | 86 :type 'boolean |
82 (defvar cperl-indent-level 2 | 87 :group 'cperl) |
83 "*Indentation of CPerl statements with respect to containing block.") | 88 |
84 (defvar cperl-lineup-step nil | 89 (defcustom cperl-indent-level 2 |
90 "*Indentation of CPerl statements with respect to containing block." | |
91 :type 'integer | |
92 :group 'cperl) | |
93 | |
94 (defcustom cperl-lineup-step nil | |
85 "*`cperl-lineup' will always lineup at multiple of this number. | 95 "*`cperl-lineup' will always lineup at multiple of this number. |
86 If `nil', the value of `cperl-indent-level' will be used.") | 96 If `nil', the value of `cperl-indent-level' will be used." |
87 (defvar cperl-brace-imaginary-offset 0 | 97 :type '(choice (const nil) integer) |
98 :group 'cperl) | |
99 (defcustom cperl-brace-imaginary-offset 0 | |
88 "*Imagined indentation of a Perl open brace that actually follows a statement. | 100 "*Imagined indentation of a Perl open brace that actually follows a statement. |
89 An open brace following other text is treated as if it were this far | 101 An open brace following other text is treated as if it were this far |
90 to the right of the start of its line.") | 102 to the right of the start of its line." |
91 (defvar cperl-brace-offset 0 | 103 :type 'integer |
92 "*Extra indentation for braces, compared with other text in same context.") | 104 :group 'cperl) |
93 (defvar cperl-label-offset -2 | 105 |
94 "*Offset of CPerl label lines relative to usual indentation.") | 106 (defcustom cperl-brace-offset 0 |
95 (defvar cperl-min-label-indent 1 | 107 "*Extra indentation for braces, compared with other text in same context." |
96 "*Minimal offset of CPerl label lines.") | 108 :type 'integer |
97 (defvar cperl-continued-statement-offset 2 | 109 :group 'cperl) |
98 "*Extra indent for lines not starting new statements.") | 110 (defcustom cperl-label-offset -2 |
99 (defvar cperl-continued-brace-offset 0 | 111 "*Offset of CPerl label lines relative to usual indentation." |
112 :type 'integer | |
113 :group 'cperl) | |
114 (defcustom cperl-min-label-indent 1 | |
115 "*Minimal offset of CPerl label lines." | |
116 :type 'integer | |
117 :group 'cperl) | |
118 (defcustom cperl-continued-statement-offset 2 | |
119 "*Extra indent for lines not starting new statements." | |
120 :type 'integer | |
121 :group 'cperl) | |
122 (defcustom cperl-continued-brace-offset 0 | |
100 "*Extra indent for substatements that start with open-braces. | 123 "*Extra indent for substatements that start with open-braces. |
101 This is in addition to cperl-continued-statement-offset.") | 124 This is in addition to cperl-continued-statement-offset." |
102 (defvar cperl-close-paren-offset -1 | 125 :type 'integer |
103 "*Extra indent for substatements that start with close-parenthesis.") | 126 :group 'cperl) |
104 | 127 (defcustom cperl-close-paren-offset -1 |
105 (defvar cperl-auto-newline nil | 128 "*Extra indent for substatements that start with close-parenthesis." |
129 :type 'integer | |
130 :group 'cperl) | |
131 | |
132 (defcustom cperl-auto-newline nil | |
106 "*Non-nil means automatically newline before and after braces, | 133 "*Non-nil means automatically newline before and after braces, |
107 and after colons and semicolons, inserted in CPerl code. The following | 134 and after colons and semicolons, inserted in CPerl code. The following |
108 \\[cperl-electric-backspace] will remove the inserted whitespace. | 135 \\[cperl-electric-backspace] will remove the inserted whitespace. |
109 Insertion after colons requires both this variable and | 136 Insertion after colons requires both this variable and |
110 `cperl-auto-newline-after-colon' set.") | 137 `cperl-auto-newline-after-colon' set." |
111 | 138 :type 'boolean |
112 (defvar cperl-auto-newline-after-colon nil | 139 :group 'cperl) |
140 | |
141 (defcustom cperl-auto-newline-after-colon nil | |
113 "*Non-nil means automatically newline even after colons. | 142 "*Non-nil means automatically newline even after colons. |
114 Subject to `cperl-auto-newline' setting.") | 143 Subject to `cperl-auto-newline' setting." |
115 | 144 :type 'boolean |
116 (defvar cperl-tab-always-indent t | 145 :group 'cperl) |
146 | |
147 (defcustom cperl-tab-always-indent t | |
117 "*Non-nil means TAB in CPerl mode should always reindent the current line, | 148 "*Non-nil means TAB in CPerl mode should always reindent the current line, |
118 regardless of where in the line point is when the TAB command is used.") | 149 regardless of where in the line point is when the TAB command is used." |
119 | 150 :type 'boolean |
120 (defvar cperl-font-lock nil | 151 :group 'cperl) |
152 | |
153 (defcustom cperl-font-lock nil | |
121 "*Non-nil (and non-null) means CPerl buffers will use font-lock-mode. | 154 "*Non-nil (and non-null) means CPerl buffers will use font-lock-mode. |
122 Can be overwritten by `cperl-hairy' if nil.") | 155 Can be overwritten by `cperl-hairy' if nil." |
123 | 156 :type 'boolean |
124 (defvar cperl-electric-lbrace-space nil | 157 :group 'cperl) |
158 | |
159 (defcustom cperl-electric-lbrace-space nil | |
125 "*Non-nil (and non-null) means { after $ in CPerl buffers should be preceded by ` '. | 160 "*Non-nil (and non-null) means { after $ in CPerl buffers should be preceded by ` '. |
126 Can be overwritten by `cperl-hairy' if nil.") | 161 Can be overwritten by `cperl-hairy' if nil." |
127 | 162 :type 'boolean |
128 (defvar cperl-electric-parens-string "({[]})<" | 163 :group 'cperl) |
164 | |
165 (defcustom cperl-electric-parens-string "({[]})<" | |
129 "*String of parentheses that should be electric in CPerl. | 166 "*String of parentheses that should be electric in CPerl. |
130 Closing ones are electric only if the region is highlighted.") | 167 Closing ones are electric only if the region is highlighted." |
131 | 168 :type 'string |
132 (defvar cperl-electric-parens nil | 169 :group 'cperl) |
170 | |
171 (defcustom cperl-electric-parens nil | |
133 "*Non-nil (and non-null) means parentheses should be electric in CPerl. | 172 "*Non-nil (and non-null) means parentheses should be electric in CPerl. |
134 Can be overwritten by `cperl-hairy' if nil.") | 173 Can be overwritten by `cperl-hairy' if nil." |
135 (defvar cperl-electric-parens-mark | 174 :type 'boolean |
175 :group 'cperl) | |
176 (defcustom cperl-electric-parens-mark | |
136 (and window-system | 177 (and window-system |
137 (or (and (boundp 'transient-mark-mode) ; For Emacs | 178 (or (and (boundp 'transient-mark-mode) ; For Emacs |
138 transient-mark-mode) | 179 transient-mark-mode) |
139 (and (boundp 'zmacs-regions) ; For XEmacs | 180 (and (boundp 'zmacs-regions) ; For XEmacs |
140 zmacs-regions))) | 181 zmacs-regions))) |
141 "*Not-nil means that electric parens look for active mark. | 182 "*Not-nil means that electric parens look for active mark. |
142 Default is yes if there is visual feedback on mark.") | 183 Default is yes if there is visual feedback on mark." |
143 | 184 :type 'boolean |
144 (defvar cperl-electric-linefeed nil | 185 :group 'cperl) |
186 | |
187 (defcustom cperl-electric-linefeed nil | |
145 "*If true, LFD should be hairy in CPerl, otherwise C-c LFD is hairy. | 188 "*If true, LFD should be hairy in CPerl, otherwise C-c LFD is hairy. |
146 In any case these two mean plain and hairy linefeeds together. | 189 In any case these two mean plain and hairy linefeeds together. |
147 Can be overwritten by `cperl-hairy' if nil.") | 190 Can be overwritten by `cperl-hairy' if nil." |
148 | 191 :type 'boolean |
149 (defvar cperl-electric-keywords nil | 192 :group 'cperl) |
193 | |
194 (defcustom cperl-electric-keywords nil | |
150 "*Not-nil (and non-null) means keywords are electric in CPerl. | 195 "*Not-nil (and non-null) means keywords are electric in CPerl. |
151 Can be overwritten by `cperl-hairy' if nil.") | 196 Can be overwritten by `cperl-hairy' if nil." |
152 | 197 :type 'boolean |
153 (defvar cperl-hairy nil | 198 :group 'cperl) |
154 "*Not-nil means all the bells and whistles are enabled in CPerl.") | 199 |
155 | 200 (defcustom cperl-hairy nil |
156 (defvar cperl-comment-column 32 | 201 "*Not-nil means all the bells and whistles are enabled in CPerl." |
157 "*Column to put comments in CPerl (use \\[cperl-indent]' to lineup with code).") | 202 :type 'boolean |
158 | 203 :group 'cperl) |
159 (defvar cperl-vc-header-alist '((SCCS "$sccs = '%W\%' ;") | 204 |
160 (RCS "$rcs = ' $Id\$ ' ;")) | 205 (defcustom cperl-comment-column 32 |
161 "*What to use as `vc-header-alist' in CPerl.") | 206 "*Column to put comments in CPerl (use \\[cperl-indent] to lineup with code)." |
162 | 207 :type 'integer |
163 (defvar cperl-info-on-command-no-prompt nil | 208 :group 'cperl) |
209 | |
210 (defcustom cperl-vc-header-alist '((SCCS "$sccs = '%W\%' ;") | |
211 (RCS "$rcs = ' $Id\$ ' ;")) | |
212 "*What to use as `vc-header-alist' in CPerl." | |
213 :type '(repeat (list symbol string)) | |
214 :group 'cperl) | |
215 | |
216 (defcustom cperl-info-on-command-no-prompt nil | |
164 "*Not-nil (and non-null) means not to prompt on C-h f. | 217 "*Not-nil (and non-null) means not to prompt on C-h f. |
165 The opposite behaviour is always available if prefixed with C-c. | 218 The opposite behaviour is always available if prefixed with C-c. |
166 Can be overwritten by `cperl-hairy' if nil.") | 219 Can be overwritten by `cperl-hairy' if nil." |
167 | 220 :type 'boolean |
168 (defvar cperl-lazy-help-time nil | 221 :group 'cperl) |
169 "*Not-nil (and non-null) means to show lazy help after given idle time.") | 222 |
170 | 223 (defcustom cperl-lazy-help-time nil |
171 (defvar cperl-pod-face 'font-lock-comment-face | 224 "*Not-nil (and non-null) means to show lazy help after given idle time." |
172 "*The result of evaluation of this expression is used for pod highlighting.") | 225 :type 'boolean |
173 | 226 :group 'cperl) |
174 (defvar cperl-pod-head-face 'font-lock-variable-name-face | 227 |
228 (defcustom cperl-pod-face 'font-lock-comment-face | |
229 "*The result of evaluation of this expression is used for pod highlighting." | |
230 :type 'face | |
231 :group 'cperl) | |
232 | |
233 (defcustom cperl-pod-head-face 'font-lock-variable-name-face | |
175 "*The result of evaluation of this expression is used for pod highlighting. | 234 "*The result of evaluation of this expression is used for pod highlighting. |
176 Font for POD headers.") | 235 Font for POD headers." |
177 | 236 :type 'face |
178 (defvar cperl-here-face 'font-lock-string-face | 237 :group 'cperl) |
179 "*The result of evaluation of this expression is used for here-docs highlighting.") | 238 |
180 | 239 (defcustom cperl-here-face 'font-lock-string-face |
181 (defvar cperl-pod-here-fontify '(featurep 'font-lock) | 240 "*The result of evaluation of this expression is used for here-docs highlighting." |
182 "*Not-nil after evaluation means to highlight pod and here-docs sections.") | 241 :type 'face |
183 | 242 :group 'cperl) |
184 (defvar cperl-pod-here-scan t | 243 |
244 (defcustom cperl-pod-here-fontify '(featurep 'font-lock) | |
245 "*Not-nil after evaluation means to highlight pod and here-docs sections." | |
246 :type 'boolean | |
247 :group 'cperl) | |
248 | |
249 (defcustom cperl-pod-here-scan t | |
185 "*Not-nil means look for pod and here-docs sections during startup. | 250 "*Not-nil means look for pod and here-docs sections during startup. |
186 You can always make lookup from menu or using \\[cperl-find-pods-heres].") | 251 You can always make lookup from menu or using \\[cperl-find-pods-heres]." |
187 | 252 :type 'boolean |
188 (defvar cperl-imenu-addback nil | 253 :group 'cperl) |
254 | |
255 (defcustom cperl-imenu-addback nil | |
189 "*Not-nil means add backreferences to generated `imenu's. | 256 "*Not-nil means add backreferences to generated `imenu's. |
190 May require patched `imenu' and `imenu-go'.") | 257 May require patched `imenu' and `imenu-go'." |
191 | 258 :type 'boolean |
192 (defvar cperl-max-help-size 66 | 259 :group 'cperl) |
193 "*Non-nil means shrink-wrapping of info-buffer allowed up to these percents.") | 260 |
194 | 261 (defcustom cperl-max-help-size 66 |
195 (defvar cperl-shrink-wrap-info-frame t | 262 "*Non-nil means shrink-wrapping of info-buffer allowed up to these percents." |
196 "*Non-nil means shrink-wrapping of info-buffer-frame allowed.") | 263 :type '(choice integer (const nil)) |
197 | 264 :group 'cperl) |
198 (defvar cperl-info-page "perl" | 265 |
266 (defcustom cperl-shrink-wrap-info-frame t | |
267 "*Non-nil means shrink-wrapping of info-buffer-frame allowed." | |
268 :type 'boolean | |
269 :group 'cperl) | |
270 | |
271 (defcustom cperl-info-page "perl" | |
199 "*Name of the info page containing perl docs. | 272 "*Name of the info page containing perl docs. |
200 Older version of this page was called `perl5', newer `perl'.") | 273 Older version of this page was called `perl5', newer `perl'." |
201 | 274 :type 'string |
202 (defvar cperl-use-syntax-table-text-property | 275 :group 'cperl) |
276 | |
277 (defcustom cperl-use-syntax-table-text-property | |
203 (boundp 'parse-sexp-lookup-properties) | 278 (boundp 'parse-sexp-lookup-properties) |
204 "*Non-nil means CPerl sets up and uses `syntax-table' text property.") | 279 "*Non-nil means CPerl sets up and uses `syntax-table' text property." |
205 | 280 :type 'boolean |
206 (defvar cperl-use-syntax-table-text-property-for-tags | 281 :group 'cperl) |
282 | |
283 (defcustom cperl-use-syntax-table-text-property-for-tags | |
207 cperl-use-syntax-table-text-property | 284 cperl-use-syntax-table-text-property |
208 "*Non-nil means: set up and use `syntax-table' text property generating TAGS.") | 285 "*Non-nil means: set up and use `syntax-table' text property generating TAGS." |
209 | 286 :type 'boolean |
210 (defvar cperl-scan-files-regexp "\\.\\([pP][Llm]\\|xs\\)$" | 287 :group 'cperl) |
211 "*Regexp to match files to scan when generating TAGS.") | 288 |
212 | 289 (defcustom cperl-scan-files-regexp "\\.\\([pP][Llm]\\|xs\\)$" |
213 (defvar cperl-noscan-files-regexp "/\\(\\.\\.?\\|SCCS\\|RCS\\|blib\\)$" | 290 "*Regexp to match files to scan when generating TAGS." |
214 "*Regexp to match files/dirs to skip when generating TAGS.") | 291 :type 'regexp |
215 | 292 :group 'cperl) |
216 (defvar cperl-regexp-indent-step nil | 293 |
217 "*indentation used when beautifying regexps. | 294 (defcustom cperl-noscan-files-regexp "/\\(\\.\\.?\\|SCCS\\|RCS\\|blib\\)$" |
218 If `nil', the value of `cperl-indent-level' will be used.") | 295 "*Regexp to match files/dirs to skip when generating TAGS." |
219 | 296 :type 'regexp |
220 (defvar cperl-indent-left-aligned-comments t | 297 :group 'cperl) |
221 "*Non-nil means that the comment starting in leftmost column should indent.") | 298 |
222 | 299 (defcustom cperl-regexp-indent-step nil |
223 (defvar cperl-under-as-char t | 300 "*Indentation used when beautifying regexps. |
224 "*Non-nil means that the _ (underline) should be treated as word char.") | 301 If `nil', the value of `cperl-indent-level' will be used." |
225 | 302 :type '(choice integer (const nil)) |
303 :group 'cperl) | |
304 | |
305 (defcustom cperl-indent-left-aligned-comments t | |
306 "*Non-nil means that the comment starting in leftmost column should indent." | |
307 :type 'boolean | |
308 :group 'cperl) | |
309 | |
310 (defcustom cperl-under-as-char t | |
311 "*Non-nil means that the _ (underline) should be treated as word char." | |
312 :type 'boolean | |
313 :group 'cperl) | |
226 | 314 |
227 | 315 |
228 | 316 |
229 ;;; Short extra-docs. | 317 ;;; Short extra-docs. |
230 | 318 |
456 | 544 |
457 (defsubst cperl-put-do-not-fontify (from to) | 545 (defsubst cperl-put-do-not-fontify (from to) |
458 (put-text-property (max (point-min) (1- from)) | 546 (put-text-property (max (point-min) (1- from)) |
459 to cperl-do-not-fontify t)) | 547 to cperl-do-not-fontify t)) |
460 | 548 |
461 (defvar cperl-mode-hook nil | 549 (defcustom cperl-mode-hook nil |
462 "Hook run by `cperl-mode'.") | 550 "Hook run by `cperl-mode'." |
551 :type 'hook | |
552 :group 'cperl) | |
463 | 553 |
464 | 554 |
465 ;;; Probably it is too late to set these guys already, but it can help later: | 555 ;;; Probably it is too late to set these guys already, but it can help later: |
466 | 556 |
467 ;;;(setq auto-mode-alist | 557 ;;;(setq auto-mode-alist |
468 ;;; (append '(("\\.\\([pP][Llm]\\|al\\)$" . perl-mode)) auto-mode-alist )) | 558 ;;; (append '(("\\.\\([pP][Llm]\\|al\\)$" . perl-mode)) auto-mode-alist )) |
469 ;;;(and (boundp 'interpreter-mode-alist) | 559 ;;;(and (boundp 'interpreter-mode-alist) |
470 ;;; (setq interpreter-mode-alist (append interpreter-mode-alist | 560 ;;; (setq interpreter-mode-alist (append interpreter-mode-alist |
471 '(("miniperl" . perl-mode))))) | 561 ;;; '(("miniperl" . perl-mode))))) |
472 (if (fboundp 'eval-when-compile) | 562 (if (fboundp 'eval-when-compile) |
473 (eval-when-compile | 563 (eval-when-compile |
474 (condition-case nil | 564 (condition-case nil |
475 (require 'imenu) | 565 (require 'imenu) |
476 (error nil)) | 566 (error nil)) |
4440 (goto-char (1- p)) | 4530 (goto-char (1- p)) |
4441 (setq not-found nil | 4531 (setq not-found nil |
4442 found-bad found))) | 4532 found-bad found))) |
4443 (not not-found))) | 4533 (not not-found))) |
4444 | 4534 |
4445 =06 | |
4446 ;;; Getting help | 4535 ;;; Getting help |
4447 (defvar cperl-have-help-regexp | 4536 (defvar cperl-have-help-regexp |
4448 ;;(concat "\\(" | 4537 ;;(concat "\\(" |
4449 (mapconcat | 4538 (mapconcat |
4450 'identity | 4539 'identity |