annotate lisp/progmodes/dcl-mode.el @ 105458:4d2aa5860e37

(Ffile_attributes): Doc fix. (Bug#4638)
author Eli Zaretskii <eliz@gnu.org>
date Mon, 05 Oct 2009 08:35:12 +0000
parents a9dc0e7c3f2b
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; dcl-mode.el --- major mode for editing DCL command files
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 94673
diff changeset
3 ;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
64699
629afbe74e61 Update copyright for release of 22.1 for progmodes directory.
Nick Roberts <nickrob@snap.net.nz>
parents: 64085
diff changeset
4 ;; Free Software Foundation, Inc.
17252
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
5
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Author: Odd Gripenstam <gripenstamol@decus.se>
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Maintainer: Odd Gripenstam <gripenstamol@decus.se>
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; Keywords: DCL editing major-mode languages
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
17252
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
10 ;; This file is part of GNU Emacs.
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
11
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
17252
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; (at your option) any later version.
17252
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
16
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
20 ;; GNU General Public License for more details.
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
21
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94673
52b7a8c22af5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
17252
fb59cd650fa1 Add copyright notice and distribution terms.
Richard M. Stallman <rms@gnu.org>
parents: 17246
diff changeset
24
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; DCL mode is a package for editing DCL command files. It helps you
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; indent lines, add leading `$' and trailing `-', move around in the
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; code and insert lexical functions.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;;
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; Type `C-h m' when you are editing a .COM file to get more
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; information about this mode.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
33 ;;
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; To use templates you will need a version of tempo.el that is at
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; least later than the buggy 1.1.1, which was included with my versions of
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
36 ;; Emacs. I used version 1.2.4.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; The latest tempo.el distribution can be fetched from
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; ftp.lysator.liu.se in the directory /pub/emacs.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; I recommend setting (setq tempo-interactive t). This will make
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; tempo prompt you for values to put in the blank spots in the templates.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;;
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; There is limited support for imenu. The limitation is that you need
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; a version of imenu.el that uses imenu-generic-expression. I found
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; the version I use in Emacs 19.30. (It was *so* much easier to hook
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; into that version than the one in 19.27...)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;;
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; Any feedback will be welcomed. If you write functions for
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; dcl-calc-command-indent-function or dcl-calc-cont-indent-function,
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
49 ;; please send them to the maintainer.
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
50 ;;
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;;
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; Ideas for improvement:
50044
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
53 ;; * Better font-lock support.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;; * Change meaning of `left margin' when dcl-tab-always-indent is nil.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; Consider the following line (`_' is the cursor):
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; $ label: _ command
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;; Pressing tab with the cursor at the underline now inserts a tab.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;; This should be part of the left margin and pressing tab should indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; the line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; * Make M-LFD work properly with comments in all cases. Now it only
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; works on comment-only lines. But what is "properly"? New rules for
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;; indenting comments?
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 ;; * Even smarter indentation of continuation lines.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;; * A delete-indentation function (M-^) that joins continued lines,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;; including lines with end line comments?
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; * Handle DECK/EOD.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;; * `indent list' commands: C-M-q, C-u TAB. What is a list in DCL? One
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;; complete command line? A block? A subroutine?
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;;; Code:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
77101
4ffc72fe7808 (top-level): Move (require 'tempo) to start to quieten byte-compiler.
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
72 (require 'tempo)
4ffc72fe7808 (top-level): Move (require 'tempo) to start to quieten byte-compiler.
Glenn Morris <rgm@gnu.org>
parents: 75347
diff changeset
73
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;;; *** Customization *****************************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75
50044
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
76
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
77 ;; First, font lock. This is a minimal approach, please improve!
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
78
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
79 (defvar dcl-font-lock-keywords
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
80 '(("\\<\\(if\\|then\\|else\\|endif\\)\\>"
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
81 1 font-lock-keyword-face)
60767
66c8a6842570 (dcl-font-lock-keywords): Add underscore to "f$ lexicals" regexp.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 60578
diff changeset
82 ("\\<f[$][a-z_]+\\>"
50044
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
83 0 font-lock-builtin-face)
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
84 ("[.]\\(eq\\|not\\|or\\|and\\|lt\\|gt\\|le\\|ge\\|eqs\\|nes\\)[.]"
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
85 0 font-lock-builtin-face))
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
86 "Font lock keyword specification for DCL mode.
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
87 Presently this includes some syntax, .OP.erators, and \"f$\" lexicals.")
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
88
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
89 (defvar dcl-font-lock-defaults
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
90 '(dcl-font-lock-keywords nil)
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
91 "Font lock specification for DCL mode.")
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
92
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
93
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
94 ;; Now the rest.
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
95
22511
f5b3f55fc25b (dcl): Define as customize group, not
Karl Heuer <kwzh@gnu.org>
parents: 20781
diff changeset
96 (defgroup dcl nil
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
97 "Major mode for editing DCL command files."
66963
a11fdee52c05 Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents: 64699
diff changeset
98 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
99 :group 'languages)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
101 (defcustom dcl-basic-offset 4
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 "*Number of columns to indent a block in DCL.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 A block is the commands between THEN-ELSE-ENDIF and between the commands
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 dcl-block-begin-regexp and dcl-block-end-regexp.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 The meaning of this variable may be changed if
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
107 dcl-calc-command-indent-function is set to a function."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
108 :type 'integer
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
109 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
112 (defcustom dcl-continuation-offset 6
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 "*Number of columns to indent a continuation line in DCL.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 A continuation line is a line that follows a line ending with `-'.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 The meaning of this variable may be changed if
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
117 dcl-calc-cont-indent-function is set to a function."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
118 :type 'integer
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
119 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
122 (defcustom dcl-margin-offset 8
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 "*Indentation for the first command line in DCL.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
124 The first command line in a file or after a SUBROUTINE statement is indented
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 this much. Other command lines are indented the same number of columns as
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 the preceding command line.
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
127 A command line is a line that starts with `$'."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
128 :type 'integer
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
129 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
132 (defcustom dcl-margin-label-offset 2
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 "*Number of columns to indent a margin label in DCL.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 A margin label is a label that doesn't begin or end a block, i.e. it
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
135 doesn't match dcl-block-begin-regexp or dcl-block-end-regexp."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
136 :type 'integer
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
137 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
140 (defcustom dcl-comment-line-regexp "^\\$!"
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 "*Regexp describing the start of a comment line in DCL.
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
142 Comment lines are not indented."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
143 :type 'regexp
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
144 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
147 (defcustom dcl-block-begin-regexp "loop[0-9]*:"
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 "*Regexp describing a command that begins an indented block in DCL.
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
149 Set to nil to only indent at THEN-ELSE-ENDIF."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
150 :type 'regexp
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
151 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
154 (defcustom dcl-block-end-regexp "endloop[0-9]*:"
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 "*Regexp describing a command that ends an indented block in DCL.
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
156 Set to nil to only indent at THEN-ELSE-ENDIF."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
157 :type 'regexp
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
158 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
161 (defcustom dcl-calc-command-indent-function nil
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 "*Function to calculate indentation for a command line in DCL.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
163 If this variable is non-nil it is called as a function:
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 \(func INDENT-TYPE CUR-INDENT EXTRA-INDENT LAST-POINT THIS-POINT)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
167 The function must return the number of columns to indent the current line or
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 nil to get the default indentation.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 INDENT-TYPE is a symbol indicating what kind of indentation should be done.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 It can have the following values:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 indent the lines indentation should be increased, e.g. after THEN.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 outdent the lines indentation should be decreased, e.g a line with ENDIF.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 first-line indentation for the first line in a buffer or SUBROUTINE.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 CUR-INDENT is the indentation of the preceding command line.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
176 EXTRA-INDENT is the default change in indentation for this line
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 \(a negative number for 'outdent).
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 LAST-POINT is the buffer position of the first significant word on the
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 previous line or nil if the current line is the first line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 THIS-POINT is the buffer position of the first significant word on the
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 current line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
183 If this variable is nil, the indentation is calculated as
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 CUR-INDENT + EXTRA-INDENT.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 This package includes two functions suitable for this:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 dcl-calc-command-indent-multiple
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
188 dcl-calc-command-indent-hang"
35960
a21a0d45ea19 (dcl-calc-command-indent-function): Fix :type.
Dave Love <fx@gnu.org>
parents: 22511
diff changeset
189 :type '(choice (const nil) function)
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
190 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
193 (defcustom dcl-calc-cont-indent-function 'dcl-calc-cont-indent-relative
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 "*Function to calculate indentation for a continuation line.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
195 If this variable is non-nil it is called as a function:
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 \(func CUR-INDENT EXTRA-INDENT)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
199 The function must return the number of columns to indent the current line or
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 nil to get the default indentation.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
202 If this variable is nil, the indentation is calculated as
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 CUR-INDENT + EXTRA-INDENT.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 This package includes one function suitable for this:
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
206 dcl-calc-cont-indent-relative"
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
207 :type 'function
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
208 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
211 (defcustom dcl-tab-always-indent t
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 "*Controls the operation of the TAB key in DCL mode.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 If t, pressing TAB always indents the current line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 If nil, pressing TAB indents the current line if point is at the left margin.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
215 Data lines (i.e. lines not part of a command line or continuation line) are
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
216 never indented."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
217 :type 'boolean
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
218 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
221 (defcustom dcl-electric-characters t
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
222 "*Non-nil means reindent immediately when a label, ELSE or ENDIF is inserted."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
223 :type 'boolean
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
224 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
227 (defcustom dcl-tempo-comma ", "
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
228 "*Text to insert when a comma is needed in a template, in DCL mode."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
229 :type 'string
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
230 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
232 (defcustom dcl-tempo-left-paren "("
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
233 "*Text to insert when a left parenthesis is needed in a template in DCL."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
234 :type 'string
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
235 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
238 (defcustom dcl-tempo-right-paren ")"
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
239 "*Text to insert when a right parenthesis is needed in a template in DCL."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
240 :type 'string
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
241 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 ; I couldn't decide what looked best, so I'll let you decide...
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 ; Remember, you can also customize this with imenu-submenu-name-format.
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
245 (defcustom dcl-imenu-label-labels "Labels"
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
246 "*Imenu menu title for sub-listing with label names."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
247 :type 'string
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
248 :group 'dcl)
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
249 (defcustom dcl-imenu-label-goto "GOTO"
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
250 "*Imenu menu title for sub-listing with GOTO statements."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
251 :type 'string
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
252 :group 'dcl)
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
253 (defcustom dcl-imenu-label-gosub "GOSUB"
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
254 "*Imenu menu title for sub-listing with GOSUB statements."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
255 :type 'string
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
256 :group 'dcl)
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
257 (defcustom dcl-imenu-label-call "CALL"
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
258 "*Imenu menu title for sub-listing with CALL statements."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
259 :type 'string
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
260 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
262 (defcustom dcl-imenu-generic-expression
41608
45db352a0971 Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents: 35960
diff changeset
263 `((nil "^\\$[ \t]*\\([A-Za-z0-9_\$]+\\):[ \t]+SUBROUTINE\\b" 1)
45db352a0971 Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents: 35960
diff changeset
264 (,dcl-imenu-label-labels
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 "^\\$[ \t]*\\([A-Za-z0-9_\$]+\\):\\([ \t]\\|$\\)" 1)
41608
45db352a0971 Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents: 35960
diff changeset
266 (,dcl-imenu-label-goto "\\s-GOTO[ \t]+\\([A-Za-z0-9_\$]+\\)" 1)
45db352a0971 Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents: 35960
diff changeset
267 (,dcl-imenu-label-gosub "\\s-GOSUB[ \t]+\\([A-Za-z0-9_\$]+\\)" 1)
45db352a0971 Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents: 35960
diff changeset
268 (,dcl-imenu-label-call "\\s-CALL[ \t]+\\([A-Za-z0-9_\$]+\\)" 1))
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
269 "*Default imenu generic expression for DCL.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 The default includes SUBROUTINE labels in the main listing and
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
272 sub-listings for other labels, CALL, GOTO and GOSUB statements.
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
273 See `imenu-generic-expression' for details."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
274 :type '(repeat (sexp :tag "Imenu Expression"))
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
275 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
278 (defcustom dcl-mode-hook nil
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
279 "*Hook called by `dcl-mode'."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
280 :type 'hook
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
281 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 ;;; *** Global variables ****************************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (defvar dcl-mode-syntax-table nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 "Syntax table used in DCL-buffers.")
60578
634b2aa97a80 (dcl-mode-syntax-table): Add entry for backslash.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
289 (unless dcl-mode-syntax-table
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (setq dcl-mode-syntax-table (make-syntax-table))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 (modify-syntax-entry ?! "<" dcl-mode-syntax-table) ; comment start
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (modify-syntax-entry ?\n ">" dcl-mode-syntax-table) ; comment end
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 (modify-syntax-entry ?< "(>" dcl-mode-syntax-table) ; < and ...
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (modify-syntax-entry ?> ")<" dcl-mode-syntax-table) ; > is a matching pair
60578
634b2aa97a80 (dcl-mode-syntax-table): Add entry for backslash.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 52401
diff changeset
295 (modify-syntax-entry ?\\ "_" dcl-mode-syntax-table) ; not an escape
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
296 )
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 (defvar dcl-mode-map ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 "Keymap used in DCL-mode buffers.")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 (if dcl-mode-map
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 (setq dcl-mode-map (make-sparse-keymap))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 (define-key dcl-mode-map "\e\n" 'dcl-split-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 (define-key dcl-mode-map "\e\t" 'tempo-complete-tag)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 (define-key dcl-mode-map "\e^" 'dcl-delete-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (define-key dcl-mode-map "\em" 'dcl-back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 (define-key dcl-mode-map "\ee" 'dcl-forward-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 (define-key dcl-mode-map "\ea" 'dcl-backward-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (define-key dcl-mode-map "\e\C-q" 'dcl-indent-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 (define-key dcl-mode-map "\t" 'dcl-tab)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (define-key dcl-mode-map ":" 'dcl-electric-character)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 (define-key dcl-mode-map "F" 'dcl-electric-character)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (define-key dcl-mode-map "f" 'dcl-electric-character)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (define-key dcl-mode-map "E" 'dcl-electric-character)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 (define-key dcl-mode-map "e" 'dcl-electric-character)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (define-key dcl-mode-map "\C-c\C-o" 'dcl-set-option)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 (define-key dcl-mode-map "\C-c\C-f" 'tempo-forward-mark)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 (define-key dcl-mode-map "\C-c\C-b" 'tempo-backward-mark)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 (define-key dcl-mode-map [menu-bar] (make-sparse-keymap))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 (define-key dcl-mode-map [menu-bar dcl]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 (cons "DCL" (make-sparse-keymap "DCL")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 ;; Define these in bottom-up order
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 (define-key dcl-mode-map [menu-bar dcl tempo-backward-mark]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 '("Previous template mark" . tempo-backward-mark))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 (define-key dcl-mode-map [menu-bar dcl tempo-forward-mark]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 '("Next template mark" . tempo-forward-mark))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 (define-key dcl-mode-map [menu-bar dcl tempo-complete-tag]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 '("Complete template tag" . tempo-complete-tag))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 (define-key dcl-mode-map [menu-bar dcl dcl-separator-tempo]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 '("--"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 (define-key dcl-mode-map [menu-bar dcl dcl-save-all-options]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 '("Save all options" . dcl-save-all-options))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 (define-key dcl-mode-map [menu-bar dcl dcl-save-nondefault-options]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 '("Save changed options" . dcl-save-nondefault-options))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 (define-key dcl-mode-map [menu-bar dcl dcl-set-option]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 '("Set option" . dcl-set-option))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (define-key dcl-mode-map [menu-bar dcl dcl-separator-option]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 '("--"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 (define-key dcl-mode-map [menu-bar dcl dcl-delete-indentation]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 '("Delete indentation" . dcl-delete-indentation))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 (define-key dcl-mode-map [menu-bar dcl dcl-split-line]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 '("Split line" . dcl-split-line))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 (define-key dcl-mode-map [menu-bar dcl dcl-indent-command]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 '("Indent command" . dcl-indent-command))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 (define-key dcl-mode-map [menu-bar dcl dcl-tab]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 '("Indent line/insert tab" . dcl-tab))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 (define-key dcl-mode-map [menu-bar dcl dcl-back-to-indentation]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 '("Back to indentation" . dcl-back-to-indentation))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 (define-key dcl-mode-map [menu-bar dcl dcl-forward-command]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 '("End of statement" . dcl-forward-command))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 (define-key dcl-mode-map [menu-bar dcl dcl-backward-command]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 '("Beginning of statement" . dcl-backward-command))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 ;; imenu is only supported for versions with imenu-generic-expression
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 (if (boundp 'imenu-generic-expression)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 (define-key dcl-mode-map [menu-bar dcl dcl-separator-movement]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 '("--"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (define-key dcl-mode-map [menu-bar dcl imenu]
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 '("Buffer index menu" . imenu))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 )
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
366 (defcustom dcl-ws-r
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 "\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 "Regular expression describing white space in a DCL command line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 White space is any number of continued lines with only space,tab,endcomment
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
370 followed by space or tab."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
371 :type 'regexp
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
372 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
375 (defcustom dcl-label-r
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 "[a-zA-Z0-9_\$]*:\\([ \t!]\\|$\\)"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 "Regular expression describing a label.
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
378 A label is a name followed by a colon followed by white-space or end-of-line."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
379 :type 'regexp
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
380 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
383 (defcustom dcl-cmd-r
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 "^\\$\\(.*-[ \t]*\\(!.*\\)*\n\\)*[^!\"\n]*\\(\".*\\(\"\".*\\)*\"\\)*[^!\"\n]*"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 "Regular expression describing a DCL command line up to a trailing comment.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 A line starting with $, optionally followed by continuation lines,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 followed by the end of the command line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 A continuation line is any characters followed by `-',
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
389 optionally followed by a comment, followed by a newline."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
390 :type 'regexp
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
391 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
394 (defcustom dcl-command-regexp
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 "^\\$\\(.*-[ \t]*\\(!.*\\)*\n\\)*.*\\(\".*\\(\"\".*\\)*\"\\)*"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 "Regular expression describing a DCL command line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 A line starting with $, optionally followed by continuation lines,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 followed by the end of the command line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 A continuation line is any characters followed by `-',
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
400 optionally followed by a comment, followed by a newline."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
401 :type 'regexp
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
402 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
405 (defcustom dcl-electric-reindent-regexps
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 (list "endif" "else" dcl-label-r)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 "*Regexps that can trigger an electric reindent.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 A list of regexps that will trigger a reindent if the last letter
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 is defined as dcl-electric-character.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 E.g.: if this list contains `endif', the key `f' is defined as
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 dcl-electric-character and the you have just typed the `f' in
20781
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
413 `endif', the line will be reindented."
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
414 :type '(repeat regexp)
6f55b3849106 Customized.
Andreas Schwab <schwab@suse.de>
parents: 20459
diff changeset
415 :group 'dcl)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
418 (defvar dcl-option-alist
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 '((dcl-basic-offset dcl-option-value-basic)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 (dcl-continuation-offset curval)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 (dcl-margin-offset dcl-option-value-margin-offset)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (dcl-margin-label-offset dcl-option-value-offset)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 (dcl-comment-line-regexp dcl-option-value-comment-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 (dcl-block-begin-regexp curval)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 (dcl-block-end-regexp curval)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
426 (dcl-tab-always-indent toggle)
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
427 (dcl-electric-characters toggle)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 (dcl-electric-reindent-regexps curval)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
429 (dcl-tempo-comma curval)
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
430 (dcl-tempo-left-paren curval)
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
431 (dcl-tempo-right-paren curval)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 (dcl-calc-command-indent-function curval)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 (dcl-calc-cont-indent-function curval)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 (comment-start curval)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 (comment-start-skip curval)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 )
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 "Options and default values for dcl-set-option.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 An alist with option variables and functions or keywords to get a
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 default value for the option.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 The keywords are:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 curval the current value
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 toggle the opposite of the current value (for t/nil)")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
447 (defvar dcl-option-history
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 (mapcar (lambda (option-assoc)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449 (format "%s" (car option-assoc)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 dcl-option-alist)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 "The history list for dcl-set-option.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 Preloaded with all known option names from dcl-option-alist")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 ;; Must be defined after dcl-cmd-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 ;; This version is more correct but much slower than the one
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 ;; above. This version won't find GOTOs in comments or text strings.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 ;(defvar dcl-imenu-generic-expression
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 ; (`
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 ; ((nil "^\\$[ \t]*\\([A-Za-z0-9_\$]+\\):[ \t]+SUBROUTINE\\b" 1)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 ; ("Labels" "^\\$[ \t]*\\([A-Za-z0-9_\$]+\\):\\([ \t]\\|$\\)" 1)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 ; ("GOTO" (, (concat dcl-cmd-r "GOTO[ \t]+\\([A-Za-z0-9_\$]+\\)")) 5)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 ; ("GOSUB" (, (concat dcl-cmd-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 ; "GOSUB[ \t]+\\([A-Za-z0-9_\$]+\\)")) 5)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 ; ("CALL" (, (concat dcl-cmd-r "CALL[ \t]+\\([A-Za-z0-9_\$]+\\)")) 5)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 ; "*Default imenu generic expression for DCL.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 ;The default includes SUBROUTINE labels in the main listing and
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
469 ;sub-listings for other labels, CALL, GOTO and GOSUB statements.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 ;See `imenu-generic-expression' in a recent (e.g. Emacs 19.30) imenu.el
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 ;for details.")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 ;;; *** Mode initialization *************************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 ;;;###autoload
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 (defun dcl-mode ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 "Major mode for editing DCL-files.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 This mode indents command lines in blocks. (A block is commands between
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 THEN-ELSE-ENDIF and between lines matching dcl-block-begin-regexp and
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 dcl-block-end-regexp.)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 Labels are indented to a fixed position unless they begin or end a block.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
486 Whole-line comments (matching dcl-comment-line-regexp) are not indented.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 Data lines are not indented.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 Key bindings:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 \\{dcl-mode-map}
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 Commands not usually bound to keys:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 \\[dcl-save-nondefault-options]\t\tSave changed options
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 \\[dcl-save-all-options]\t\tSave all options
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 \\[dcl-save-option]\t\t\tSave any option
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 \\[dcl-save-mode]\t\t\tSave buffer mode
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 Variables controlling indentation style and extra features:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 dcl-basic-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 Extra indentation within blocks.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 dcl-continuation-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 Extra indentation for continued lines.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 dcl-margin-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 Indentation for the first command line in a file or SUBROUTINE.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 dcl-margin-label-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 Indentation for a label.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 dcl-comment-line-regexp
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
514 Lines matching this regexp will not be indented.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 dcl-block-begin-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 dcl-block-end-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 Regexps that match command lines that begin and end, respectively,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 a block of commmand lines that will be given extra indentation.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 Command lines between THEN-ELSE-ENDIF are always indented; these variables
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 make it possible to define other places to indent.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 Set to nil to disable this feature.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 dcl-calc-command-indent-function
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 Can be set to a function that customizes indentation for command lines.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526 Two such functions are included in the package:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 dcl-calc-command-indent-multiple
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 dcl-calc-command-indent-hang
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 dcl-calc-cont-indent-function
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 Can be set to a function that customizes indentation for continued lines.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 One such function is included in the package:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 dcl-calc-cont-indent-relative (set by default)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535 dcl-tab-always-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 If t, pressing TAB always indents the current line.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
537 If nil, pressing TAB indents the current line if point is at the left
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 margin.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
540 dcl-electric-characters
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 Non-nil causes lines to be indented at once when a label, ELSE or ENDIF is
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 typed.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 dcl-electric-reindent-regexps
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 Use this variable and function dcl-electric-character to customize
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 which words trigger electric indentation.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 dcl-tempo-left-paren
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 dcl-tempo-right-paren
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 These variables control the look of expanded templates.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 dcl-imenu-generic-expression
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 Default value for imenu-generic-expression. The default includes
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 SUBROUTINE labels in the main listing and sub-listings for
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
556 other labels, CALL, GOTO and GOSUB statements.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 dcl-imenu-label-labels
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 dcl-imenu-label-goto
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 dcl-imenu-label-gosub
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 dcl-imenu-label-call
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 Change the text that is used as sub-listing labels in imenu.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 Loading this package calls the value of the variable
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
565 `dcl-mode-load-hook' with no args, if that value is non-nil.
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
566 Turning on DCL mode calls the value of the variable `dcl-mode-hook'
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 with no args, if that value is non-nil.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 The following example uses the default values for all variables:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
572 $! This is a comment line that is not indented (it matches
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 $! dcl-comment-line-regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 $! Next follows the first command line. It is indented dcl-margin-offset.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 $ i = 1
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 $ ! Other comments are indented like command lines.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 $ ! A margin label indented dcl-margin-label-offset:
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
578 $ label:
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 $ if i.eq.1
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 $ then
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
581 $ ! Lines between THEN-ELSE and ELSE-ENDIF are
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 $ ! indented dcl-basic-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 $ loop1: ! This matches dcl-block-begin-regexp...
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 $ ! ...so this line is indented dcl-basic-offset
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
585 $ text = \"This \" + - ! is a continued line
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 \"lined up with the command line\"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 $ type sys$input
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
588 Data lines are not indented at all.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 $ endloop1: ! This matches dcl-block-end-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 $ endif
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 $
50044
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
592
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
593
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
594 There is some minimal font-lock support (see vars
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
595 `dcl-font-lock-defaults' and `dcl-font-lock-keywords')."
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 (kill-all-local-variables)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 (set-syntax-table dcl-mode-syntax-table)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 (make-local-variable 'indent-line-function)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 (setq indent-line-function 'dcl-indent-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 (make-local-variable 'comment-start)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 (setq comment-start "!")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 (make-local-variable 'comment-end)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 (setq comment-end "")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 (make-local-variable 'comment-multi-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 (setq comment-multi-line nil)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
611
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 ;; This used to be "^\\$[ \t]*![ \t]*" which looks more correct.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 ;; The drawback was that you couldn't make empty comment lines by pressing
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 ;; C-M-j repeatedly - only the first line became a comment line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 ;; This version has the drawback that the "$" can be anywhere in the line,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616 ;; and something inappropriate might be interpreted as a comment.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 (make-local-variable 'comment-start-skip)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618 (setq comment-start-skip "\\$[ \t]*![ \t]*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 (if (boundp 'imenu-generic-expression)
20459
90f306f86f5d Use imenu-case-fold-search.
Dave Love <fx@gnu.org>
parents: 17261
diff changeset
621 (progn (setq imenu-generic-expression dcl-imenu-generic-expression)
90f306f86f5d Use imenu-case-fold-search.
Dave Love <fx@gnu.org>
parents: 17261
diff changeset
622 (setq imenu-case-fold-search t)))
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
623 (setq imenu-create-index-function 'dcl-imenu-create-index-function)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
624
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625 (make-local-variable 'dcl-comment-line-regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 (make-local-variable 'dcl-block-begin-regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 (make-local-variable 'dcl-block-end-regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628 (make-local-variable 'dcl-basic-offset)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 (make-local-variable 'dcl-continuation-offset)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 (make-local-variable 'dcl-margin-label-offset)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631 (make-local-variable 'dcl-margin-offset)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 (make-local-variable 'dcl-tab-always-indent)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 (make-local-variable 'dcl-electric-characters)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 (make-local-variable 'dcl-calc-command-indent-function)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 (make-local-variable 'dcl-calc-cont-indent-function)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 (make-local-variable 'dcl-electric-reindent-regexps)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
637
50044
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
638 ;; font lock
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
639 (make-local-variable 'font-lock-defaults)
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
640 (setq font-lock-defaults dcl-font-lock-defaults)
534fbe8d6c4b (dcl-font-lock-keywords, dcl-font-lock-defaults): New vars.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 49598
diff changeset
641
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 (setq major-mode 'dcl-mode)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 (setq mode-name "DCL")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 (use-local-map dcl-mode-map)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 (tempo-use-tag-list 'dcl-tempo-tags)
62772
f2892faa87d4 * progmodes/ada-mode.el (ada-mode):
Lute Kamstra <lute@gnu.org>
parents: 60767
diff changeset
646 (run-mode-hooks 'dcl-mode-hook))
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 ;;; *** Movement commands ***************************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 (defun dcl-beginning-of-statement ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 "Go to the beginning of the preceding or current command line."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 (re-search-backward dcl-command-regexp nil t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 (defun dcl-end-of-statement ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661 "Go to the end of the next or current command line."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 (if (or (dcl-end-of-command-p)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 (dcl-beginning-of-command-p)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 (not (dcl-command-p)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 (dcl-beginning-of-statement))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668 (re-search-forward dcl-command-regexp nil t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 (defun dcl-beginning-of-command ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 "Move point to beginning of current command."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 (let ((type (dcl-get-line-type)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 (if (and (eq type '$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 (bolp))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678 () ; already in the correct position
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 (dcl-beginning-of-statement))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683 (defun dcl-end-of-command ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 "Move point to end of current command or next command if not on a command."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 (let ((type (dcl-get-line-type))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 (start (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 (if (or (eq type '$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 (eq type '-))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 (dcl-beginning-of-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 (dcl-end-of-statement))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 (dcl-end-of-statement))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 (defun dcl-backward-command (&optional incl-comment-commands)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 "Move backward to a command.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 Move point to the preceding command line that is not a comment line,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 a command line with only a comment, only contains a `$' or only
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
701 contains a label.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 Returns point of the found command line or nil if not able to move."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 (let ((start (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 done
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 retval)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 ;; Find first non-empty command line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 (while (not done)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 ;; back up one statement and look at the command
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 (if (dcl-beginning-of-statement)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 ((and dcl-block-begin-regexp ; might be nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 (looking-at (concat "^\\$" dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715 dcl-block-begin-regexp)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 (setq done t retval (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 ((and dcl-block-end-regexp ; might be nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 (looking-at (concat "^\\$" dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719 dcl-block-end-regexp)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 (setq done t retval (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 ((looking-at dcl-comment-line-regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 t) ; comment line, one more loop
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723 ((and (not incl-comment-commands)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 (looking-at "\\$[ \t]*!"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725 t) ; comment only command, loop...
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726 ((looking-at "^\\$[ \t]*$")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727 t) ; empty line, one more loop
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728 ((not (looking-at
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
729 (concat "^\\$" dcl-ws-r dcl-label-r dcl-ws-r "$")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730 (setq done t) ; not a label-only line, exit the loop
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 (setq retval (point))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732 ;; We couldn't go further back, and we haven't found a command yet.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
733 ;; Return to the start positionn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
734 (goto-char start)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
735 (setq done t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 (setq retval nil)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 retval))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
739
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 (defun dcl-forward-command (&optional incl-comment-commands)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
742 "Move forward to a command.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743 Move point to the end of the next command line that is not a comment line,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744 a command line with only a comment, only contains a `$' or only
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
745 contains a label.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
746
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 Returns point of the found command line or nil if not able to move."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
748 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749 (let ((start (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
750 done
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
751 retval)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
752 ;; Find first non-empty command line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
753 (while (not done)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
754 ;; go forward one statement and look at the command
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
755 (if (dcl-end-of-statement)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
756 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
757 (dcl-beginning-of-statement)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
758 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
759 ((and dcl-block-begin-regexp ; might be nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
760 (looking-at (concat "^\\$" dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
761 dcl-block-begin-regexp)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
762 (setq done t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
763 (setq retval (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
764 ((and dcl-block-end-regexp ; might be nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
765 (looking-at (concat "^\\$" dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
766 dcl-block-end-regexp)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
767 (setq done t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
768 (setq retval (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
769 ((looking-at dcl-comment-line-regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
770 t) ; comment line, one more loop
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
771 ((and (not incl-comment-commands)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
772 (looking-at "\\$[ \t]*!"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773 t) ; comment only command, loop...
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
774 ((looking-at "^\\$[ \t]*$")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
775 t) ; empty line, one more loop
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
776 ((not (looking-at
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
777 (concat "^\\$" dcl-ws-r dcl-label-r dcl-ws-r "$")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
778 (setq done t) ; not a label-only line, exit the loop
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
779 (setq retval (point)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
780 ;; We couldn't go further back, and we haven't found a command yet.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
781 ;; Return to the start positionn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
782 (goto-char start)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
783 (setq done t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
784 (setq retval nil)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
785 retval))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
786
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
787
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
788 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
789 (defun dcl-back-to-indentation ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
790 "Move point to the first non-whitespace character on this line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
791 Leading $ and labels counts as whitespace in this case.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
792 If this is a comment line then move to the first non-whitespace character
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
793 in the comment.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
794
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
795 Typing \\[dcl-back-to-indentation] several times in a row will move point to other
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
796 `interesting' points closer to the left margin, and then back to the
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
797 rightmost point again.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
798
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
799 E.g. on the following line, point would go to the positions indicated
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
800 by the numbers in order 1-2-3-1-... :
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
801
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
802 $ label: command
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
803 3 2 1"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
804 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
805 (if (eq last-command 'dcl-back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
806 (dcl-back-to-indentation-1 (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
807 (dcl-back-to-indentation-1)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
808 (defun dcl-back-to-indentation-1 (&optional limit)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
809 "Helper function for dcl-back-to-indentation"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
810
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
811 ;; "Indentation points" that we will travel to
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
812 ;; $ l: ! comment
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
813 ;; 4 3 2 1
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
814 ;;
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
815 ;; $ ! text
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
816 ;; 3 2 1
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
817 ;;
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
818 ;; $ l: command !
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
819 ;; 3 2 1
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
820 ;;
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
821 ;; text
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
822 ;; 1
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
823
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
824 (let* ((default-limit (save-excursion (end-of-line) (1+ (point))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
825 (limit (or limit default-limit))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
826 (last-good-point (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
827 (opoint (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
828 ;; Move over blanks
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
829 (back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
830
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
831 ;; If we already were at the outermost indentation point then we
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
832 ;; start searching for the innermost point again.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
833 (if (= (point) opoint)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
834 (setq limit default-limit))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
835
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
836 (if (< (point) limit)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
837 (setq last-good-point (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
838
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
839 (cond
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
840 ;; Special treatment for comment lines. We are trying to allow
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
841 ;; things like "$ !*" as comment lines.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
842 ((looking-at dcl-comment-line-regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
843 (re-search-forward (concat dcl-comment-line-regexp "[ \t]*") limit t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
844 (if (< (point) limit)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
845 (setq last-good-point (point))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
846
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
847 ;; Normal command line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
848 ((looking-at "^\\$[ \t]*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
849 ;; Move over leading "$" and blanks
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
850 (re-search-forward "^\\$[ \t]*" limit t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
851 (if (< (point) limit)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
852 (setq last-good-point (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
853
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
854 ;; Move over a label (if it isn't a block begin/end)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
855 ;; We must treat block begin/end labels as commands because
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
856 ;; dcl-set-option relies on it.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
857 (if (and (looking-at dcl-label-r)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
858 (not (or (and dcl-block-begin-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859 (looking-at dcl-block-begin-regexp))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
860 (and dcl-block-end-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
861 (looking-at dcl-block-end-regexp)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
862 (re-search-forward (concat dcl-label-r "[ \t]*") limit t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
863 (if (< (point) limit)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
864 (setq last-good-point (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
865
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
866 ;; Move over the beginning of a comment
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
867 (if (looking-at "![ \t]*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
868 (re-search-forward "![ \t]*" limit t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
869 (if (< (point) limit)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
870 (setq last-good-point (point)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
871 (goto-char last-good-point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
872
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
873
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
874 ;;; *** Support for indentation *********************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
875
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
876
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
877 (defun dcl-get-line-type ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
878 "Determine the type of the current line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
879 Returns one of the following symbols:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
880 $ for a complete command line or the beginning of a command line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
881 - for a continuation line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
882 $! for a comment line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
883 data for a data line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
884 empty-data for an empty line following a data line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
885 empty-$ for an empty line following a command line"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
886 (or
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
887 ;; Check if it's a comment line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
888 ;; A comment line starts with $!
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
889 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
890 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
891 (if (looking-at dcl-comment-line-regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
892 '$!))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
893 ;; Check if it's a command line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
894 ;; A command line starts with $
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
895 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
896 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
897 (if (looking-at "^\\$")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
898 '$))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
899 ;; Check if it's a continuation line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
900 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
901 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
902 ;; If we're at the beginning of the buffer it can't be a continuation
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
903 (if (bobp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
904 ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
905 (let ((opoint (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
906 (dcl-beginning-of-statement)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
907 (re-search-forward dcl-command-regexp opoint t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
908 (if (>= (point) opoint)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
909 '-))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
910 ;; Empty lines might be different things
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
911 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
912 (if (and (bolp) (eolp))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
913 (if (bobp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
914 'empty-$
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
915 (forward-line -1)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
916 (let ((type (dcl-get-line-type)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
917 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
918 ((or (equal type '$) (equal type '$!) (equal type '-))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
919 'empty-$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
920 ((equal type 'data)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
921 'empty-data))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
922 ;; Anything else must be a data line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
923 (progn 'data)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
924 ))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
925
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
926
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
927 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
928 (defun dcl-indentation-point ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
929 "Return point of first non-`whitespace' on this line."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
930 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
931 (dcl-back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
932 (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
933
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
934
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
935 ;;;---------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
936 (defun dcl-show-line-type ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
937 "Test dcl-get-line-type."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
938 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
939 (let ((type (dcl-get-line-type)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
940 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
941 ((equal type '$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
942 (message "command line"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
943 ((equal type '\?)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
944 (message "?"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
945 ((equal type '$!)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
946 (message "comment line"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
947 ((equal type '-)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
948 (message "continuation line"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
949 ((equal type 'data)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
950 (message "data"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
951 ((equal type 'empty-data)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
952 (message "empty-data"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
953 ((equal type 'empty-$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
954 (message "empty-$"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
955 (t
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
956 (message "hupp"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
957 )))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
958
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
959
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
960 ;;; *** Perform indentation *************************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
961
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
962
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
963 ;;;---------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
964 (defun dcl-calc-command-indent-multiple
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
965 (indent-type cur-indent extra-indent last-point this-point)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
966 "Indent lines to a multiple of dcl-basic-offset.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
967
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
968 Set dcl-calc-command-indent-function to this function to customize
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
969 indentation of command lines.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
970
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
971 Command lines that need to be indented beyond the left margin are
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
972 always indented to a column that is a multiple of dcl-basic-offset, as
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
973 if tab stops were set at 4, 8, 12, etc.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
974
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
975 This supports a formatting style like this (dcl-margin offset = 2,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
976 dcl-basic-offset = 4):
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
977
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
978 $ if cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
979 $ then
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
980 $ if cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
981 $ then
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
982 $ ! etc
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
983 "
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
984 ;; calculate indentation if it's an interesting indent-type,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
985 ;; otherwise return nil to get the default indentation
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
986 (let ((indent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
987 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
988 ((equal indent-type 'indent)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
989 (setq indent (- cur-indent (% cur-indent dcl-basic-offset)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
990 (setq indent (+ indent extra-indent))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
991
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
992
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
993 ;;;---------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
994 ;; Some people actually writes likes this. To each his own...
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
995 (defun dcl-calc-command-indent-hang
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
996 (indent-type cur-indent extra-indent last-point this-point)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
997 "Indent lines as default, but indent THEN, ELSE and ENDIF extra.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
998
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
999 Set dcl-calc-command-indent-function to this function to customize
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1000 indentation of command lines.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1001
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1002 This function supports a formatting style like this:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1003
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1004 $ if cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1005 $ then
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1006 $ xxx
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1007 $ endif
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1008 $ xxx
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1009
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1010 If you use this function you will probably want to add \"then\" to
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1011 dcl-electric-reindent-regexps and define the key \"n\" as
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1012 dcl-electric-character.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1013 "
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1014 (let ((case-fold-search t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1015 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1016 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1017 ;; No indentation, this word is `then': +2
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1018 ;; last word was endif: -2
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1019 ((null indent-type)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1020 (or (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1021 (goto-char this-point)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1022 (if (looking-at "\\bthen\\b")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1023 (+ cur-indent extra-indent 2)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1024 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1025 (goto-char last-point)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1026 (if (looking-at "\\bendif\\b")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1027 (- (+ cur-indent extra-indent) 2)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1028 ;; Indentation, last word was `then' or `else': -2
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1029 ((equal indent-type 'indent)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1030 (goto-char last-point)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1031 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1032 ((looking-at "\\bthen\\b")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1033 (- (+ cur-indent extra-indent) 2))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1034 ((looking-at "\\belse\\b")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1035 (- (+ cur-indent extra-indent) 2))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1036 ;; Outdent, this word is `endif' or `else': + 2
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1037 ((equal indent-type 'outdent)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1038 (goto-char this-point)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1039 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1040 ((looking-at "\\bendif\\b")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1041 (+ cur-indent extra-indent 2))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1042 ((looking-at "\\belse\\b")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1043 (+ cur-indent extra-indent 2))))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1044
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1045
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1046 ;;;---------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1047 (defun dcl-calc-command-indent ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1048 "Calculate how much the current line shall be indented.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1049 The line is known to be a command line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1050
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1051 Find the indentation of the preceding line and analyze its contents to
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1052 see if the current lines should be indented.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1053 Analyze the current line to see if it should be `outdented'.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1054
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1055 Calculate the indentation of the current line, either with the default
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1056 method or by calling dcl-calc-command-indent-function if it is
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1057 non-nil.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1058
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1059 If the current line should be outdented, calculate its indentation,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1060 either with the default method or by calling
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1061 dcl-calc-command-indent-function if it is non-nil.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1062
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1063
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1064 Rules for default indentation:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1065
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1066 If it is the first line in the buffer, indent dcl-margin-offset.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1067
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1068 Go to the previous command line with a command on it.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1069 Find out how much it is indented (cur-indent).
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1070 Look at the first word on the line to see if the indentation should be
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1071 adjusted. Skip margin-label, continuations and comments while looking for
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1072 the first word. Save this buffer position as `last-point'.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1073 If the first word after a label is SUBROUTINE, set extra-indent to
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1074 dcl-margin-offset.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1075
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1076 First word extra-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1077 THEN +dcl-basic-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1078 ELSE +dcl-basic-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1079 block-begin +dcl-basic-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1080
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1081 Then return to the current line and look at the first word to see if the
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1082 indentation should be adjusted again. Save this buffer position as
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1083 `this-point'.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1084
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1085 First word extra-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1086 ELSE -dcl-basic-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1087 ENDIF -dcl-basic-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1088 block-end -dcl-basic-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1089
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1090
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1091 If dcl-calc-command-indent-function is nil or returns nil set
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1092 cur-indent to cur-indent+extra-indent.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1093
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1094 If an extra adjustment is necessary and if
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1095 dcl-calc-command-indent-function is nil or returns nil set cur-indent
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1096 to cur-indent+extra-indent.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1097
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1098 See also documentation for dcl-calc-command-indent-function.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1099 The indent-type classification could probably be expanded upon.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1100 "
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1101 ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1102 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1103 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1104 (let ((is-block nil)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1105 (case-fold-search t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1106 cur-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1107 (extra-indent 0)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1108 indent-type last-point this-point extra-indent2 cur-indent2
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1109 indent-type2)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1110 (if (bobp) ; first line in buffer
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1111 (setq cur-indent 0 extra-indent dcl-margin-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1112 indent-type 'first-line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1113 this-point (dcl-indentation-point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1114 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1115 (let (done)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1116 ;; Find first non-empty command line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1117 (while (not done)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1118 ;; back up one statement and look at the command
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1119 (if (dcl-beginning-of-statement)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1120 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1121 ((and dcl-block-begin-regexp ; might be nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1122 (looking-at (concat "^\\$" dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1123 dcl-block-begin-regexp)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1124 (setq done t) (setq is-block t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1125 ((and dcl-block-end-regexp ; might be nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1126 (looking-at (concat "^\\$" dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1127 dcl-block-end-regexp)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1128 (setq done t) (setq is-block t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1129 ((looking-at dcl-comment-line-regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1130 t) ; comment line, one more loop
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1131 ((looking-at "^\\$[ \t]*$")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1132 t) ; empty line, one more loop
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1133 ((not (looking-at
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1134 (concat "^\\$" dcl-ws-r dcl-label-r dcl-ws-r "$")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1135 (setq done t))) ; not a label-only line, exit the loop
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1136 ;; We couldn't go further back, so this must have been the
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1137 ;; first line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1138 (setq cur-indent dcl-margin-offset
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1139 last-point (dcl-indentation-point))
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1140 (setq done t)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1141 ;; Examine the line to get current indentation and possibly a
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1142 ;; reason to indent.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1143 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1144 (cur-indent)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1145 ((looking-at (concat "^\\$[ \t]*" dcl-label-r dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1146 "\\(subroutine\\b\\)"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1147 (setq cur-indent dcl-margin-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1148 last-point (1+ (match-beginning 1))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1149 (t
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1150 ;; Find out how much this line is indented.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1151 ;; Look at comment, continuation character, command but not label
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1152 ;; unless it's a block.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1153 (if is-block
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1154 (re-search-forward "^\\$[ \t]*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1155 (re-search-forward (concat "^\\$[ \t]*\\(" dcl-label-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1156 "\\)*[ \t]*")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1157 (setq cur-indent (current-column))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1158 ;; Look for a reason to indent: Find first word on this line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1159 (re-search-forward dcl-ws-r)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1160 (setq last-point (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1161 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1162 ((looking-at "\\bthen\\b")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1163 (setq extra-indent dcl-basic-offset indent-type 'indent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1164 ((looking-at "\\belse\\b")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1165 (setq extra-indent dcl-basic-offset indent-type 'indent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1166 ((and dcl-block-begin-regexp ; might be nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1167 (looking-at dcl-block-begin-regexp))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1168 (setq extra-indent dcl-basic-offset indent-type 'indent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1169 ))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1170 (setq extra-indent2 0)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1171 ;; We're back at the beginning of the original line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1172 ;; Look for a reason to outdent: Find first word on this line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1173 (re-search-forward (concat "^\\$" dcl-ws-r))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1174 (setq this-point (dcl-indentation-point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1175 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1176 ((looking-at "\\belse\\b")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1177 (setq extra-indent2 (- dcl-basic-offset) indent-type2 'outdent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1178 ((looking-at "\\bendif\\b")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1179 (setq extra-indent2 (- dcl-basic-offset) indent-type2 'outdent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1180 ((and dcl-block-end-regexp ; might be nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1181 (looking-at dcl-block-end-regexp))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1182 (setq extra-indent2 (- dcl-basic-offset) indent-type2 'outdent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1183 ((looking-at (concat dcl-label-r dcl-ws-r "\\(subroutine\\b\\)"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1184 (setq cur-indent2 0 extra-indent2 dcl-margin-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1185 indent-type2 'first-line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1186 this-point (1+ (match-beginning 1)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1187 ;; Calculate indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1188 (setq cur-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1189 (or (and dcl-calc-command-indent-function
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1190 (funcall dcl-calc-command-indent-function
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1191 indent-type cur-indent extra-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1192 last-point this-point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1193 (+ cur-indent extra-indent)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1194 ;; Calculate outdent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1195 (if indent-type2
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1196 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1197 (or cur-indent2 (setq cur-indent2 cur-indent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1198 (setq cur-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1199 (or (and dcl-calc-command-indent-function
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1200 (funcall dcl-calc-command-indent-function
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1201 indent-type2 cur-indent2 extra-indent2
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1202 last-point this-point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1203 (+ cur-indent2 extra-indent2)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1204 cur-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1205 )))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1206
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1207
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1208 ;;;---------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1209 (defun dcl-calc-cont-indent-relative (cur-indent extra-indent)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1210 "Indent continuation lines to align with words on previous line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1211
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1212 Indent continuation lines to a position relative to preceding
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1213 significant command line elements.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1214
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1215 Set `dcl-calc-cont-indent-function' to this function to customize
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1216 indentation of continuation lines.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1217
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1218 Indented lines will align with either:
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1219
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1220 * the second word on the command line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1221 $ set default -
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1222 [-]
47126
5a5a4566e9f7 (dcl-calc-cont-indent-relative): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 41608
diff changeset
1223 * the word after an assignment
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1224 $ a = b + -
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1225 d
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1226 * the third word if it's a qualifier
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1227 $ set terminal/width=80 -
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1228 /page=24
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1229 * the innermost nonclosed parenthesis
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1230 $ if ((a.eq.b .and. -
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1231 d.eq.c .or. f$function(xxxx, -
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1232 yyy)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1233 "
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1234 (let ((case-fold-search t)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1235 indent)
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1236 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1237 (dcl-beginning-of-statement)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1238 (let ((end (save-excursion (forward-line 1) (point))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1239 ;; Move over blanks and label
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1240 (if (re-search-forward (concat "^\\$[ \t]*\\(" dcl-label-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1241 "\\)*[ \t]*") end t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1242 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1243 ;; Move over the first word (might be `@filespec')
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1244 (if (> (skip-chars-forward "@:[]<>$\\-a-zA-Z0-9_.;" end) 0)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1245 (let (was-assignment)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1246 (skip-chars-forward " \t" end)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1247 ;; skip over assignment if there is one
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1248 (if (looking-at ":?==?")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1249 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1250 (setq was-assignment t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1251 (skip-chars-forward " \t:=" end)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1252 ;; This could be the position to indent to
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1253 (setq indent (current-column))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1254
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1255 ;; Move to the next word unless we have seen an
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1256 ;; assignment. If it starts with `/' it's a
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1257 ;; qualifier and we will indent to that position
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1258 (if (and (not was-assignment)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1259 (> (skip-chars-forward "a-zA-Z0-9_" end) 0))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1260 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1261 (skip-chars-forward " \t" end)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1262 (if (= (char-after (point)) ?/)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1263 (setq indent (current-column)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1264 ))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1265 ;; Now check if there are any parenthesis to adjust to.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1266 ;; If there is, we will indent to the position after the last non-closed
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1267 ;; opening parenthesis.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1268 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1269 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1270 (let* ((start (save-excursion (dcl-beginning-of-statement) (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1271 (parse-sexp-ignore-comments t) ; for parse-partial
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1272 (par-pos (nth 1 (parse-partial-sexp start (point)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1273 (if par-pos ; is nil if no parenthesis was found
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1274 (setq indent (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1275 (goto-char par-pos)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1276 (1+ (current-column)))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1277 indent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1278
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1279
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1280 ;;;---------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1281 (defun dcl-calc-continuation-indent ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1282 "Calculate how much the current line shall be indented.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1283 The line is known to be a continuation line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1284
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1285 Go to the previous command line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1286 Find out how much it is indented."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1287 ;; This was copied without much thought from dcl-calc-command-indent, so
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1288 ;; it's a bit clumsy.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1289 ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1290 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1291 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1292 (if (bobp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1293 ;; Huh? a continuation line first in the buffer??
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1294 dcl-margin-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1295 (let ((is-block nil)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1296 (indent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1297 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1298 ;; Find first non-empty command line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1299 (let ((done))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1300 (while (not done)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1301 (if (dcl-beginning-of-statement)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1302 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1303 ((and dcl-block-begin-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1304 (looking-at (concat "^\\$" dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1305 dcl-block-begin-regexp)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1306 (setq done t) (setq is-block t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1307 ((and dcl-block-end-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1308 (looking-at (concat "^\\$" dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1309 dcl-block-end-regexp)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1310 (setq done t) (setq is-block t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1311 ((looking-at dcl-comment-line-regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1312 t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1313 ((looking-at "^\\$[ \t]*$")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1314 t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1315 ((not (looking-at
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1316 (concat "^\\$" dcl-ws-r dcl-label-r dcl-ws-r "$")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1317 (setq done t)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1318 ;; This must have been the first line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1319 (setq indent dcl-margin-offset)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1320 (setq done t)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1321 (if indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1322 ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1323 ;; Find out how much this line is indented.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1324 ;; Look at comment, continuation character, command but not label
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1325 ;; unless it's a block.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1326 (if is-block
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1327 (re-search-forward "^\\$[ \t]*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1328 (re-search-forward (concat "^\\$[ \t]*\\(" dcl-label-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1329 "\\)*[ \t]*")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1330 (setq indent (current-column))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1331 )))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1332 ;; We're back at the beginning of the original line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1333 (or (and dcl-calc-cont-indent-function
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1334 (funcall dcl-calc-cont-indent-function indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1335 dcl-continuation-offset))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1336 (+ indent dcl-continuation-offset))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1337 ))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1338
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1339
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1340 ;;;---------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1341 (defun dcl-indent-command-line ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1342 "Indent a line known to be a command line."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1343 (let ((indent (dcl-calc-command-indent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1344 (pos (- (point-max) (point))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1345 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1346 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1347 (re-search-forward "^\\$[ \t]*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1348 ;; Indent any margin-label if the offset is set
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1349 ;; (Don't look at block labels)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1350 (if (and dcl-margin-label-offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1351 (looking-at dcl-label-r)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1352 (not (and dcl-block-begin-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1353 (looking-at dcl-block-begin-regexp)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1354 (not (and dcl-block-end-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1355 (looking-at dcl-block-end-regexp))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1356 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1357 (dcl-indent-to dcl-margin-label-offset)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1358 (re-search-forward dcl-label-r)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1359 (dcl-indent-to indent 1)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1360 )
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1361 ;;
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1362 (if (> (- (point-max) pos) (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1363 (goto-char (- (point-max) pos)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1364 ))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1365
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1366
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1367 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1368 (defun dcl-indent-continuation-line ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1369 "Indent a line known to be a continuation line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1370
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1371 Notice that no special treatment is made for labels. They have to be
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1372 on the first part on a command line to be taken into consideration."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1373 (let ((indent (dcl-calc-continuation-indent)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1374 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1375 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1376 (re-search-forward "^[ \t]*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1377 (dcl-indent-to indent))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1378 (skip-chars-forward " \t")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1379
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1380
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1381 ;;;---------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1382 (defun dcl-delete-chars (chars)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1383 "Delete all characters in the set CHARS around point."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1384 (skip-chars-backward chars)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1385 (delete-region (point) (progn (skip-chars-forward chars) (point))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1386
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1387
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1388 ;;;---------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1389 (defun dcl-indent-line ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1390 "The DCL version of `indent-line-function'.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1391 Adjusts indentation on the current line. Data lines are not indented."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1392 (let ((type (dcl-get-line-type)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1393 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1394 ((equal type '$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1395 (dcl-indent-command-line))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1396 ((equal type '\?)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1397 (message "Unknown line type!"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1398 ((equal type '$!))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1399 ((equal type 'data))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1400 ((equal type 'empty-data))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1401 ((equal type '-)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1402 (dcl-indent-continuation-line))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1403 ((equal type 'empty-$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1404 (insert "$" )
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1405 (dcl-indent-command-line))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1406 (t
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1407 (message "dcl-indent-line: unknown type"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1408 )))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1409
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1410
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1411 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1412 (defun dcl-indent-command ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1413 "Indents the complete command line that point is on.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1414 This includes continuation lines."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1415 (interactive "*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1416 (let ((type (dcl-get-line-type)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1417 (if (or (equal type '$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1418 (equal type '-)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1419 (equal type 'empty-$))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1420 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1421 (indent-region (progn (or (looking-at "^\\$")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1422 (dcl-beginning-of-statement))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1423 (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1424 (progn (dcl-end-of-statement) (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1425 nil)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1426
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1427
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1428 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1429 (defun dcl-tab ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1430 "Insert tab in data lines or indent code.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1431 If `dcl-tab-always-indent' is t, code lines are always indented.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1432 If nil, indent the current line only if point is at the left margin or in
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1433 the lines indentation; otherwise insert a tab."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1434 (interactive "*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1435 (let ((type (dcl-get-line-type))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1436 (start-point (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1437 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1438 ;; Data line : always insert tab
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1439 ((or (equal type 'data) (equal type 'empty-data))
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1440 (tab-to-tab-stop))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1441 ;; Indent only at start of line
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1442 ((not dcl-tab-always-indent) ; nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1443 (let ((search-end-point
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1444 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1445 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1446 (re-search-forward "^\\$?[ \t]*" start-point t))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1447 (if (or (bolp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1448 (and search-end-point
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1449 (>= search-end-point start-point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1450 (dcl-indent-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1451 (tab-to-tab-stop))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1452 ;; Always indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1453 ((eq dcl-tab-always-indent t) ; t
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1454 (dcl-indent-line))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1455 )))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1456
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1457
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1458 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1459 (defun dcl-electric-character (arg)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1460 "Inserts a character and indents if necessary.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1461 Insert a character if the user gave a numeric argument or the flag
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1462 `dcl-electric-characters' is not set. If an argument was given,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1463 insert that many characters.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1464
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1465 The line is only reindented if the word just typed matches any of the
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1466 regexps in `dcl-electric-reindent-regexps'."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1467 (interactive "*P")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1468 (if (or arg (not dcl-electric-characters))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1469 (if arg
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1470 (self-insert-command (prefix-numeric-value arg))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1471 (self-insert-command 1))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1472 ;; Insert the character and indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1473 (self-insert-command 1)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1474 (let ((case-fold-search t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1475 ;; There must be a better way than (memq t ...).
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1476 ;; (apply 'or ...) didn't work
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1477 (if (memq t (mapcar 'dcl-was-looking-at dcl-electric-reindent-regexps))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1478 (dcl-indent-line)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1479
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1480
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1481 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1482 (defun dcl-indent-to (col &optional minimum)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1483 "Like indent-to, but only indents if indentation would change"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1484 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1485 (let (cur-indent collapsed indent)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1486 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1487 (skip-chars-forward " \t")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1488 (setq cur-indent (current-column))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1489 (skip-chars-backward " \t")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1490 (setq collapsed (current-column)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1491 (setq indent (max col (+ collapsed (or minimum 0))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1492 (if (/= indent cur-indent)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1493 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1494 (dcl-delete-chars " \t")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1495 (indent-to col minimum)))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1496
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1497
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1498 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1499 (defun dcl-split-line ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1500 "Break line at point and insert text to keep the syntax valid.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1501
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1502 Inserts continuation marks and splits character strings."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1503 ;; Still don't know what to do with comments at the end of a command line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1504 (interactive "*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1505 (let (done
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1506 (type (dcl-get-line-type)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1507 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1508 ((or (equal type '$) (equal type '-))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1509 (let ((info (parse-partial-sexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1510 (save-excursion (dcl-beginning-of-statement) (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1511 (point))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1512 ;; handle some special cases
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1513 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1514 ((nth 3 info) ; in text constant
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1515 (insert "\" + -\n\"")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1516 (indent-according-to-mode)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1517 (setq done t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1518 ((not (nth 4 info)) ; not in comment
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1519 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1520 ((and (not (eolp))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1521 (= (char-after (point)) ?\")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1522 (= (char-after (1- (point))) ?\"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1523 (progn ; a " "" " situation
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1524 (forward-char -1)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1525 (insert "\" + -\n\"")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1526 (forward-char 1)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1527 (indent-according-to-mode)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1528 (setq done t)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1529 ((and (dcl-was-looking-at "[ \t]*-[ \t]*") ; after cont mark
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1530 (looking-at "[ \t]*\\(!.*\\)?$"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1531 ;; Do default below. This might considered wrong if we're
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1532 ;; after a subtraction: $ x = 3 - <M-LFD>
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1533 )
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1534 (t
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1535 (delete-horizontal-space)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1536 (insert " -")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1537 (insert "\n") (indent-according-to-mode)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1538 (setq done t))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1539 ))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1540 ;; use the normal function for other cases
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1541 (if (not done) ; normal M-LFD action
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1542 (indent-new-comment-line))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1543
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1544
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1545 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1546 (defun dcl-delete-indentation (&optional arg)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1547 "Join this line to previous like delete-indentation.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1548 Also remove the continuation mark if easily detected."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1549 (interactive "*P")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1550 (delete-indentation arg)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1551 (let ((type (dcl-get-line-type)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1552 (if (and (or (equal type '$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1553 (equal type '-)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1554 (equal type 'empty-$))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1555 (not (bobp))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1556 (= (char-after (1- (point))) ?-))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1557 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1558 (delete-backward-char 1)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1559 (fixup-whitespace)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1560
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1561
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1562 ;;; *** Set options *********************************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1563
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1564
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1565 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1566 (defun dcl-option-value-basic (option-assoc)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1567 "Guess a value for basic-offset."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1568 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1569 (dcl-beginning-of-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1570 (let* (;; current lines indentation
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1571 (this-indent (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1572 (dcl-back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1573 (current-column)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1574 ;; previous lines indentation
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1575 (prev-indent (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1576 (if (dcl-backward-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1577 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1578 (dcl-back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1579 (current-column)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1580 (next-indent (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1581 (dcl-end-of-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1582 (if (dcl-forward-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1583 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1584 (dcl-beginning-of-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1585 (dcl-back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1586 (current-column)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1587 (diff (if prev-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1588 (abs (- this-indent prev-indent)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1589 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1590 ((and diff
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1591 (/= diff 0))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1592 diff)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1593 ((and next-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1594 (/= (- this-indent next-indent) 0))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1595 (abs (- this-indent next-indent)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1596 (t
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1597 dcl-basic-offset)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1598
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1599
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1600 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1601 (defun dcl-option-value-offset (option-assoc)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1602 "Guess a value for an offset.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1603 Find the column of the first non-blank character on the line.
17261
15216759d2a4 Minor doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 17252
diff changeset
1604 Returns the column offset."
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1605 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1606 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1607 (re-search-forward "^$[ \t]*" nil t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1608 (current-column)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1609
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1610
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1611 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1612 (defun dcl-option-value-margin-offset (option-assoc)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1613 "Guess a value for margin offset.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1614 Find the column of the first non-blank character on the line, not
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1615 counting labels.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1616 Returns a number as a string."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1617 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1618 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1619 (dcl-back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1620 (current-column)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1621
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1622
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1623 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1624 (defun dcl-option-value-comment-line (option-assoc)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1625 "Guess a value for `dcl-comment-line-regexp'.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1626 Must return a string."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1627 ;; Should we set comment-start and comment-start-skip as well?
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1628 ;; If someone wants `$!&' as a comment line, C-M-j won't work well if
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1629 ;; they aren't set.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1630 ;; This must be done after the user has given the real value in
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1631 ;; dcl-set-option.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1632 (format
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1633 "%S"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1634 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1635 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1636 ;; We could search for "^\\$.*!+[^ \t]*", but, as noted above, we
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1637 ;; can't handle that case very good, so there is no point in
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1638 ;; suggesting it.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1639 (if (looking-at "^\\$[^!\n]*!")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1640 (let ((regexp (buffer-substring (match-beginning 0) (match-end 0))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1641 (concat "^" (regexp-quote regexp)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1642 dcl-comment-line-regexp))))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1643
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1644
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1645 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1646 (defun dcl-guess-option-value (option)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1647 "Guess what value the user would like to give the symbol option."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1648 (let* ((option-assoc (assoc option dcl-option-alist))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1649 (option (car option-assoc))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1650 (action (car (cdr option-assoc)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1651 (value (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1652 ((fboundp action)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1653 (funcall action option-assoc))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1654 ((eq action 'toggle)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1655 (not (eval option)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1656 ((eq action 'curval)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1657 (cond ((or (stringp (symbol-value option))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1658 (numberp (symbol-value option)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1659 (format "%S" (symbol-value option)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1660 (t
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1661 (format "'%S" (symbol-value option))))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1662 ;; format the value as a string if not already done
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1663 (if (stringp value)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1664 value
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1665 (format "%S" value))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1666
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1667
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1668 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1669 (defun dcl-guess-option ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1670 "Guess what option the user wants to set by looking around in the code.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1671 Returns the name of the option variable as a string."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1672 (let ((case-fold-search t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1673 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1674 ;; Continued line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1675 ((eq (dcl-get-line-type) '-)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1676 "dcl-calc-cont-indent-function")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1677 ;; Comment line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1678 ((save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1679 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1680 (looking-at "^\\$[ \t]*!"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1681 "dcl-comment-line-regexp")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1682 ;; Margin offset: subroutine statement or first line in buffer
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1683 ;; Test this before label indentation to detect a subroutine
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1684 ((save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1685 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1686 (or (looking-at (concat "^\\$[ \t]*" dcl-label-r dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1687 "subroutine"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1688 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1689 (not (dcl-backward-command t)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1690 "dcl-margin-offset")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1691 ;; Margin offset: on command line after subroutine statement
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1692 ((save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1693 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1694 (and (eq (dcl-get-line-type) '$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1695 (dcl-backward-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1696 (looking-at (concat "^\\$[ \t]*" dcl-label-r dcl-ws-r
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1697 "subroutine"))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1698 "dcl-margin-offset")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1699 ;; Label indentation
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1700 ((save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1701 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1702 (and (looking-at (concat "^\\$[ \t]*" dcl-label-r))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1703 (not (and dcl-block-begin-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1704 (looking-at (concat "^\\$[ \t]*"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1705 dcl-block-begin-regexp))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1706 (not (and dcl-block-end-regexp
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1707 (looking-at (concat "^\\$[ \t]*"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1708 dcl-block-end-regexp))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1709 "dcl-margin-label-offset")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1710 ;; Basic offset
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1711 ((and (eq (dcl-get-line-type) '$) ; beginning of command
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1712 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1713 (beginning-of-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1714 (let* ((this-indent (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1715 (dcl-back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1716 (current-column)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1717 (prev-indent (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1718 (if (dcl-backward-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1719 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1720 (dcl-back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1721 (current-column)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1722 (next-indent (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1723 (dcl-end-of-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1724 (if (dcl-forward-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1725 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1726 (dcl-beginning-of-command)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1727 (dcl-back-to-indentation)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1728 (current-column))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1729 (or (and prev-indent ; last cmd is indented differently
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1730 (/= (- this-indent prev-indent) 0))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1731 (and next-indent
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1732 (/= (- this-indent next-indent) 0))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1733 "dcl-basic-offset")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1734 ;; No more guesses.
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1735 (t
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1736 ""))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1737
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1738
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1739 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1740 (defun dcl-set-option (option-sym option-value)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1741 "Set a value for one of the dcl customization variables.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1742 The function tries to guess which variable should be set and to what value.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1743 All variable names are available as completions and in the history list."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1744 (interactive
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1745 (let* ((option-sym
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1746 (intern (completing-read
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1747 "Set DCL option: " ; prompt
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1748 (mapcar (function ; alist of valid values
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1749 (lambda (option-assoc)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1750 (cons (format "%s" (car option-assoc)) nil)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1751 dcl-option-alist)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1752 nil ; no predicate
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1753 t ; only value from the list OK
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1754 (dcl-guess-option) ; initial (default) value
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1755 'dcl-option-history))) ; history list
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1756 (option-value
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1757 (eval-minibuffer
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1758 (format "Set DCL option %s to: " option-sym)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1759 (dcl-guess-option-value option-sym))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1760 (list option-sym option-value)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1761 ;; Should make a sanity check on the symbol/value pair.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1762 ;; `set' instead of `setq' because we want option-sym to be evaluated.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1763 (set option-sym option-value))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1764
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1765
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1766 ;;; *** Save options ********************************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1767
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1768
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1769 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1770 (defun dcl-save-local-variable (var &optional def-prefix def-suffix)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1771 "Save a variable in a `Local Variables' list.
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1772 Set or update the value of VAR in the current buffers
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1773 `Local Variables:' list."
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1774 ;; Look for "Local variables:" line in last page.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1775 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1776 (goto-char (point-max))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1777 (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1778 (if (let ((case-fold-search t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1779 (search-forward "Local Variables:" nil t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1780 (let ((continue t)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1781 prefix prefixlen suffix beg
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1782 prefix-string suffix-string)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1783 ;; The prefix is what comes before "local variables:" in its line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1784 ;; The suffix is what comes after "local variables:" in its line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1785 (skip-chars-forward " \t")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1786 (or (eolp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1787 (setq suffix-string (buffer-substring (point)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1788 (progn (end-of-line) (point)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1789 (goto-char (match-beginning 0))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1790 (or (bolp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1791 (setq prefix-string
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1792 (buffer-substring (point)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1793 (progn (beginning-of-line) (point)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1794
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1795 (if prefix-string (setq prefixlen (length prefix-string)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1796 prefix (regexp-quote prefix-string)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1797 (if suffix-string (setq suffix (concat (regexp-quote suffix-string)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1798 "$")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1799 (while continue
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1800 ;; Look at next local variable spec.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1801 (if selective-display (re-search-forward "[\n\C-m]")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1802 (forward-line 1))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1803 ;; Skip the prefix, if any.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1804 (if prefix
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1805 (if (looking-at prefix)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1806 (forward-char prefixlen)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1807 (error "Local variables entry is missing the prefix")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1808 ;; Find the variable name; strip whitespace.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1809 (skip-chars-forward " \t")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1810 (setq beg (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1811 (skip-chars-forward "^:\n")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1812 (if (eolp) (error "Missing colon in local variables entry"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1813 (skip-chars-backward " \t")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1814 (let* ((str (buffer-substring beg (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1815 (found-var (read str))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1816 val)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1817 ;; Setting variable named "end" means end of list.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1818 (if (string-equal (downcase str) "end")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1819 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1820 ;; Not found. Insert a new entry before this line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1821 (setq continue nil)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1822 (beginning-of-line)
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1823 (insert (concat prefix-string (symbol-name var) ": "
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1824 (prin1-to-string (eval var)) " "
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1825 suffix-string "\n")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1826 ;; Is it the variable we are looking for?
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1827 (if (eq var found-var)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1828 (progn
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1829 ;; Found it: delete the variable value and insert the
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1830 ;; new value.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1831 (setq continue nil)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1832 (skip-chars-forward "^:")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1833 (forward-char 1)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1834 (delete-region (point) (progn (read (current-buffer))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1835 (point)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1836 (insert " ")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1837 (prin1 (eval var) (current-buffer))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1838 (skip-chars-backward "\n")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1839 (skip-chars-forward " \t")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1840 (or (if suffix (looking-at suffix) (eolp))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1841 (error
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1842 "Local variables entry is terminated incorrectly")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1843 (end-of-line))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1844 ;; Did not find "Local variables:"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1845 (goto-char (point-max))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1846 (if (not (bolp))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1847 (insert "\n"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1848 ;; If def- parameter not set, use comment- if set. In that case, make
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1849 ;; sure there is a space in a suitable position
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1850 (let ((def-prefix
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1851 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1852 (def-prefix
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1853 def-prefix)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1854 (comment-start
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1855 (if (or (equal comment-start "")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1856 (string-match "[ \t]$" comment-start))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1857 comment-start
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1858 (concat comment-start " ")))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1859 (def-suffix
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1860 (cond
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1861 (def-suffix
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1862 def-suffix)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1863 (comment-end
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1864 (if (or (equal comment-end "")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1865 (string-match "^[ \t]" comment-end))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1866 comment-end
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1867 (concat " " comment-end))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1868 (insert (concat def-prefix "Local variables:" def-suffix "\n"))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1869 (insert (concat def-prefix (symbol-name var) ": "
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1870 (prin1-to-string (eval var)) def-suffix "\n"))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1871 (insert (concat def-prefix "end:" def-suffix)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1872 )))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1873
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1874
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1875 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1876 (defun dcl-save-all-options ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1877 "Save all dcl-mode options for this buffer.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1878 Saves or updates all dcl-mode related options in a `Local Variables:'
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1879 section at the end of the current buffer."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1880 (interactive "*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1881 (mapcar (lambda (option-assoc)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1882 (let* ((option (car option-assoc)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1883 (dcl-save-local-variable option "$! ")))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1884 dcl-option-alist))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1885
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1886
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1887 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1888 (defun dcl-save-nondefault-options ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1889 "Save changed DCL mode options for this buffer.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1890 Saves or updates all DCL mode related options that don't have their
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1891 default values in a `Local Variables:' section at the end of the
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1892 current buffer.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1893
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1894 No entries are removed from the `Local Variables:' section. This means
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1895 that if a variable is given a non-default value in the section and
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1896 later is manually reset to its default value, the variable's entry will
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1897 still be present in the `Local Variables:' section with its old value."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1898 (interactive "*")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1899 (mapcar (lambda (option-assoc)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1900 (let* ((option (car option-assoc))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1901 (option-name (symbol-name option)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1902 (if (and (string-equal "dcl-"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1903 (substring option-name 0 4))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1904 (not (equal (default-value option) (eval option))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1905 (dcl-save-local-variable option "$! "))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1906 dcl-option-alist))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1907
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1908
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1909 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1910 (defun dcl-save-option (option)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1911 "Save a DCL mode option for this buffer.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1912 Saves or updates an option in a `Local Variables:'
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1913 section at the end of the current buffer."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1914 (interactive
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1915 (let ((option (intern (completing-read "Option: " obarray))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1916 (list option)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1917 (dcl-save-local-variable option))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1918
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1919
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1920 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1921 (defun dcl-save-mode ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1922 "Save the current mode for this buffer.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1923 Save the current mode in a `Local Variables:'
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1924 section at the end of the current buffer."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1925 (interactive)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1926 (let ((mode (prin1-to-string major-mode)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1927 (if (string-match "-mode$" mode)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1928 (let ((mode (intern (substring mode 0 (match-beginning 0)))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1929 (dcl-save-option 'mode))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1930 (message "Strange mode: %s" mode))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1931
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1932
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1933 ;;; *** Templates ***********************************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1934 ;; tempo seems to be the only suitable package among those included in
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1935 ;; standard Emacs. I would have liked something closer to the functionality
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1936 ;; of LSE templates...
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1937
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1938 (defvar dcl-tempo-tags nil
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1939 "Tempo tags for DCL mode.")
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1940
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1941 (tempo-define-template "dcl-f$context"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1942 '("f$context" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1943 (p "context-type: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1944 (p "context-symbol: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1945 (p "selection-item: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1946 (p "selection-value: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1947 (p "value-qualifier: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1948 "f$context" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1949
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1950 (tempo-define-template "dcl-f$csid"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1951 '("f$csid" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1952 (p "context-symbol: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1953 "f$csid" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1954
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1955 (tempo-define-template "dcl-f$cvsi"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1956 '("f$cvsi" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1957 (p "start-bit: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1958 (p "number-of-bits: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1959 (p "string: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1960 "f$cvsi" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1961
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1962 (tempo-define-template "dcl-f$cvtime"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1963 '("f$cvtime" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1964 (p "[input_time]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1965 (p "[output_time_format]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1966 (p "[output_field]: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1967 "f$cvtime" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1968
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1969 (tempo-define-template "dcl-f$cvui"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1970 '("f$cvui" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1971 (p "start-bit: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1972 (p "number-of-bits: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1973 (p "string") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1974 "f$cvui" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1975
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1976 (tempo-define-template "dcl-f$device"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1977 '("f$device" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1978 (p "[search_devnam]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1979 (p "[devclass]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1980 (p "[devtype]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1981 (p "[stream-id]: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1982 "f$device" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1983
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1984 (tempo-define-template "dcl-f$directory"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1985 '("f$directory" dcl-tempo-left-paren
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1986 dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1987 "f$directory" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1988
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1989 (tempo-define-template "dcl-f$edit"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1990 '("f$edit" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1991 (p "string: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1992 (p "edit-list: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1993 "f$edit" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1994
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1995 (tempo-define-template "dcl-f$element"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
1996 '("f$element" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1997 (p "element-number: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1998 (p "delimiter: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1999 (p "string: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2000 "f$element" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2001
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2002 (tempo-define-template "dcl-f$environment"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2003 '("f$environment" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2004 (p "item: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2005 "f$environment" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2006
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2007 (tempo-define-template "dcl-f$extract"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2008 '("f$extract" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2009 (p "start: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2010 (p "length: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2011 (p "string: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2012 "f$extract" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2013
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2014 (tempo-define-template "dcl-f$fao"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2015 '("f$fao" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2016 (p "control-string: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2017 ("argument[,...]: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2018 "f$fao" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2019
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2020 (tempo-define-template "dcl-f$file_attributes"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2021 '("f$file_attributes" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2022 (p "filespec: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2023 (p "item: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2024 "f$file_attributes" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2025
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2026 (tempo-define-template "dcl-f$getdvi"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2027 '("f$getdvi" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2028 (p "device-name: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2029 (p "item: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2030 "f$getdvi" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2031
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2032 (tempo-define-template "dcl-f$getjpi"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2033 '("f$getjpi" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2034 (p "pid: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2035 (p "item: ") dcl-tempo-right-paren )
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2036 "f$getjpi" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2037
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2038 (tempo-define-template "dcl-f$getqui"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2039 '("f$getqui" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2040 (p "function: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2041 (p "[item]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2042 (p "[object-id]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2043 (p "[flags]: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2044 "f$getqui" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2045
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2046 (tempo-define-template "dcl-f$getsyi"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2047 '("f$getsyi" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2048 (p "item: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2049 (p "[node-name]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2050 (p "[cluster-id]: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2051 "f$getsyi" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2052
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2053 (tempo-define-template "dcl-f$identifier"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2054 '("f$identifier" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2055 (p "identifier: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2056 (p "conversion-type: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2057 "f$identifier" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2058
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2059 (tempo-define-template "dcl-f$integer"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2060 '("f$integer" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2061 (p "expression: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2062 "f$integer" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2063
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2064 (tempo-define-template "dcl-f$length"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2065 '("f$length" dcl-tempo-left-paren
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2066 (p "string: ") dcl-tempo-right-paren )
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2067 "f$length" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2068
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2069 (tempo-define-template "dcl-f$locate"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2070 '("f$locate" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2071 (p "substring: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2072 (p "string: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2073 "f$locate" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2074
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2075 (tempo-define-template "dcl-f$message"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2076 '("f$message" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2077 (p "status-code: ") dcl-tempo-right-paren )
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2078 "f$message" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2079
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2080 (tempo-define-template "dcl-f$mode"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2081 '("f$mode" dcl-tempo-left-paren dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2082 "f$mode" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2083
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2084 (tempo-define-template "dcl-f$parse"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2085 '("f$parse" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2086 (p "filespec: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2087 (p "[default-spec]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2088 (p "[related-spec]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2089 (p "[field]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2090 (p "[parse-type]: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2091 "f$parse" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2092
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2093 (tempo-define-template "dcl-f$pid"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2094 '("f$pid" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2095 (p "context-symbol: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2096 "f$pid" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2097
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2098 (tempo-define-template "dcl-f$privilege"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2099 '("f$privilege" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2100 (p "priv-states: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2101 "f$privilege" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2102
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2103 (tempo-define-template "dcl-f$process"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2104 '("f$process()")
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2105 "f$process" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2106
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2107 (tempo-define-template "dcl-f$search"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2108 '("f$search" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2109 (p "filespec: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2110 (p "[stream-id]: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2111 "f$search" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2112
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2113 (tempo-define-template "dcl-f$setprv"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2114 '("f$setprv" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2115 (p "priv-states: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2116 "f$setprv" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2117
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2118 (tempo-define-template "dcl-f$string"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2119 '("f$string" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2120 (p "expression: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2121 "f$string" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2122
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2123 (tempo-define-template "dcl-f$time"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2124 '("f$time" dcl-tempo-left-paren dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2125 "f$time" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2126
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2127 (tempo-define-template "dcl-f$trnlnm"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2128 '("f$trnlnm" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2129 (p "logical-name: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2130 (p "[table]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2131 (p "[index]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2132 (p "[mode]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2133 (p "[case]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2134 (p "[item]: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2135 "f$trnlnm" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2136
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2137 (tempo-define-template "dcl-f$type"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2138 '("f$type" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2139 (p "symbol-name: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2140 "f$type" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2141
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2142 (tempo-define-template "dcl-f$user"
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2143 '("f$user" dcl-tempo-left-paren dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2144 "f$user" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2145
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2146 (tempo-define-template "dcl-f$verify"
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2147 '("f$verify" dcl-tempo-left-paren
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2148 (p "[procedure-value]: ") dcl-tempo-comma
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2149 (p "[image-value]: ") dcl-tempo-right-paren)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2150 "f$verify" "" 'dcl-tempo-tags)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2151
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2152
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2153
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2154
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2155 ;;; *** Unsorted stuff *****************************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2156
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2157
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2158 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2159 (defun dcl-beginning-of-command-p ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2160 "Return t if point is at the beginning of a command.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2161 Otherwise return nil."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2162 (and (bolp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2163 (eq (dcl-get-line-type) '$)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2164
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2165
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2166 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2167 (defun dcl-end-of-command-p ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2168 "Check if point is at the end of a command.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2169 Return t if point is at the end of a command, either the end of an
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2170 only line or at the end of the last continuation line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2171 Otherwise return nil."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2172 ;; Must be at end-of-line on a command line or a continuation line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2173 (let ((type (dcl-get-line-type)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2174 (if (and (eolp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2175 (or (eq type '$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2176 (eq type '-)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2177 ;; Next line must not be a continuation line
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2178 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2179 (forward-line)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2180 (not (eq (dcl-get-line-type) '-))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2181
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2182
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2183 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2184 (defun dcl-command-p ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2185 "Check if point is on a command line.
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2186 Return t if point is on a command line or a continuation line,
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2187 otherwise return nil."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2188 (let ((type (dcl-get-line-type)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2189 (or (eq type '$)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2190 (eq type '-))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2191
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2192
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2193 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2194 (defun dcl-was-looking-at (regexp)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2195 (save-excursion
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2196 (let ((start (point))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2197 (found (re-search-backward regexp 0 t)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2198 (if (not found)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2199 ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2200 (equal start (match-end 0))))))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2201
87121
23817affa7a9 Remove directory part from filenames in function declarations.
Glenn Morris <rgm@gnu.org>
parents: 86243
diff changeset
2202 (declare-function imenu-default-create-index-function "imenu" ())
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 47126
diff changeset
2203
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2204 ;;;-------------------------------------------------------------------------
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2205 (defun dcl-imenu-create-index-function ()
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2206 "Jacket routine to make imenu searches non case sensitive."
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2207 (let ((case-fold-search t))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2208 (imenu-default-create-index-function)))
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2209
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2210
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2211
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2212 ;;; *** Epilogue ************************************************************
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2213
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2214
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2215 (provide 'dcl-mode)
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2216
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2217 (run-hooks 'dcl-mode-load-hook) ; for your customizations
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2218
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
2219 ;; arch-tag: e00d421b-f26c-483e-a8bd-af412ea7764a
17246
7f37ef17af0f Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2220 ;;; dcl-mode.el ends here