comparison lisp/progmodes/awk-mode.el @ 257:e5ba2ba35226

Initial revision
author Jim Blandy <jimb@redhat.com>
date Thu, 09 May 1991 21:50:45 +0000
parents
children 8a533acedb77
comparison
equal deleted inserted replaced
256:7e4c7ef44243 257:e5ba2ba35226
1 ;; C code editing commands for Emacs
2 ;; Copyright (C) 1988 Free Software Foundation, Inc.
3
4 ;; This file is part of GNU Emacs.
5
6 ;; GNU Emacs is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 1, or (at your option)
9 ;; any later version.
10
11 ;; GNU Emacs is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
15
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GNU Emacs; see the file COPYING. If not, write to
18 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20
21 (defvar awk-mode-syntax-table nil
22 "Syntax table in use in Awk-mode buffers.")
23
24 (if awk-mode-syntax-table
25 ()
26 (setq awk-mode-syntax-table (make-syntax-table))
27 (modify-syntax-entry ?\\ "\\" awk-mode-syntax-table)
28 (modify-syntax-entry ?\n "> " emacs-lisp-mode-syntax-table)
29 (modify-syntax-entry ?\f "> " emacs-lisp-mode-syntax-table)
30 (modify-syntax-entry ?\# "< " emacs-lisp-mode-syntax-table)
31 (modify-syntax-entry ?/ "." awk-mode-syntax-table)
32 (modify-syntax-entry ?* "." awk-mode-syntax-table)
33 (modify-syntax-entry ?+ "." awk-mode-syntax-table)
34 (modify-syntax-entry ?- "." awk-mode-syntax-table)
35 (modify-syntax-entry ?= "." awk-mode-syntax-table)
36 (modify-syntax-entry ?% "." awk-mode-syntax-table)
37 (modify-syntax-entry ?< "." awk-mode-syntax-table)
38 (modify-syntax-entry ?> "." awk-mode-syntax-table)
39 (modify-syntax-entry ?& "." awk-mode-syntax-table)
40 (modify-syntax-entry ?| "." awk-mode-syntax-table)
41 (modify-syntax-entry ?\' "\"" awk-mode-syntax-table))
42
43 (defvar awk-mode-abbrev-table nil
44 "Abbrev table in use in Awk-mode buffers.")
45 (define-abbrev-table 'awk-mode-abbrev-table ())
46
47 ;;;###autoload
48 (defun awk-mode ()
49 "Major mode for editing AWK code.
50 This is much like C mode except for the syntax of comments. It uses
51 the same keymap as C mode and has the same variables for customizing
52 indentation. It has its own abbrev table and its own syntax table.
53
54 Turning on AWK mode calls the value of the variable `awk-mode-hook'
55 with no args, if that value is non-nil."
56 (interactive)
57 (kill-all-local-variables)
58 (use-local-map c-mode-map)
59 (setq major-mode 'awk-mode)
60 (setq mode-name "AWK")
61 (setq local-abbrev-table awk-mode-abbrev-table)
62 (set-syntax-table awk-mode-syntax-table)
63 (make-local-variable 'paragraph-start)
64 (setq paragraph-start (concat "^$\\|" page-delimiter))
65 (make-local-variable 'paragraph-separate)
66 (setq paragraph-separate paragraph-start)
67 (make-local-variable 'paragraph-ignore-fill-prefix)
68 (setq paragraph-ignore-fill-prefix t)
69 (make-local-variable 'indent-line-function)
70 (setq indent-line-function 'awk-indent-line)
71 (make-local-variable 'require-final-newline)
72 (setq require-final-newline t)
73 (make-local-variable 'comment-start)
74 (setq comment-start "# ")
75 (make-local-variable 'comment-end)
76 (setq comment-end "")
77 (make-local-variable 'comment-column)
78 (setq comment-column 32)
79 (make-local-variable 'comment-start-skip)
80 (setq comment-start-skip "#+ *")
81 (make-local-variable 'comment-indent-hook)
82 (setq comment-indent-hook 'c-comment-indent)
83 (run-hooks 'awk-mode-hook))