1 ;;; dcl-mode.el --- major mode for editing DCL command files
3 ;; Copyright (c) 1997 Free Software Foundation, Inc.
5 ;; Author: Odd Gripenstam <gripenstamol@decus.se>
6 ;; Maintainer: Odd Gripenstam <gripenstamol@decus.se>
7 ;; Keywords: DCL editing major-mode languages
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
28 ;; DCL mode is a package for editing DCL command files. It helps you
29 ;; indent lines, add leading `$' and trailing `-', move around in the
30 ;; code and insert lexical functions.
32 ;; Type `C-h m' when you are editing a .COM file to get more
33 ;; information about this mode.
35 ;; To use templates you will need a version of tempo.el that is at
36 ;; least later than the buggy 1.1.1, which was included with my versions of
37 ;; Emacs. I used version 1.2.4.
38 ;; The latest tempo.el distribution can be fetched from
39 ;; ftp.lysator.liu.se in the directory /pub/emacs.
40 ;; I recommend setting (setq tempo-interactive t). This will make
41 ;; tempo prompt you for values to put in the blank spots in the templates.
43 ;; There is limited support for imenu. The limitation is that you need
44 ;; a version of imenu.el that uses imenu-generic-expression. I found
45 ;; the version I use in Emacs 19.30. (It was *so* much easier to hook
46 ;; into that version than the one in 19.27...)
48 ;; Any feedback will be welcomed. If you write functions for
49 ;; dcl-calc-command-indent-function or dcl-calc-cont-indent-function,
50 ;; please send them to the maintainer.
53 ;; Ideas for improvement:
54 ;; * Change meaning of `left margin' when dcl-tab-always-indent is nil.
55 ;; Consider the following line (`_' is the cursor):
57 ;; Pressing tab with the cursor at the underline now inserts a tab.
58 ;; This should be part of the left margin and pressing tab should indent
60 ;; * Make M-LFD work properly with comments in all cases. Now it only
61 ;; works on comment-only lines. But what is "properly"? New rules for
62 ;; indenting comments?
63 ;; * Even smarter indentation of continuation lines.
64 ;; * A delete-indentation function (M-^) that joins continued lines,
65 ;; including lines with end line comments?
67 ;; * `indent list' commands: C-M-q, C-u TAB. What is a list in DCL? One
68 ;; complete command line? A block? A subroutine?
72 ;;; *** Customization *****************************************************
75 (defvar dcl-basic-offset 4
76 "*Number of columns to indent a block in DCL.
77 A block is the commands between THEN-ELSE-ENDIF and between the commands
78 dcl-block-begin-regexp and dcl-block-end-regexp.
80 The meaning of this variable may be changed if
81 dcl-calc-command-indent-function is set to a function.")
84 (defvar dcl-continuation-offset 6
85 "*Number of columns to indent a continuation line in DCL.
86 A continuation line is a line that follows a line ending with `-'.
88 The meaning of this variable may be changed if
89 dcl-calc-cont-indent-function is set to a function.")
92 (defvar dcl-margin-offset 8
93 "*Indentation for the first command line in DCL.
94 The first command line in a file or after a SUBROUTINE statement is indented
95 this much. Other command lines are indented the same number of columns as
96 the preceding command line.
97 A command line is a line that starts with `$'.")
100 (defvar dcl-margin-label-offset 2
101 "*Number of columns to indent a margin label in DCL.
102 A margin label is a label that doesn't begin or end a block, i.e. it
103 doesn't match dcl-block-begin-regexp or dcl-block-end-regexp.")
106 (defvar dcl-comment-line-regexp "^\\$!"
107 "*Regexp describing the start of a comment line in DCL.
108 Comment lines are not indented.")
111 (defvar dcl-block-begin-regexp "loop[0-9]*:"
112 "*Regexp describing a command that begins an indented block in DCL.
113 Set to nil to only indent at THEN-ELSE-ENDIF.")
116 (defvar dcl-block-end-regexp "endloop[0-9]*:"
117 "*Regexp describing a command that ends an indented block in DCL.
118 Set to nil to only indent at THEN-ELSE-ENDIF.")
121 (defvar dcl-calc-command-indent-function nil
122 "*Function to calculate indentation for a command line in DCL.
123 If this variable is non-nil it is called as a function:
125 \(func INDENT-TYPE CUR-INDENT EXTRA-INDENT LAST-POINT THIS-POINT)
127 The function must return the number of columns to indent the current line or
128 nil to get the default indentation.
130 INDENT-TYPE is a symbol indicating what kind of indentation should be done.
131 It can have the following values:
132 indent the lines indentation should be increased, e.g. after THEN.
133 outdent the lines indentation should be decreased, e.g a line with ENDIF.
134 first-line indentation for the first line in a buffer or SUBROUTINE.
135 CUR-INDENT is the indentation of the preceding command line.
136 EXTRA-INDENT is the default change in indentation for this line
137 \(a negative number for 'outdent).
138 LAST-POINT is the buffer position of the first significant word on the
139 previous line or nil if the current line is the first line.
140 THIS-POINT is the buffer position of the first significant word on the
143 If this variable is nil, the indentation is calculated as
144 CUR-INDENT + EXTRA-INDENT.
146 This package includes two functions suitable for this:
147 dcl-calc-command-indent-multiple
148 dcl-calc-command-indent-hang
152 (defvar dcl-calc-cont-indent-function 'dcl-calc-cont-indent-relative
153 "*Function to calculate indentation for a continuation line.
154 If this variable is non-nil it is called as a function:
156 \(func CUR-INDENT EXTRA-INDENT)
158 The function must return the number of columns to indent the current line or
159 nil to get the default indentation.
161 If this variable is nil, the indentation is calculated as
162 CUR-INDENT + EXTRA-INDENT.
164 This package includes one function suitable for this:
165 dcl-calc-cont-indent-relative
169 (defvar dcl-tab-always-indent t
170 "*Controls the operation of the TAB key in DCL mode.
171 If t, pressing TAB always indents the current line.
172 If nil, pressing TAB indents the current line if point is at the left margin.
173 Data lines (i.e. lines not part of a command line or continuation line) are
177 (defvar dcl-electric-characters t
178 "*Non-nil means reindent immediately when a label, ELSE or ENDIF is inserted.")
181 (defvar dcl-tempo-comma ", "
182 "*Text to insert when a comma is needed in a template, in DCL mode.")
184 (defvar dcl-tempo-left-paren "("
185 "*Text to insert when a left parenthesis is needed in a template in DCL.")
188 (defvar dcl-tempo-right-paren ")"
189 "*Text to insert when a right parenthesis is needed in a template in DCL.")
191 ; I couldn't decide what looked best, so I'll let you decide...
192 ; Remember, you can also customize this with imenu-submenu-name-format.
193 (defvar dcl-imenu-label-labels "Labels"
194 "*Imenu menu title for sub-listing with label names.")
195 (defvar dcl-imenu-label-goto "GOTO"
196 "*Imenu menu title for sub-listing with GOTO statements.")
197 (defvar dcl-imenu-label-gosub "GOSUB"
198 "*Imenu menu title for sub-listing with GOSUB statements.")
199 (defvar dcl-imenu-label-call "CALL"
200 "*Imenu menu title for sub-listing with CALL statements.")
202 (defvar dcl-imenu-generic-expression
204 ((nil "^\\$[ \t]*\\([A-Za-z0-9_\$]+\\):[ \t]+SUBROUTINE\\b" 1)
205 ((, dcl-imenu-label-labels)
206 "^\\$[ \t]*\\([A-Za-z0-9_\$]+\\):\\([ \t]\\|$\\)" 1)
207 ((, dcl-imenu-label-goto) "\\s-GOTO[ \t]+\\([A-Za-z0-9_\$]+\\)" 1)
208 ((, dcl-imenu-label-gosub) "\\s-GOSUB[ \t]+\\([A-Za-z0-9_\$]+\\)" 1)
209 ((, dcl-imenu-label-call) "\\s-CALL[ \t]+\\([A-Za-z0-9_\$]+\\)" 1)))
210 "*Default imenu generic expression for DCL.
212 The default includes SUBROUTINE labels in the main listing and
213 sub-listings for other labels, CALL, GOTO and GOSUB statements.
214 See `imenu-generic-expression' for details.")
217 (defvar dcl-mode-hook nil
218 "*Hook called by `dcl-mode'.")
221 ;;; *** Global variables ****************************************************
224 (defvar dcl-mode-syntax-table nil
225 "Syntax table used in DCL-buffers.")
226 (if dcl-mode-syntax-table
228 (setq dcl-mode-syntax-table (make-syntax-table))
229 (modify-syntax-entry ?! "<" dcl-mode-syntax-table) ; comment start
230 (modify-syntax-entry ?\n ">" dcl-mode-syntax-table) ; comment end
231 (modify-syntax-entry ?< "(>" dcl-mode-syntax-table) ; < and ...
232 (modify-syntax-entry ?> ")<" dcl-mode-syntax-table) ; > is a matching pair
236 (defvar dcl-mode-map ()
237 "Keymap used in DCL-mode buffers.")
240 (setq dcl-mode-map (make-sparse-keymap))
241 (define-key dcl-mode-map "\e\n" 'dcl-split-line)
242 (define-key dcl-mode-map "\e\t" 'tempo-complete-tag)
243 (define-key dcl-mode-map "\e^" 'dcl-delete-indentation)
244 (define-key dcl-mode-map "\em" 'dcl-back-to-indentation)
245 (define-key dcl-mode-map "\ee" 'dcl-forward-command)
246 (define-key dcl-mode-map "\ea" 'dcl-backward-command)
247 (define-key dcl-mode-map "\e\C-q" 'dcl-indent-command)
248 (define-key dcl-mode-map "\t" 'dcl-tab)
249 (define-key dcl-mode-map ":" 'dcl-electric-character)
250 (define-key dcl-mode-map "F" 'dcl-electric-character)
251 (define-key dcl-mode-map "f" 'dcl-electric-character)
252 (define-key dcl-mode-map "E" 'dcl-electric-character)
253 (define-key dcl-mode-map "e" 'dcl-electric-character)
254 (define-key dcl-mode-map "\C-c\C-o" 'dcl-set-option)
255 (define-key dcl-mode-map "\C-c\C-f" 'tempo-forward-mark)
256 (define-key dcl-mode-map "\C-c\C-b" 'tempo-backward-mark)
258 (define-key dcl-mode-map [menu-bar] (make-sparse-keymap))
259 (define-key dcl-mode-map [menu-bar dcl]
260 (cons "DCL" (make-sparse-keymap "DCL")))
262 ;; Define these in bottom-up order
263 (define-key dcl-mode-map [menu-bar dcl tempo-backward-mark]
264 '("Previous template mark" . tempo-backward-mark))
265 (define-key dcl-mode-map [menu-bar dcl tempo-forward-mark]
266 '("Next template mark" . tempo-forward-mark))
267 (define-key dcl-mode-map [menu-bar dcl tempo-complete-tag]
268 '("Complete template tag" . tempo-complete-tag))
269 (define-key dcl-mode-map [menu-bar dcl dcl-separator-tempo]
271 (define-key dcl-mode-map [menu-bar dcl dcl-save-all-options]
272 '("Save all options" . dcl-save-all-options))
273 (define-key dcl-mode-map [menu-bar dcl dcl-save-nondefault-options]
274 '("Save changed options" . dcl-save-nondefault-options))
275 (define-key dcl-mode-map [menu-bar dcl dcl-set-option]
276 '("Set option" . dcl-set-option))
277 (define-key dcl-mode-map [menu-bar dcl dcl-separator-option]
279 (define-key dcl-mode-map [menu-bar dcl dcl-delete-indentation]
280 '("Delete indentation" . dcl-delete-indentation))
281 (define-key dcl-mode-map [menu-bar dcl dcl-split-line]
282 '("Split line" . dcl-split-line))
283 (define-key dcl-mode-map [menu-bar dcl dcl-indent-command]
284 '("Indent command" . dcl-indent-command))
285 (define-key dcl-mode-map [menu-bar dcl dcl-tab]
286 '("Indent line/insert tab" . dcl-tab))
287 (define-key dcl-mode-map [menu-bar dcl dcl-back-to-indentation]
288 '("Back to indentation" . dcl-back-to-indentation))
289 (define-key dcl-mode-map [menu-bar dcl dcl-forward-command]
290 '("End of statement" . dcl-forward-command))
291 (define-key dcl-mode-map [menu-bar dcl dcl-backward-command]
292 '("Beginning of statement" . dcl-backward-command))
293 ;; imenu is only supported for versions with imenu-generic-expression
294 (if (boundp 'imenu-generic-expression)
296 (define-key dcl-mode-map [menu-bar dcl dcl-separator-movement]
298 (define-key dcl-mode-map [menu-bar dcl imenu]
299 '("Buffer index menu" . imenu))))
304 "\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*"
305 "Regular expression describing white space in a DCL command line.
306 White space is any number of continued lines with only space,tab,endcomment
307 followed by space or tab.")
311 "[a-zA-Z0-9_\$]*:\\([ \t!]\\|$\\)"
312 "Regular expression describing a label.
313 A label is a name followed by a colon followed by white-space or end-of-line.")
317 "^\\$\\(.*-[ \t]*\\(!.*\\)*\n\\)*[^!\"\n]*\\(\".*\\(\"\".*\\)*\"\\)*[^!\"\n]*"
318 "Regular expression describing a DCL command line up to a trailing comment.
319 A line starting with $, optionally followed by continuation lines,
320 followed by the end of the command line.
321 A continuation line is any characters followed by `-',
322 optionally followed by a comment, followed by a newline.")
325 (defvar dcl-command-regexp
326 "^\\$\\(.*-[ \t]*\\(!.*\\)*\n\\)*.*\\(\".*\\(\"\".*\\)*\"\\)*"
327 "Regular expression describing a DCL command line.
328 A line starting with $, optionally followed by continuation lines,
329 followed by the end of the command line.
330 A continuation line is any characters followed by `-',
331 optionally followed by a comment, followed by a newline.")
334 (defvar dcl-electric-reindent-regexps
335 (list "endif" "else" dcl-label-r)
336 "*Regexps that can trigger an electric reindent.
337 A list of regexps that will trigger a reindent if the last letter
338 is defined as dcl-electric-character.
340 E.g.: if this list contains `endif', the key `f' is defined as
341 dcl-electric-character and the you have just typed the `f' in
342 `endif', the line will be reindented.")
345 (defvar dcl-option-alist
346 '((dcl-basic-offset dcl-option-value-basic)
347 (dcl-continuation-offset curval)
348 (dcl-margin-offset dcl-option-value-margin-offset)
349 (dcl-margin-label-offset dcl-option-value-offset)
350 (dcl-comment-line-regexp dcl-option-value-comment-line)
351 (dcl-block-begin-regexp curval)
352 (dcl-block-end-regexp curval)
353 (dcl-tab-always-indent toggle)
354 (dcl-electric-characters toggle)
355 (dcl-electric-reindent-regexps curval)
356 (dcl-tempo-comma curval)
357 (dcl-tempo-left-paren curval)
358 (dcl-tempo-right-paren curval)
359 (dcl-calc-command-indent-function curval)
360 (dcl-calc-cont-indent-function curval)
361 (comment-start curval)
362 (comment-start-skip curval)
364 "Options and default values for dcl-set-option.
366 An alist with option variables and functions or keywords to get a
367 default value for the option.
370 curval the current value
371 toggle the opposite of the current value (for t/nil)")
374 (defvar dcl-option-history
375 (mapcar (lambda (option-assoc)
376 (format "%s" (car option-assoc)))
378 "The history list for dcl-set-option.
379 Preloaded with all known option names from dcl-option-alist")
382 ;; Must be defined after dcl-cmd-r
383 ;; This version is more correct but much slower than the one
384 ;; above. This version won't find GOTOs in comments or text strings.
385 ;(defvar dcl-imenu-generic-expression
387 ; ((nil "^\\$[ \t]*\\([A-Za-z0-9_\$]+\\):[ \t]+SUBROUTINE\\b" 1)
388 ; ("Labels" "^\\$[ \t]*\\([A-Za-z0-9_\$]+\\):\\([ \t]\\|$\\)" 1)
389 ; ("GOTO" (, (concat dcl-cmd-r "GOTO[ \t]+\\([A-Za-z0-9_\$]+\\)")) 5)
390 ; ("GOSUB" (, (concat dcl-cmd-r
391 ; "GOSUB[ \t]+\\([A-Za-z0-9_\$]+\\)")) 5)
392 ; ("CALL" (, (concat dcl-cmd-r "CALL[ \t]+\\([A-Za-z0-9_\$]+\\)")) 5)))
393 ; "*Default imenu generic expression for DCL.
395 ;The default includes SUBROUTINE labels in the main listing and
396 ;sub-listings for other labels, CALL, GOTO and GOSUB statements.
397 ;See `imenu-generic-expression' in a recent (e.g. Emacs 19.30) imenu.el
401 ;;; *** Mode initialization *************************************************
406 "Major mode for editing DCL-files.
408 This mode indents command lines in blocks. (A block is commands between
409 THEN-ELSE-ENDIF and between lines matching dcl-block-begin-regexp and
410 dcl-block-end-regexp.)
412 Labels are indented to a fixed position unless they begin or end a block.
413 Whole-line comments (matching dcl-comment-line-regexp) are not indented.
414 Data lines are not indented.
419 Commands not usually bound to keys:
421 \\[dcl-save-nondefault-options]\t\tSave changed options
422 \\[dcl-save-all-options]\t\tSave all options
423 \\[dcl-save-option]\t\t\tSave any option
424 \\[dcl-save-mode]\t\t\tSave buffer mode
426 Variables controlling indentation style and extra features:
429 Extra indentation within blocks.
431 dcl-continuation-offset
432 Extra indentation for continued lines.
435 Indentation for the first command line in a file or SUBROUTINE.
437 dcl-margin-label-offset
438 Indentation for a label.
440 dcl-comment-line-regexp
441 Lines matching this regexp will not be indented.
443 dcl-block-begin-regexp
445 Regexps that match command lines that begin and end, respectively,
446 a block of commmand lines that will be given extra indentation.
447 Command lines between THEN-ELSE-ENDIF are always indented; these variables
448 make it possible to define other places to indent.
449 Set to nil to disable this feature.
451 dcl-calc-command-indent-function
452 Can be set to a function that customizes indentation for command lines.
453 Two such functions are included in the package:
454 dcl-calc-command-indent-multiple
455 dcl-calc-command-indent-hang
457 dcl-calc-cont-indent-function
458 Can be set to a function that customizes indentation for continued lines.
459 One such function is included in the package:
460 dcl-calc-cont-indent-relative (set by default)
462 dcl-tab-always-indent
463 If t, pressing TAB always indents the current line.
464 If nil, pressing TAB indents the current line if point is at the left
467 dcl-electric-characters
468 Non-nil causes lines to be indented at once when a label, ELSE or ENDIF is
471 dcl-electric-reindent-regexps
472 Use this variable and function dcl-electric-character to customize
473 which words trigger electric indentation.
477 dcl-tempo-right-paren
478 These variables control the look of expanded templates.
480 dcl-imenu-generic-expression
481 Default value for imenu-generic-expression. The default includes
482 SUBROUTINE labels in the main listing and sub-listings for
483 other labels, CALL, GOTO and GOSUB statements.
485 dcl-imenu-label-labels
487 dcl-imenu-label-gosub
489 Change the text that is used as sub-listing labels in imenu.
491 Loading this package calls the value of the variable
492 `dcl-mode-load-hook' with no args, if that value is non-nil.
493 Turning on DCL mode calls the value of the variable `dcl-mode-hook'
494 with no args, if that value is non-nil.
497 The following example uses the default values for all variables:
499 $! This is a comment line that is not indented (it matches
500 $! dcl-comment-line-regexp)
501 $! Next follows the first command line. It is indented dcl-margin-offset.
503 $ ! Other comments are indented like command lines.
504 $ ! A margin label indented dcl-margin-label-offset:
508 $ ! Lines between THEN-ELSE and ELSE-ENDIF are
509 $ ! indented dcl-basic-offset
510 $ loop1: ! This matches dcl-block-begin-regexp...
511 $ ! ...so this line is indented dcl-basic-offset
512 $ text = \"This \" + - ! is a continued line
513 \"lined up with the command line\"
515 Data lines are not indented at all.
516 $ endloop1: ! This matches dcl-block-end-regexp
521 (kill-all-local-variables)
522 (set-syntax-table dcl-mode-syntax-table)
524 (make-local-variable 'indent-line-function)
525 (setq indent-line-function 'dcl-indent-line)
527 (make-local-variable 'comment-start)
528 (setq comment-start "!")
530 (make-local-variable 'comment-end)
531 (setq comment-end "")
533 (make-local-variable 'comment-multi-line)
534 (setq comment-multi-line nil)
536 ;; This used to be "^\\$[ \t]*![ \t]*" which looks more correct.
537 ;; The drawback was that you couldn't make empty comment lines by pressing
538 ;; C-M-j repeatedly - only the first line became a comment line.
539 ;; This version has the drawback that the "$" can be anywhere in the line,
540 ;; and something inappropriate might be interpreted as a comment.
541 (make-local-variable 'comment-start-skip)
542 (setq comment-start-skip "\\$[ \t]*![ \t]*")
544 (if (boundp 'imenu-generic-expression)
545 (setq imenu-generic-expression dcl-imenu-generic-expression))
546 (setq imenu-create-index-function 'dcl-imenu-create-index-function)
548 (make-local-variable 'dcl-comment-line-regexp)
549 (make-local-variable 'dcl-block-begin-regexp)
550 (make-local-variable 'dcl-block-end-regexp)
551 (make-local-variable 'dcl-basic-offset)
552 (make-local-variable 'dcl-continuation-offset)
553 (make-local-variable 'dcl-margin-label-offset)
554 (make-local-variable 'dcl-margin-offset)
555 (make-local-variable 'dcl-tab-always-indent)
556 (make-local-variable 'dcl-electric-characters)
557 (make-local-variable 'dcl-calc-command-indent-function)
558 (make-local-variable 'dcl-calc-cont-indent-function)
559 (make-local-variable 'dcl-electric-reindent-regexps)
561 (setq major-mode 'dcl-mode)
562 (setq mode-name "DCL")
563 (use-local-map dcl-mode-map)
564 (tempo-use-tag-list 'dcl-tempo-tags)
565 (run-hooks 'dcl-mode-hook))
568 ;;; *** Movement commands ***************************************************
571 ;;;-------------------------------------------------------------------------
572 (defun dcl-beginning-of-statement ()
573 "Go to the beginning of the preceding or current command line."
575 (re-search-backward dcl-command-regexp nil t))
578 ;;;-------------------------------------------------------------------------
579 (defun dcl-end-of-statement ()
580 "Go to the end of the next or current command line."
582 (if (or (dcl-end-of-command-p)
583 (dcl-beginning-of-command-p)
584 (not (dcl-command-p)))
586 (dcl-beginning-of-statement))
587 (re-search-forward dcl-command-regexp nil t))
590 ;;;-------------------------------------------------------------------------
591 (defun dcl-beginning-of-command ()
592 "Move point to beginning of current command."
594 (let ((type (dcl-get-line-type)))
595 (if (and (eq type '$)
597 () ; already in the correct position
598 (dcl-beginning-of-statement))))
601 ;;;-------------------------------------------------------------------------
602 (defun dcl-end-of-command ()
603 "Move point to end of current command or next command if not on a command."
605 (let ((type (dcl-get-line-type))
610 (dcl-beginning-of-command)
611 (dcl-end-of-statement))
612 (dcl-end-of-statement))))
615 ;;;-------------------------------------------------------------------------
616 (defun dcl-backward-command (&optional incl-comment-commands)
617 "Move backward to a command.
618 Move point to the preceding command line that is not a comment line,
619 a command line with only a comment, only contains a `$' or only
622 Returns point of the found command line or nil if not able to move."
624 (let ((start (point))
627 ;; Find first non-empty command line
629 ;; back up one statement and look at the command
630 (if (dcl-beginning-of-statement)
632 ((and dcl-block-begin-regexp ; might be nil
633 (looking-at (concat "^\\$" dcl-ws-r
634 dcl-block-begin-regexp)))
635 (setq done t retval (point)))
636 ((and dcl-block-end-regexp ; might be nil
637 (looking-at (concat "^\\$" dcl-ws-r
638 dcl-block-end-regexp)))
639 (setq done t retval (point)))
640 ((looking-at dcl-comment-line-regexp)
641 t) ; comment line, one more loop
642 ((and (not incl-comment-commands)
643 (looking-at "\\$[ \t]*!"))
644 t) ; comment only command, loop...
645 ((looking-at "^\\$[ \t]*$")
646 t) ; empty line, one more loop
648 (concat "^\\$" dcl-ws-r dcl-label-r dcl-ws-r "$")))
649 (setq done t) ; not a label-only line, exit the loop
650 (setq retval (point))))
651 ;; We couldn't go further back, and we haven't found a command yet.
652 ;; Return to the start positionn
659 ;;;-------------------------------------------------------------------------
660 (defun dcl-forward-command (&optional incl-comment-commands)
661 "Move forward to a command.
662 Move point to the end of the next command line that is not a comment line,
663 a command line with only a comment, only contains a `$' or only
666 Returns point of the found command line or nil if not able to move."
668 (let ((start (point))
671 ;; Find first non-empty command line
673 ;; go forward one statement and look at the command
674 (if (dcl-end-of-statement)
676 (dcl-beginning-of-statement)
678 ((and dcl-block-begin-regexp ; might be nil
679 (looking-at (concat "^\\$" dcl-ws-r
680 dcl-block-begin-regexp)))
682 (setq retval (point)))
683 ((and dcl-block-end-regexp ; might be nil
684 (looking-at (concat "^\\$" dcl-ws-r
685 dcl-block-end-regexp)))
687 (setq retval (point)))
688 ((looking-at dcl-comment-line-regexp)
689 t) ; comment line, one more loop
690 ((and (not incl-comment-commands)
691 (looking-at "\\$[ \t]*!"))
692 t) ; comment only command, loop...
693 ((looking-at "^\\$[ \t]*$")
694 t) ; empty line, one more loop
696 (concat "^\\$" dcl-ws-r dcl-label-r dcl-ws-r "$")))
697 (setq done t) ; not a label-only line, exit the loop
698 (setq retval (point)))))
699 ;; We couldn't go further back, and we haven't found a command yet.
700 ;; Return to the start positionn
707 ;;;-------------------------------------------------------------------------
708 (defun dcl-back-to-indentation ()
709 "Move point to the first non-whitespace character on this line.
710 Leading $ and labels counts as whitespace in this case.
711 If this is a comment line then move to the first non-whitespace character
714 Typing \\[dcl-back-to-indentation] several times in a row will move point to other
715 `interesting' points closer to the left margin, and then back to the
716 rightmost point again.
718 E.g. on the following line, point would go to the positions indicated
719 by the numbers in order 1-2-3-1-... :
724 (if (eq last-command 'dcl-back-to-indentation)
725 (dcl-back-to-indentation-1 (point))
726 (dcl-back-to-indentation-1)))
727 (defun dcl-back-to-indentation-1 (&optional limit)
728 "Helper function for dcl-back-to-indentation"
730 ;; "Indentation points" that we will travel to
743 (let* ((default-limit (save-excursion (end-of-line) (1+ (point))))
744 (limit (or limit default-limit))
745 (last-good-point (point))
748 (back-to-indentation)
750 ;; If we already were at the outermost indentation point then we
751 ;; start searching for the innermost point again.
752 (if (= (point) opoint)
753 (setq limit default-limit))
755 (if (< (point) limit)
756 (setq last-good-point (point)))
759 ;; Special treatment for comment lines. We are trying to allow
760 ;; things like "$ !*" as comment lines.
761 ((looking-at dcl-comment-line-regexp)
762 (re-search-forward (concat dcl-comment-line-regexp "[ \t]*") limit t)
763 (if (< (point) limit)
764 (setq last-good-point (point))))
766 ;; Normal command line
767 ((looking-at "^\\$[ \t]*")
768 ;; Move over leading "$" and blanks
769 (re-search-forward "^\\$[ \t]*" limit t)
770 (if (< (point) limit)
771 (setq last-good-point (point)))
773 ;; Move over a label (if it isn't a block begin/end)
774 ;; We must treat block begin/end labels as commands because
775 ;; dcl-set-option relies on it.
776 (if (and (looking-at dcl-label-r)
777 (not (or (and dcl-block-begin-regexp
778 (looking-at dcl-block-begin-regexp))
779 (and dcl-block-end-regexp
780 (looking-at dcl-block-end-regexp)))))
781 (re-search-forward (concat dcl-label-r "[ \t]*") limit t))
782 (if (< (point) limit)
783 (setq last-good-point (point)))
785 ;; Move over the beginning of a comment
786 (if (looking-at "![ \t]*")
787 (re-search-forward "![ \t]*" limit t))
788 (if (< (point) limit)
789 (setq last-good-point (point)))))
790 (goto-char last-good-point)))
793 ;;; *** Support for indentation *********************************************
796 (defun dcl-get-line-type ()
797 "Determine the type of the current line.
798 Returns one of the following symbols:
799 $ for a complete command line or the beginning of a command line.
800 - for a continuation line
801 $! for a comment line
803 empty-data for an empty line following a data line
804 empty-$ for an empty line following a command line"
806 ;; Check if it's a comment line.
807 ;; A comment line starts with $!
810 (if (looking-at dcl-comment-line-regexp)
812 ;; Check if it's a command line.
813 ;; A command line starts with $
816 (if (looking-at "^\\$")
818 ;; Check if it's a continuation line
821 ;; If we're at the beginning of the buffer it can't be a continuation
824 (let ((opoint (point)))
825 (dcl-beginning-of-statement)
826 (re-search-forward dcl-command-regexp opoint t)
827 (if (>= (point) opoint)
829 ;; Empty lines might be different things
831 (if (and (bolp) (eolp))
835 (let ((type (dcl-get-line-type)))
837 ((or (equal type '$) (equal type '$!) (equal type '-))
841 ;; Anything else must be a data line
846 ;;;-------------------------------------------------------------------------
847 (defun dcl-indentation-point ()
848 "Return point of first non-`whitespace' on this line."
850 (dcl-back-to-indentation)
854 ;;;---------------------------------------------------------------------------
855 (defun dcl-show-line-type ()
856 "Test dcl-get-line-type."
858 (let ((type (dcl-get-line-type)))
861 (message "command line"))
865 (message "comment line"))
867 (message "continuation line"))
870 ((equal type 'empty-data)
871 (message "empty-data"))
872 ((equal type 'empty-$)
879 ;;; *** Perform indentation *************************************************
882 ;;;---------------------------------------------------------------------------
883 (defun dcl-calc-command-indent-multiple
884 (indent-type cur-indent extra-indent last-point this-point)
885 "Indent lines to a multiple of dcl-basic-offset.
887 Set dcl-calc-command-indent-function to this function to customize
888 indentation of command lines.
890 Command lines that need to be indented beyond the left margin are
891 always indented to a column that is a multiple of dcl-basic-offset, as
892 if tab stops were set at 4, 8, 12, etc.
894 This supports a formatting style like this (dcl-margin offset = 2,
895 dcl-basic-offset = 4):
903 ;; calculate indentation if it's an interesting indent-type,
904 ;; otherwise return nil to get the default indentation
907 ((equal indent-type 'indent)
908 (setq indent (- cur-indent (% cur-indent dcl-basic-offset)))
909 (setq indent (+ indent extra-indent))))))
912 ;;;---------------------------------------------------------------------------
913 ;; Some people actually writes likes this. To each his own...
914 (defun dcl-calc-command-indent-hang
915 (indent-type cur-indent extra-indent last-point this-point)
916 "Indent lines as default, but indent THEN, ELSE and ENDIF extra.
918 Set dcl-calc-command-indent-function to this function to customize
919 indentation of command lines.
921 This function supports a formatting style like this:
929 If you use this function you will probably want to add \"then\" to
930 dcl-electric-reindent-regexps and define the key \"n\" as
931 dcl-electric-character.
933 (let ((case-fold-search t))
936 ;; No indentation, this word is `then': +2
937 ;; last word was endif: -2
940 (goto-char this-point)
941 (if (looking-at "\\bthen\\b")
942 (+ cur-indent extra-indent 2)))
944 (goto-char last-point)
945 (if (looking-at "\\bendif\\b")
946 (- (+ cur-indent extra-indent) 2)))))
947 ;; Indentation, last word was `then' or `else': -2
948 ((equal indent-type 'indent)
949 (goto-char last-point)
951 ((looking-at "\\bthen\\b")
952 (- (+ cur-indent extra-indent) 2))
953 ((looking-at "\\belse\\b")
954 (- (+ cur-indent extra-indent) 2))))
955 ;; Outdent, this word is `endif' or `else': + 2
956 ((equal indent-type 'outdent)
957 (goto-char this-point)
959 ((looking-at "\\bendif\\b")
960 (+ cur-indent extra-indent 2))
961 ((looking-at "\\belse\\b")
962 (+ cur-indent extra-indent 2))))))))
965 ;;;---------------------------------------------------------------------------
966 (defun dcl-calc-command-indent ()
967 "Calculate how much the current line shall be indented.
968 The line is known to be a command line.
970 Find the indentation of the preceding line and analyze its contents to
971 see if the current lines should be indented.
972 Analyze the current line to see if it should be `outdented'.
974 Calculate the indentation of the current line, either with the default
975 method or by calling dcl-calc-command-indent-function if it is
978 If the current line should be outdented, calculate its indentation,
979 either with the default method or by calling
980 dcl-calc-command-indent-function if it is non-nil.
983 Rules for default indentation:
985 If it is the first line in the buffer, indent dcl-margin-offset.
987 Go to the previous command line with a command on it.
988 Find out how much it is indented (cur-indent).
989 Look at the first word on the line to see if the indentation should be
990 adjusted. Skip margin-label, continuations and comments while looking for
991 the first word. Save this buffer position as `last-point'.
992 If the first word after a label is SUBROUTINE, set extra-indent to
995 First word extra-indent
996 THEN +dcl-basic-offset
997 ELSE +dcl-basic-offset
998 block-begin +dcl-basic-offset
1000 Then return to the current line and look at the first word to see if the
1001 indentation should be adjusted again. Save this buffer position as
1004 First word extra-indent
1005 ELSE -dcl-basic-offset
1006 ENDIF -dcl-basic-offset
1007 block-end -dcl-basic-offset
1010 If dcl-calc-command-indent-function is nil or returns nil set
1011 cur-indent to cur-indent+extra-indent.
1013 If an extra adjustment is necessary and if
1014 dcl-calc-command-indent-function is nil or returns nil set cur-indent
1015 to cur-indent+extra-indent.
1017 See also documentation for dcl-calc-command-indent-function.
1018 The indent-type classification could probably be expanded upon.
1023 (let ((is-block nil)
1024 (case-fold-search t)
1027 indent-type last-point this-point extra-indent2 cur-indent2
1029 (if (bobp) ; first line in buffer
1030 (setq cur-indent 0 extra-indent dcl-margin-offset
1031 indent-type 'first-line
1032 this-point (dcl-indentation-point))
1035 ;; Find first non-empty command line
1037 ;; back up one statement and look at the command
1038 (if (dcl-beginning-of-statement)
1040 ((and dcl-block-begin-regexp ; might be nil
1041 (looking-at (concat "^\\$" dcl-ws-r
1042 dcl-block-begin-regexp)))
1043 (setq done t) (setq is-block t))
1044 ((and dcl-block-end-regexp ; might be nil
1045 (looking-at (concat "^\\$" dcl-ws-r
1046 dcl-block-end-regexp)))
1047 (setq done t) (setq is-block t))
1048 ((looking-at dcl-comment-line-regexp)
1049 t) ; comment line, one more loop
1050 ((looking-at "^\\$[ \t]*$")
1051 t) ; empty line, one more loop
1053 (concat "^\\$" dcl-ws-r dcl-label-r dcl-ws-r "$")))
1054 (setq done t))) ; not a label-only line, exit the loop
1055 ;; We couldn't go further back, so this must have been the
1057 (setq cur-indent dcl-margin-offset
1058 last-point (dcl-indentation-point))
1060 ;; Examine the line to get current indentation and possibly a
1061 ;; reason to indent.
1064 ((looking-at (concat "^\\$[ \t]*" dcl-label-r dcl-ws-r
1065 "\\(subroutine\\b\\)"))
1066 (setq cur-indent dcl-margin-offset
1067 last-point (1+ (match-beginning 1))))
1069 ;; Find out how much this line is indented.
1070 ;; Look at comment, continuation character, command but not label
1071 ;; unless it's a block.
1073 (re-search-forward "^\\$[ \t]*")
1074 (re-search-forward (concat "^\\$[ \t]*\\(" dcl-label-r
1076 (setq cur-indent (current-column))
1077 ;; Look for a reason to indent: Find first word on this line
1078 (re-search-forward dcl-ws-r)
1079 (setq last-point (point))
1081 ((looking-at "\\bthen\\b")
1082 (setq extra-indent dcl-basic-offset indent-type 'indent))
1083 ((looking-at "\\belse\\b")
1084 (setq extra-indent dcl-basic-offset indent-type 'indent))
1085 ((and dcl-block-begin-regexp ; might be nil
1086 (looking-at dcl-block-begin-regexp))
1087 (setq extra-indent dcl-basic-offset indent-type 'indent))
1089 (setq extra-indent2 0)
1090 ;; We're back at the beginning of the original line.
1091 ;; Look for a reason to outdent: Find first word on this line
1092 (re-search-forward (concat "^\\$" dcl-ws-r))
1093 (setq this-point (dcl-indentation-point))
1095 ((looking-at "\\belse\\b")
1096 (setq extra-indent2 (- dcl-basic-offset) indent-type2 'outdent))
1097 ((looking-at "\\bendif\\b")
1098 (setq extra-indent2 (- dcl-basic-offset) indent-type2 'outdent))
1099 ((and dcl-block-end-regexp ; might be nil
1100 (looking-at dcl-block-end-regexp))
1101 (setq extra-indent2 (- dcl-basic-offset) indent-type2 'outdent))
1102 ((looking-at (concat dcl-label-r dcl-ws-r "\\(subroutine\\b\\)"))
1103 (setq cur-indent2 0 extra-indent2 dcl-margin-offset
1104 indent-type2 'first-line
1105 this-point (1+ (match-beginning 1)))))
1108 (or (and dcl-calc-command-indent-function
1109 (funcall dcl-calc-command-indent-function
1110 indent-type cur-indent extra-indent
1111 last-point this-point))
1112 (+ cur-indent extra-indent)))
1113 ;; Calculate outdent
1116 (or cur-indent2 (setq cur-indent2 cur-indent))
1118 (or (and dcl-calc-command-indent-function
1119 (funcall dcl-calc-command-indent-function
1120 indent-type2 cur-indent2 extra-indent2
1121 last-point this-point))
1122 (+ cur-indent2 extra-indent2)))))
1127 ;;;---------------------------------------------------------------------------
1128 (defun dcl-calc-cont-indent-relative (cur-indent extra-indent)
1129 "Indent continuation lines to align with words on previous line.
1131 Indent continuation lines to a position relative to preceding
1132 significant command line elements.
1134 Set `dcl-calc-cont-indent-function' to this function to customize
1135 indentation of continuation lines.
1137 Indented lines will align with either:
1139 * the second word on the command line
1142 * the word after an asignment
1145 * the third word if it's a qualifier
1146 $ set terminal/width=80 -
1148 * the innermost nonclosed parenthesis
1149 $ if ((a.eq.b .and. -
1150 d.eq.c .or. f$function(xxxx, -
1153 (let ((case-fold-search t)
1156 (dcl-beginning-of-statement)
1157 (let ((end (save-excursion (forward-line 1) (point))))
1158 ;; Move over blanks and label
1159 (if (re-search-forward (concat "^\\$[ \t]*\\(" dcl-label-r
1160 "\\)*[ \t]*") end t)
1162 ;; Move over the first word (might be `@filespec')
1163 (if (> (skip-chars-forward "@:[]<>$\\-a-zA-Z0-9_.;" end) 0)
1164 (let (was-assignment)
1165 (skip-chars-forward " \t" end)
1166 ;; skip over assignment if there is one
1167 (if (looking-at ":?==?")
1169 (setq was-assignment t)
1170 (skip-chars-forward " \t:=" end)))
1171 ;; This could be the position to indent to
1172 (setq indent (current-column))
1174 ;; Move to the next word unless we have seen an
1175 ;; assignment. If it starts with `/' it's a
1176 ;; qualifier and we will indent to that position
1177 (if (and (not was-assignment)
1178 (> (skip-chars-forward "a-zA-Z0-9_" end) 0))
1180 (skip-chars-forward " \t" end)
1181 (if (= (char-after (point)) ?/)
1182 (setq indent (current-column)))))
1184 ;; Now check if there are any parenthesis to adjust to.
1185 ;; If there is, we will indent to the position after the last non-closed
1186 ;; opening parenthesis.
1189 (let* ((start (save-excursion (dcl-beginning-of-statement) (point)))
1190 (parse-sexp-ignore-comments t) ; for parse-partial
1191 (par-pos (nth 1 (parse-partial-sexp start (point)))))
1192 (if par-pos ; is nil if no parenthesis was found
1193 (setq indent (save-excursion
1195 (1+ (current-column)))))))
1199 ;;;---------------------------------------------------------------------------
1200 (defun dcl-calc-continuation-indent ()
1201 "Calculate how much the current line shall be indented.
1202 The line is known to be a continuation line.
1204 Go to the previous command line.
1205 Find out how much it is indented."
1206 ;; This was copied without much thought from dcl-calc-command-indent, so
1207 ;; it's a bit clumsy.
1212 ;; Huh? a continuation line first in the buffer??
1214 (let ((is-block nil)
1217 ;; Find first non-empty command line
1220 (if (dcl-beginning-of-statement)
1222 ((and dcl-block-begin-regexp
1223 (looking-at (concat "^\\$" dcl-ws-r
1224 dcl-block-begin-regexp)))
1225 (setq done t) (setq is-block t))
1226 ((and dcl-block-end-regexp
1227 (looking-at (concat "^\\$" dcl-ws-r
1228 dcl-block-end-regexp)))
1229 (setq done t) (setq is-block t))
1230 ((looking-at dcl-comment-line-regexp)
1232 ((looking-at "^\\$[ \t]*$")
1235 (concat "^\\$" dcl-ws-r dcl-label-r dcl-ws-r "$")))
1237 ;; This must have been the first line.
1238 (setq indent dcl-margin-offset)
1242 ;; Find out how much this line is indented.
1243 ;; Look at comment, continuation character, command but not label
1244 ;; unless it's a block.
1246 (re-search-forward "^\\$[ \t]*")
1247 (re-search-forward (concat "^\\$[ \t]*\\(" dcl-label-r
1249 (setq indent (current-column))
1251 ;; We're back at the beginning of the original line.
1252 (or (and dcl-calc-cont-indent-function
1253 (funcall dcl-calc-cont-indent-function indent
1254 dcl-continuation-offset))
1255 (+ indent dcl-continuation-offset))
1259 ;;;---------------------------------------------------------------------------
1260 (defun dcl-indent-command-line ()
1261 "Indent a line known to be a command line."
1262 (let ((indent (dcl-calc-command-indent))
1263 (pos (- (point-max) (point))))
1266 (re-search-forward "^\\$[ \t]*")
1267 ;; Indent any margin-label if the offset is set
1268 ;; (Don't look at block labels)
1269 (if (and dcl-margin-label-offset
1270 (looking-at dcl-label-r)
1271 (not (and dcl-block-begin-regexp
1272 (looking-at dcl-block-begin-regexp)))
1273 (not (and dcl-block-end-regexp
1274 (looking-at dcl-block-end-regexp))))
1276 (dcl-indent-to dcl-margin-label-offset)
1277 (re-search-forward dcl-label-r)))
1278 (dcl-indent-to indent 1)
1281 (if (> (- (point-max) pos) (point))
1282 (goto-char (- (point-max) pos)))
1286 ;;;-------------------------------------------------------------------------
1287 (defun dcl-indent-continuation-line ()
1288 "Indent a line known to be a continuation line.
1290 Notice that no special treatment is made for labels. They have to be
1291 on the first part on a command line to be taken into consideration."
1292 (let ((indent (dcl-calc-continuation-indent)))
1295 (re-search-forward "^[ \t]*")
1296 (dcl-indent-to indent))
1297 (skip-chars-forward " \t")))
1300 ;;;---------------------------------------------------------------------------
1301 (defun dcl-delete-chars (chars)
1302 "Delete all characters in the set CHARS around point."
1303 (skip-chars-backward chars)
1304 (delete-region (point) (progn (skip-chars-forward chars) (point))))
1307 ;;;---------------------------------------------------------------------------
1308 (defun dcl-indent-line ()
1309 "The DCL version of `indent-line-function'.
1310 Adjusts indentation on the current line. Data lines are not indented."
1311 (let ((type (dcl-get-line-type)))
1314 (dcl-indent-command-line))
1316 (message "Unknown line type!"))
1318 ((equal type 'data))
1319 ((equal type 'empty-data))
1321 (dcl-indent-continuation-line))
1322 ((equal type 'empty-$)
1324 (dcl-indent-command-line))
1326 (message "dcl-indent-line: unknown type"))
1330 ;;;-------------------------------------------------------------------------
1331 (defun dcl-indent-command ()
1332 "Indents the complete command line that point is on.
1333 This includes continuation lines."
1335 (let ((type (dcl-get-line-type)))
1336 (if (or (equal type '$)
1338 (equal type 'empty-$))
1340 (indent-region (progn (or (looking-at "^\\$")
1341 (dcl-beginning-of-statement))
1343 (progn (dcl-end-of-statement) (point))
1347 ;;;-------------------------------------------------------------------------
1349 "Insert tab in data lines or indent code.
1350 If `dcl-tab-always-indent' is t, code lines are always indented.
1351 If nil, indent the current line only if point is at the left margin or in
1352 the lines indentation; otherwise insert a tab."
1354 (let ((type (dcl-get-line-type))
1355 (start-point (point)))
1357 ;; Data line : always insert tab
1358 ((or (equal type 'data) (equal type 'empty-data))
1360 ;; Indent only at start of line
1361 ((not dcl-tab-always-indent) ; nil
1362 (let ((search-end-point
1365 (re-search-forward "^\\$?[ \t]*" start-point t))))
1367 (and search-end-point
1368 (>= search-end-point start-point)))
1370 (tab-to-tab-stop))))
1372 ((eq dcl-tab-always-indent t) ; t
1377 ;;;-------------------------------------------------------------------------
1378 (defun dcl-electric-character (arg)
1379 "Inserts a character and indents if necessary.
1380 Insert a character if the user gave a numeric argument or the flag
1381 `dcl-electric-characters' is not set. If an argument was given,
1382 insert that many characters.
1384 The line is only reindented if the word just typed matches any of the
1385 regexps in `dcl-electric-reindent-regexps'."
1387 (if (or arg (not dcl-electric-characters))
1389 (self-insert-command (prefix-numeric-value arg))
1390 (self-insert-command 1))
1391 ;; Insert the character and indent
1392 (self-insert-command 1)
1393 (let ((case-fold-search t))
1394 ;; There must be a better way than (memq t ...).
1395 ;; (apply 'or ...) didn't work
1396 (if (memq t (mapcar 'dcl-was-looking-at dcl-electric-reindent-regexps))
1397 (dcl-indent-line)))))
1400 ;;;-------------------------------------------------------------------------
1401 (defun dcl-indent-to (col &optional minimum)
1402 "Like indent-to, but only indents if indentation would change"
1404 (let (cur-indent collapsed indent)
1406 (skip-chars-forward " \t")
1407 (setq cur-indent (current-column))
1408 (skip-chars-backward " \t")
1409 (setq collapsed (current-column)))
1410 (setq indent (max col (+ collapsed (or minimum 0))))
1411 (if (/= indent cur-indent)
1413 (dcl-delete-chars " \t")
1414 (indent-to col minimum)))))
1417 ;;;-------------------------------------------------------------------------
1418 (defun dcl-split-line ()
1419 "Break line at point and insert text to keep the syntax valid.
1421 Inserts continuation marks and splits character strings."
1422 ;; Still don't know what to do with comments at the end of a command line.
1425 (type (dcl-get-line-type)))
1427 ((or (equal type '$) (equal type '-))
1428 (let ((info (parse-partial-sexp
1429 (save-excursion (dcl-beginning-of-statement) (point))
1431 ;; handle some special cases
1433 ((nth 3 info) ; in text constant
1434 (insert "\" + -\n\"")
1435 (indent-according-to-mode)
1437 ((not (nth 4 info)) ; not in comment
1440 (= (char-after (point)) ?\")
1441 (= (char-after (1- (point))) ?\"))
1442 (progn ; a " "" " situation
1444 (insert "\" + -\n\"")
1446 (indent-according-to-mode)
1448 ((and (dcl-was-looking-at "[ \t]*-[ \t]*") ; after cont mark
1449 (looking-at "[ \t]*\\(!.*\\)?$"))
1450 ;; Do default below. This might considered wrong if we're
1451 ;; after a subtraction: $ x = 3 - <M-LFD>
1454 (delete-horizontal-space)
1456 (insert "\n") (indent-according-to-mode)
1459 ;; use the normal function for other cases
1460 (if (not done) ; normal M-LFD action
1461 (indent-new-comment-line))))
1464 ;;;-------------------------------------------------------------------------
1465 (defun dcl-delete-indentation (&optional arg)
1466 "Join this line to previous like delete-indentation.
1467 Also remove the continuation mark if easily detected."
1469 (delete-indentation arg)
1470 (let ((type (dcl-get-line-type)))
1471 (if (and (or (equal type '$)
1473 (equal type 'empty-$))
1475 (= (char-after (1- (point))) ?-))
1477 (delete-backward-char 1)
1478 (fixup-whitespace)))))
1481 ;;; *** Set options *********************************************************
1484 ;;;-------------------------------------------------------------------------
1485 (defun dcl-option-value-basic (option-assoc)
1486 "Guess a value for basic-offset."
1488 (dcl-beginning-of-command)
1489 (let* (;; current lines indentation
1490 (this-indent (save-excursion
1491 (dcl-back-to-indentation)
1493 ;; previous lines indentation
1494 (prev-indent (save-excursion
1495 (if (dcl-backward-command)
1497 (dcl-back-to-indentation)
1498 (current-column)))))
1499 (next-indent (save-excursion
1500 (dcl-end-of-command)
1501 (if (dcl-forward-command)
1503 (dcl-beginning-of-command)
1504 (dcl-back-to-indentation)
1505 (current-column)))))
1506 (diff (if prev-indent
1507 (abs (- this-indent prev-indent)))))
1513 (/= (- this-indent next-indent) 0))
1514 (abs (- this-indent next-indent)))
1516 dcl-basic-offset)))))
1519 ;;;-------------------------------------------------------------------------
1520 (defun dcl-option-value-offset (option-assoc)
1521 "Guess a value for an offset.
1522 Find the column of the first non-blank character on the line.
1523 Returns a number as a string."
1526 (re-search-forward "^$[ \t]*" nil t)
1530 ;;;-------------------------------------------------------------------------
1531 (defun dcl-option-value-margin-offset (option-assoc)
1532 "Guess a value for margin offset.
1533 Find the column of the first non-blank character on the line, not
1535 Returns a number as a string."
1538 (dcl-back-to-indentation)
1542 ;;;-------------------------------------------------------------------------
1543 (defun dcl-option-value-comment-line (option-assoc)
1544 "Guess a value for `dcl-comment-line-regexp'.
1545 Must return a string."
1546 ;; Should we set comment-start and comment-start-skip as well?
1547 ;; If someone wants `$!&' as a comment line, C-M-j won't work well if
1549 ;; This must be done after the user has given the real value in
1555 ;; We could search for "^\\$.*!+[^ \t]*", but, as noted above, we
1556 ;; can't handle that case very good, so there is no point in
1558 (if (looking-at "^\\$[^!\n]*!")
1559 (let ((regexp (buffer-substring (match-beginning 0) (match-end 0))))
1560 (concat "^" (regexp-quote regexp)))
1561 dcl-comment-line-regexp))))
1564 ;;;-------------------------------------------------------------------------
1565 (defun dcl-guess-option-value (option)
1566 "Guess what value the user would like to give the symbol option."
1567 (let* ((option-assoc (assoc option dcl-option-alist))
1568 (option (car option-assoc))
1569 (action (car (cdr option-assoc)))
1572 (funcall action option-assoc))
1573 ((eq action 'toggle)
1574 (not (eval option)))
1575 ((eq action 'curval)
1576 (cond ((or (stringp (symbol-value option))
1577 (numberp (symbol-value option)))
1578 (format "%S" (symbol-value option)))
1580 (format "'%S" (symbol-value option))))))))
1581 ;; format the value as a string if not already done
1584 (format "%S" value))))
1587 ;;;-------------------------------------------------------------------------
1588 (defun dcl-guess-option ()
1589 "Guess what option the user wants to set by looking around in the code.
1590 Returns the name of the option variable as a string."
1591 (let ((case-fold-search t))
1594 ((eq (dcl-get-line-type) '-)
1595 "dcl-calc-cont-indent-function")
1599 (looking-at "^\\$[ \t]*!"))
1600 "dcl-comment-line-regexp")
1601 ;; Margin offset: subroutine statement or first line in buffer
1602 ;; Test this before label indentation to detect a subroutine
1605 (or (looking-at (concat "^\\$[ \t]*" dcl-label-r dcl-ws-r
1608 (not (dcl-backward-command t)))))
1609 "dcl-margin-offset")
1610 ;; Margin offset: on command line after subroutine statement
1613 (and (eq (dcl-get-line-type) '$)
1614 (dcl-backward-command)
1615 (looking-at (concat "^\\$[ \t]*" dcl-label-r dcl-ws-r
1617 "dcl-margin-offset")
1618 ;; Label indentation
1621 (and (looking-at (concat "^\\$[ \t]*" dcl-label-r))
1622 (not (and dcl-block-begin-regexp
1623 (looking-at (concat "^\\$[ \t]*"
1624 dcl-block-begin-regexp))))
1625 (not (and dcl-block-end-regexp
1626 (looking-at (concat "^\\$[ \t]*"
1627 dcl-block-end-regexp))))))
1628 "dcl-margin-label-offset")
1630 ((and (eq (dcl-get-line-type) '$) ; beginning of command
1633 (let* ((this-indent (save-excursion
1634 (dcl-back-to-indentation)
1636 (prev-indent (save-excursion
1637 (if (dcl-backward-command)
1639 (dcl-back-to-indentation)
1640 (current-column)))))
1641 (next-indent (save-excursion
1642 (dcl-end-of-command)
1643 (if (dcl-forward-command)
1645 (dcl-beginning-of-command)
1646 (dcl-back-to-indentation)
1647 (current-column))))))
1648 (or (and prev-indent ; last cmd is indented differently
1649 (/= (- this-indent prev-indent) 0))
1651 (/= (- this-indent next-indent) 0))))))
1658 ;;;-------------------------------------------------------------------------
1659 (defun dcl-set-option (option-sym option-value)
1660 "Set a value for one of the dcl customization variables.
1661 The function tries to guess which variable should be set and to what value.
1662 All variable names are available as completions and in the history list."
1665 (intern (completing-read
1666 "Set DCL option: " ; prompt
1667 (mapcar (function ; alist of valid values
1668 (lambda (option-assoc)
1669 (cons (format "%s" (car option-assoc)) nil)))
1672 t ; only value from the list OK
1673 (dcl-guess-option) ; initial (default) value
1674 'dcl-option-history))) ; history list
1677 (format "Set DCL option %s to: " option-sym)
1678 (dcl-guess-option-value option-sym))))
1679 (list option-sym option-value)))
1680 ;; Should make a sanity check on the symbol/value pair.
1681 ;; `set' instead of `setq' because we want option-sym to be evaluated.
1682 (set option-sym option-value))
1685 ;;; *** Save options ********************************************************
1688 ;;;-------------------------------------------------------------------------
1689 (defun dcl-save-local-variable (var &optional def-prefix def-suffix)
1690 "Save a variable in a `Local Variables' list.
1691 Set or update the value of VAR in the current buffers
1692 `Local Variables:' list."
1693 ;; Look for "Local variables:" line in last page.
1695 (goto-char (point-max))
1696 (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)
1697 (if (let ((case-fold-search t))
1698 (search-forward "Local Variables:" nil t))
1700 prefix prefixlen suffix beg
1701 prefix-string suffix-string)
1702 ;; The prefix is what comes before "local variables:" in its line.
1703 ;; The suffix is what comes after "local variables:" in its line.
1704 (skip-chars-forward " \t")
1706 (setq suffix-string (buffer-substring (point)
1707 (progn (end-of-line) (point)))))
1708 (goto-char (match-beginning 0))
1711 (buffer-substring (point)
1712 (progn (beginning-of-line) (point)))))
1714 (if prefix-string (setq prefixlen (length prefix-string)
1715 prefix (regexp-quote prefix-string)))
1716 (if suffix-string (setq suffix (concat (regexp-quote suffix-string)
1719 ;; Look at next local variable spec.
1720 (if selective-display (re-search-forward "[\n\C-m]")
1722 ;; Skip the prefix, if any.
1724 (if (looking-at prefix)
1725 (forward-char prefixlen)
1726 (error "Local variables entry is missing the prefix")))
1727 ;; Find the variable name; strip whitespace.
1728 (skip-chars-forward " \t")
1730 (skip-chars-forward "^:\n")
1731 (if (eolp) (error "Missing colon in local variables entry"))
1732 (skip-chars-backward " \t")
1733 (let* ((str (buffer-substring beg (point)))
1734 (found-var (read str))
1736 ;; Setting variable named "end" means end of list.
1737 (if (string-equal (downcase str) "end")
1739 ;; Not found. Insert a new entry before this line
1742 (insert (concat prefix-string (symbol-name var) ": "
1743 (prin1-to-string (eval var)) " "
1744 suffix-string "\n")))
1745 ;; Is it the variable we are looking for?
1746 (if (eq var found-var)
1748 ;; Found it: delete the variable value and insert the
1751 (skip-chars-forward "^:")
1753 (delete-region (point) (progn (read (current-buffer))
1756 (prin1 (eval var) (current-buffer))
1757 (skip-chars-backward "\n")
1758 (skip-chars-forward " \t")
1759 (or (if suffix (looking-at suffix) (eolp))
1761 "Local variables entry is terminated incorrectly")))
1763 ;; Did not find "Local variables:"
1764 (goto-char (point-max))
1767 ;; If def- parameter not set, use comment- if set. In that case, make
1768 ;; sure there is a space in a suitable position
1774 (if (or (equal comment-start "")
1775 (string-match "[ \t]$" comment-start))
1777 (concat comment-start " ")))))
1783 (if (or (equal comment-end "")
1784 (string-match "^[ \t]" comment-end))
1786 (concat " " comment-end))))))
1787 (insert (concat def-prefix "Local variables:" def-suffix "\n"))
1788 (insert (concat def-prefix (symbol-name var) ": "
1789 (prin1-to-string (eval var)) def-suffix "\n"))
1790 (insert (concat def-prefix "end:" def-suffix)))
1794 ;;;-------------------------------------------------------------------------
1795 (defun dcl-save-all-options ()
1796 "Save all dcl-mode options for this buffer.
1797 Saves or updates all dcl-mode related options in a `Local Variables:'
1798 section at the end of the current buffer."
1800 (mapcar (lambda (option-assoc)
1801 (let* ((option (car option-assoc)))
1802 (dcl-save-local-variable option "$! ")))
1806 ;;;-------------------------------------------------------------------------
1807 (defun dcl-save-nondefault-options ()
1808 "Save changed DCL mode options for this buffer.
1809 Saves or updates all DCL mode related options that don't have their
1810 default values in a `Local Variables:' section at the end of the
1813 No entries are removed from the `Local Variables:' section. This means
1814 that if a variable is given a non-default value in the section and
1815 later is manually reset to its default value, the variable's entry will
1816 still be present in the `Local Variables:' section with its old value."
1818 (mapcar (lambda (option-assoc)
1819 (let* ((option (car option-assoc))
1820 (option-name (symbol-name option)))
1821 (if (and (string-equal "dcl-"
1822 (substring option-name 0 4))
1823 (not (equal (default-value option) (eval option))))
1824 (dcl-save-local-variable option "$! "))))
1828 ;;;-------------------------------------------------------------------------
1829 (defun dcl-save-option (option)
1830 "Save a DCL mode option for this buffer.
1831 Saves or updates an option in a `Local Variables:'
1832 section at the end of the current buffer."
1834 (let ((option (intern (completing-read "Option: " obarray))))
1836 (dcl-save-local-variable option))
1839 ;;;-------------------------------------------------------------------------
1840 (defun dcl-save-mode ()
1841 "Save the current mode for this buffer.
1842 Save the current mode in a `Local Variables:'
1843 section at the end of the current buffer."
1845 (let ((mode (prin1-to-string major-mode)))
1846 (if (string-match "-mode$" mode)
1847 (let ((mode (intern (substring mode 0 (match-beginning 0)))))
1848 (dcl-save-option 'mode))
1849 (message "Strange mode: %s" mode))))
1852 ;;; *** Templates ***********************************************************
1853 ;; tempo seems to be the only suitable package among those included in
1854 ;; standard Emacs. I would have liked something closer to the functionality
1855 ;; of LSE templates...
1859 (defvar dcl-tempo-tags nil
1860 "Tempo tags for DCL mode.")
1862 (tempo-define-template "dcl-f$context"
1863 '("f$context" dcl-tempo-left-paren
1864 (p "context-type: ") dcl-tempo-comma
1865 (p "context-symbol: ") dcl-tempo-comma
1866 (p "selection-item: ") dcl-tempo-comma
1867 (p "selection-value: ") dcl-tempo-comma
1868 (p "value-qualifier: ") dcl-tempo-right-paren)
1869 "f$context" "" 'dcl-tempo-tags)
1871 (tempo-define-template "dcl-f$csid"
1872 '("f$csid" dcl-tempo-left-paren
1873 (p "context-symbol: ") dcl-tempo-right-paren)
1874 "f$csid" "" 'dcl-tempo-tags)
1876 (tempo-define-template "dcl-f$cvsi"
1877 '("f$cvsi" dcl-tempo-left-paren
1878 (p "start-bit: ") dcl-tempo-comma
1879 (p "number-of-bits: ") dcl-tempo-comma
1880 (p "string: ") dcl-tempo-right-paren)
1881 "f$cvsi" "" 'dcl-tempo-tags)
1883 (tempo-define-template "dcl-f$cvtime"
1884 '("f$cvtime" dcl-tempo-left-paren
1885 (p "[input_time]: ") dcl-tempo-comma
1886 (p "[output_time_format]: ") dcl-tempo-comma
1887 (p "[output_field]: ") dcl-tempo-right-paren)
1888 "f$cvtime" "" 'dcl-tempo-tags)
1890 (tempo-define-template "dcl-f$cvui"
1891 '("f$cvui" dcl-tempo-left-paren
1892 (p "start-bit: ") dcl-tempo-comma
1893 (p "number-of-bits: ") dcl-tempo-comma
1894 (p "string") dcl-tempo-right-paren)
1895 "f$cvui" "" 'dcl-tempo-tags)
1897 (tempo-define-template "dcl-f$device"
1898 '("f$device" dcl-tempo-left-paren
1899 (p "[search_devnam]: ") dcl-tempo-comma
1900 (p "[devclass]: ") dcl-tempo-comma
1901 (p "[devtype]: ") dcl-tempo-comma
1902 (p "[stream-id]: ") dcl-tempo-right-paren)
1903 "f$device" "" 'dcl-tempo-tags)
1905 (tempo-define-template "dcl-f$directory"
1906 '("f$directory" dcl-tempo-left-paren
1907 dcl-tempo-right-paren)
1908 "f$directory" "" 'dcl-tempo-tags)
1910 (tempo-define-template "dcl-f$edit"
1911 '("f$edit" dcl-tempo-left-paren
1912 (p "string: ") dcl-tempo-comma
1913 (p "edit-list: ") dcl-tempo-right-paren)
1914 "f$edit" "" 'dcl-tempo-tags)
1916 (tempo-define-template "dcl-f$element"
1917 '("f$element" dcl-tempo-left-paren
1918 (p "element-number: ") dcl-tempo-comma
1919 (p "delimiter: ") dcl-tempo-comma
1920 (p "string: ") dcl-tempo-right-paren)
1921 "f$element" "" 'dcl-tempo-tags)
1923 (tempo-define-template "dcl-f$environment"
1924 '("f$environment" dcl-tempo-left-paren
1925 (p "item: ") dcl-tempo-right-paren)
1926 "f$environment" "" 'dcl-tempo-tags)
1928 (tempo-define-template "dcl-f$extract"
1929 '("f$extract" dcl-tempo-left-paren
1930 (p "start: ") dcl-tempo-comma
1931 (p "length: ") dcl-tempo-comma
1932 (p "string: ") dcl-tempo-right-paren)
1933 "f$extract" "" 'dcl-tempo-tags)
1935 (tempo-define-template "dcl-f$fao"
1936 '("f$fao" dcl-tempo-left-paren
1937 (p "control-string: ") dcl-tempo-comma
1938 ("argument[,...]: ") dcl-tempo-right-paren)
1939 "f$fao" "" 'dcl-tempo-tags)
1941 (tempo-define-template "dcl-f$file_attributes"
1942 '("f$file_attributes" dcl-tempo-left-paren
1943 (p "filespec: ") dcl-tempo-comma
1944 (p "item: ") dcl-tempo-right-paren)
1945 "f$file_attributes" "" 'dcl-tempo-tags)
1947 (tempo-define-template "dcl-f$getdvi"
1948 '("f$getdvi" dcl-tempo-left-paren
1949 (p "device-name: ") dcl-tempo-comma
1950 (p "item: ") dcl-tempo-right-paren)
1951 "f$getdvi" "" 'dcl-tempo-tags)
1953 (tempo-define-template "dcl-f$getjpi"
1954 '("f$getjpi" dcl-tempo-left-paren
1955 (p "pid: ") dcl-tempo-comma
1956 (p "item: ") dcl-tempo-right-paren )
1957 "f$getjpi" "" 'dcl-tempo-tags)
1959 (tempo-define-template "dcl-f$getqui"
1960 '("f$getqui" dcl-tempo-left-paren
1961 (p "function: ") dcl-tempo-comma
1962 (p "[item]: ") dcl-tempo-comma
1963 (p "[object-id]: ") dcl-tempo-comma
1964 (p "[flags]: ") dcl-tempo-right-paren)
1965 "f$getqui" "" 'dcl-tempo-tags)
1967 (tempo-define-template "dcl-f$getsyi"
1968 '("f$getsyi" dcl-tempo-left-paren
1969 (p "item: ") dcl-tempo-comma
1970 (p "[node-name]: ") dcl-tempo-comma
1971 (p "[cluster-id]: ") dcl-tempo-right-paren)
1972 "f$getsyi" "" 'dcl-tempo-tags)
1974 (tempo-define-template "dcl-f$identifier"
1975 '("f$identifier" dcl-tempo-left-paren
1976 (p "identifier: ") dcl-tempo-comma
1977 (p "conversion-type: ") dcl-tempo-right-paren)
1978 "f$identifier" "" 'dcl-tempo-tags)
1980 (tempo-define-template "dcl-f$integer"
1981 '("f$integer" dcl-tempo-left-paren
1982 (p "expression: ") dcl-tempo-right-paren)
1983 "f$integer" "" 'dcl-tempo-tags)
1985 (tempo-define-template "dcl-f$length"
1986 '("f$length" dcl-tempo-left-paren
1987 (p "string: ") dcl-tempo-right-paren )
1988 "f$length" "" 'dcl-tempo-tags)
1990 (tempo-define-template "dcl-f$locate"
1991 '("f$locate" dcl-tempo-left-paren
1992 (p "substring: ") dcl-tempo-comma
1993 (p "string: ") dcl-tempo-right-paren)
1994 "f$locate" "" 'dcl-tempo-tags)
1996 (tempo-define-template "dcl-f$message"
1997 '("f$message" dcl-tempo-left-paren
1998 (p "status-code: ") dcl-tempo-right-paren )
1999 "f$message" "" 'dcl-tempo-tags)
2001 (tempo-define-template "dcl-f$mode"
2002 '("f$mode" dcl-tempo-left-paren dcl-tempo-right-paren)
2003 "f$mode" "" 'dcl-tempo-tags)
2005 (tempo-define-template "dcl-f$parse"
2006 '("f$parse" dcl-tempo-left-paren
2007 (p "filespec: ") dcl-tempo-comma
2008 (p "[default-spec]: ") dcl-tempo-comma
2009 (p "[related-spec]: ") dcl-tempo-comma
2010 (p "[field]: ") dcl-tempo-comma
2011 (p "[parse-type]: ") dcl-tempo-right-paren)
2012 "f$parse" "" 'dcl-tempo-tags)
2014 (tempo-define-template "dcl-f$pid"
2015 '("f$pid" dcl-tempo-left-paren
2016 (p "context-symbol: ") dcl-tempo-right-paren)
2017 "f$pid" "" 'dcl-tempo-tags)
2019 (tempo-define-template "dcl-f$privilege"
2020 '("f$privilege" dcl-tempo-left-paren
2021 (p "priv-states: ") dcl-tempo-right-paren)
2022 "f$privilege" "" 'dcl-tempo-tags)
2024 (tempo-define-template "dcl-f$process"
2026 "f$process" "" 'dcl-tempo-tags)
2028 (tempo-define-template "dcl-f$search"
2029 '("f$search" dcl-tempo-left-paren
2030 (p "filespec: ") dcl-tempo-comma
2031 (p "[stream-id]: ") dcl-tempo-right-paren)
2032 "f$search" "" 'dcl-tempo-tags)
2034 (tempo-define-template "dcl-f$setprv"
2035 '("f$setprv" dcl-tempo-left-paren
2036 (p "priv-states: ") dcl-tempo-right-paren)
2037 "f$setprv" "" 'dcl-tempo-tags)
2039 (tempo-define-template "dcl-f$string"
2040 '("f$string" dcl-tempo-left-paren
2041 (p "expression: ") dcl-tempo-right-paren)
2042 "f$string" "" 'dcl-tempo-tags)
2044 (tempo-define-template "dcl-f$time"
2045 '("f$time" dcl-tempo-left-paren dcl-tempo-right-paren)
2046 "f$time" "" 'dcl-tempo-tags)
2048 (tempo-define-template "dcl-f$trnlnm"
2049 '("f$trnlnm" dcl-tempo-left-paren
2050 (p "logical-name: ") dcl-tempo-comma
2051 (p "[table]: ") dcl-tempo-comma
2052 (p "[index]: ") dcl-tempo-comma
2053 (p "[mode]: ") dcl-tempo-comma
2054 (p "[case]: ") dcl-tempo-comma
2055 (p "[item]: ") dcl-tempo-right-paren)
2056 "f$trnlnm" "" 'dcl-tempo-tags)
2058 (tempo-define-template "dcl-f$type"
2059 '("f$type" dcl-tempo-left-paren
2060 (p "symbol-name: ") dcl-tempo-right-paren)
2061 "f$type" "" 'dcl-tempo-tags)
2063 (tempo-define-template "dcl-f$user"
2064 '("f$user" dcl-tempo-left-paren dcl-tempo-right-paren)
2065 "f$user" "" 'dcl-tempo-tags)
2067 (tempo-define-template "dcl-f$verify"
2068 '("f$verify" dcl-tempo-left-paren
2069 (p "[procedure-value]: ") dcl-tempo-comma
2070 (p "[image-value]: ") dcl-tempo-right-paren)
2071 "f$verify" "" 'dcl-tempo-tags)
2076 ;;; *** Unsorted stuff *****************************************************
2079 ;;;-------------------------------------------------------------------------
2080 (defun dcl-beginning-of-command-p ()
2081 "Return t if point is at the beginning of a command.
2082 Otherwise return nil."
2084 (eq (dcl-get-line-type) '$)))
2087 ;;;-------------------------------------------------------------------------
2088 (defun dcl-end-of-command-p ()
2089 "Check if point is at the end of a command.
2090 Return t if point is at the end of a command, either the end of an
2091 only line or at the end of the last continuation line.
2092 Otherwise return nil."
2093 ;; Must be at end-of-line on a command line or a continuation line
2094 (let ((type (dcl-get-line-type)))
2098 ;; Next line must not be a continuation line
2101 (not (eq (dcl-get-line-type) '-))))))
2104 ;;;-------------------------------------------------------------------------
2105 (defun dcl-command-p ()
2106 "Check if point is on a command line.
2107 Return t if point is on a command line or a continuation line,
2108 otherwise return nil."
2109 (let ((type (dcl-get-line-type)))
2114 ;;;-------------------------------------------------------------------------
2115 (defun dcl-was-looking-at (regexp)
2117 (let ((start (point))
2118 (found (re-search-backward regexp 0 t)))
2121 (equal start (match-end 0))))))
2124 ;;;-------------------------------------------------------------------------
2125 (defun dcl-imenu-create-index-function ()
2126 "Jacket routine to make imenu searches non case sensitive."
2127 (let ((case-fold-search t))
2128 (imenu-default-create-index-function)))
2132 ;;; *** Epilogue ************************************************************
2137 (run-hooks 'dcl-mode-load-hook) ; for your customizations
2139 ;;; dcl-mode.el ends here