Mercurial > emacs
comparison lisp/progmodes/dcl-mode.el @ 88155:d7ddb3e565de
sync with trunk
author | Henrik Enberg <henrik.enberg@telia.com> |
---|---|
date | Mon, 16 Jan 2006 00:03:54 +0000 |
parents | 0d8b17d428b5 |
children |
comparison
equal
deleted
inserted
replaced
88154:8ce476d3ba36 | 88155:d7ddb3e565de |
---|---|
1 ;;; dcl-mode.el --- major mode for editing DCL command files | 1 ;;; dcl-mode.el --- major mode for editing DCL command files |
2 | 2 |
3 ;; Copyright (c) 1997 Free Software Foundation, Inc. | 3 ;; Copyright (c) 1997, 2001, 2002, 2003, 2004, 2005 |
4 ;; Free Software Foundation, Inc. | |
4 | 5 |
5 ;; Author: Odd Gripenstam <gripenstamol@decus.se> | 6 ;; Author: Odd Gripenstam <gripenstamol@decus.se> |
6 ;; Maintainer: Odd Gripenstam <gripenstamol@decus.se> | 7 ;; Maintainer: Odd Gripenstam <gripenstamol@decus.se> |
7 ;; Keywords: DCL editing major-mode languages | 8 ;; Keywords: DCL editing major-mode languages |
8 | 9 |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 ;; GNU General Public License for more details. | 20 ;; GNU General Public License for more details. |
20 | 21 |
21 ;; You should have received a copy of the GNU General Public License | 22 ;; You should have received a copy of the GNU General Public License |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02111-1307, USA. | 25 ;; Boston, MA 02110-1301, USA. |
25 | 26 |
26 ;;; Commentary: | 27 ;;; Commentary: |
27 | 28 |
28 ;; DCL mode is a package for editing DCL command files. It helps you | 29 ;; DCL mode is a package for editing DCL command files. It helps you |
29 ;; indent lines, add leading `$' and trailing `-', move around in the | 30 ;; indent lines, add leading `$' and trailing `-', move around in the |
49 ;; dcl-calc-command-indent-function or dcl-calc-cont-indent-function, | 50 ;; dcl-calc-command-indent-function or dcl-calc-cont-indent-function, |
50 ;; please send them to the maintainer. | 51 ;; please send them to the maintainer. |
51 ;; | 52 ;; |
52 ;; | 53 ;; |
53 ;; Ideas for improvement: | 54 ;; Ideas for improvement: |
55 ;; * Better font-lock support. | |
54 ;; * Change meaning of `left margin' when dcl-tab-always-indent is nil. | 56 ;; * Change meaning of `left margin' when dcl-tab-always-indent is nil. |
55 ;; Consider the following line (`_' is the cursor): | 57 ;; Consider the following line (`_' is the cursor): |
56 ;; $ label: _ command | 58 ;; $ label: _ command |
57 ;; Pressing tab with the cursor at the underline now inserts a tab. | 59 ;; Pressing tab with the cursor at the underline now inserts a tab. |
58 ;; This should be part of the left margin and pressing tab should indent | 60 ;; This should be part of the left margin and pressing tab should indent |
69 | 71 |
70 ;;; Code: | 72 ;;; Code: |
71 | 73 |
72 ;;; *** Customization ***************************************************** | 74 ;;; *** Customization ***************************************************** |
73 | 75 |
76 | |
77 ;; First, font lock. This is a minimal approach, please improve! | |
78 | |
79 (defvar dcl-font-lock-keywords | |
80 '(("\\<\\(if\\|then\\|else\\|endif\\)\\>" | |
81 1 font-lock-keyword-face) | |
82 ("\\<f[$][a-z_]+\\>" | |
83 0 font-lock-builtin-face) | |
84 ("[.]\\(eq\\|not\\|or\\|and\\|lt\\|gt\\|le\\|ge\\|eqs\\|nes\\)[.]" | |
85 0 font-lock-builtin-face)) | |
86 "Font lock keyword specification for DCL mode. | |
87 Presently this includes some syntax, .OP.erators, and \"f$\" lexicals.") | |
88 | |
89 (defvar dcl-font-lock-defaults | |
90 '(dcl-font-lock-keywords nil) | |
91 "Font lock specification for DCL mode.") | |
92 | |
93 | |
94 ;; Now the rest. | |
95 | |
74 (defgroup dcl nil | 96 (defgroup dcl nil |
75 "Major mode for editing DCL command files." | 97 "Major mode for editing DCL command files." |
98 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) | |
76 :group 'languages) | 99 :group 'languages) |
77 | 100 |
78 (defcustom dcl-basic-offset 4 | 101 (defcustom dcl-basic-offset 4 |
79 "*Number of columns to indent a block in DCL. | 102 "*Number of columns to indent a block in DCL. |
80 A block is the commands between THEN-ELSE-ENDIF and between the commands | 103 A block is the commands between THEN-ELSE-ENDIF and between the commands |
261 ;;; *** Global variables **************************************************** | 284 ;;; *** Global variables **************************************************** |
262 | 285 |
263 | 286 |
264 (defvar dcl-mode-syntax-table nil | 287 (defvar dcl-mode-syntax-table nil |
265 "Syntax table used in DCL-buffers.") | 288 "Syntax table used in DCL-buffers.") |
266 (if dcl-mode-syntax-table | 289 (unless dcl-mode-syntax-table |
267 () | |
268 (setq dcl-mode-syntax-table (make-syntax-table)) | 290 (setq dcl-mode-syntax-table (make-syntax-table)) |
269 (modify-syntax-entry ?! "<" dcl-mode-syntax-table) ; comment start | 291 (modify-syntax-entry ?! "<" dcl-mode-syntax-table) ; comment start |
270 (modify-syntax-entry ?\n ">" dcl-mode-syntax-table) ; comment end | 292 (modify-syntax-entry ?\n ">" dcl-mode-syntax-table) ; comment end |
271 (modify-syntax-entry ?< "(>" dcl-mode-syntax-table) ; < and ... | 293 (modify-syntax-entry ?< "(>" dcl-mode-syntax-table) ; < and ... |
272 (modify-syntax-entry ?> ")<" dcl-mode-syntax-table) ; > is a matching pair | 294 (modify-syntax-entry ?> ")<" dcl-mode-syntax-table) ; > is a matching pair |
295 (modify-syntax-entry ?\\ "_" dcl-mode-syntax-table) ; not an escape | |
273 ) | 296 ) |
274 | 297 |
275 | 298 |
276 (defvar dcl-mode-map () | 299 (defvar dcl-mode-map () |
277 "Keymap used in DCL-mode buffers.") | 300 "Keymap used in DCL-mode buffers.") |
564 $ type sys$input | 587 $ type sys$input |
565 Data lines are not indented at all. | 588 Data lines are not indented at all. |
566 $ endloop1: ! This matches dcl-block-end-regexp | 589 $ endloop1: ! This matches dcl-block-end-regexp |
567 $ endif | 590 $ endif |
568 $ | 591 $ |
569 " | 592 |
593 | |
594 There is some minimal font-lock support (see vars | |
595 `dcl-font-lock-defaults' and `dcl-font-lock-keywords')." | |
570 (interactive) | 596 (interactive) |
571 (kill-all-local-variables) | 597 (kill-all-local-variables) |
572 (set-syntax-table dcl-mode-syntax-table) | 598 (set-syntax-table dcl-mode-syntax-table) |
573 | 599 |
574 (make-local-variable 'indent-line-function) | 600 (make-local-variable 'indent-line-function) |
607 (make-local-variable 'dcl-electric-characters) | 633 (make-local-variable 'dcl-electric-characters) |
608 (make-local-variable 'dcl-calc-command-indent-function) | 634 (make-local-variable 'dcl-calc-command-indent-function) |
609 (make-local-variable 'dcl-calc-cont-indent-function) | 635 (make-local-variable 'dcl-calc-cont-indent-function) |
610 (make-local-variable 'dcl-electric-reindent-regexps) | 636 (make-local-variable 'dcl-electric-reindent-regexps) |
611 | 637 |
638 ;; font lock | |
639 (make-local-variable 'font-lock-defaults) | |
640 (setq font-lock-defaults dcl-font-lock-defaults) | |
641 | |
612 (setq major-mode 'dcl-mode) | 642 (setq major-mode 'dcl-mode) |
613 (setq mode-name "DCL") | 643 (setq mode-name "DCL") |
614 (use-local-map dcl-mode-map) | 644 (use-local-map dcl-mode-map) |
615 (tempo-use-tag-list 'dcl-tempo-tags) | 645 (tempo-use-tag-list 'dcl-tempo-tags) |
616 (run-hooks 'dcl-mode-hook)) | 646 (run-mode-hooks 'dcl-mode-hook)) |
617 | 647 |
618 | 648 |
619 ;;; *** Movement commands *************************************************** | 649 ;;; *** Movement commands *************************************************** |
620 | 650 |
621 | 651 |
2185 | 2215 |
2186 (provide 'dcl-mode) | 2216 (provide 'dcl-mode) |
2187 | 2217 |
2188 (run-hooks 'dcl-mode-load-hook) ; for your customizations | 2218 (run-hooks 'dcl-mode-load-hook) ; for your customizations |
2189 | 2219 |
2220 ;;; arch-tag: e00d421b-f26c-483e-a8bd-af412ea7764a | |
2190 ;;; dcl-mode.el ends here | 2221 ;;; dcl-mode.el ends here |