*** empty log message ***
[bpt/emacs.git] / lisp / progmodes / awk-mode.el
CommitLineData
c0274f38
ER
1;;; awk-mode.el --- AWK code editing commands for Emacs
2
fd7fa35a
ER
3;; Maintainer: FSF
4;; Last-Modified: 09 May 1991
5;; Keyword: unix, languages
6
745bc783
JB
7;; Copyright (C) 1988 Free Software Foundation, Inc.
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
fd7fa35a 13;; the Free Software Foundation; either version 2, or (at your option)
745bc783
JB
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to
23;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
fd7fa35a 25;;; Code:
745bc783
JB
26
27(defvar awk-mode-syntax-table nil
28 "Syntax table in use in Awk-mode buffers.")
29
30(if awk-mode-syntax-table
31 ()
32 (setq awk-mode-syntax-table (make-syntax-table))
33 (modify-syntax-entry ?\\ "\\" awk-mode-syntax-table)
34 (modify-syntax-entry ?\n "> " emacs-lisp-mode-syntax-table)
35 (modify-syntax-entry ?\f "> " emacs-lisp-mode-syntax-table)
36 (modify-syntax-entry ?\# "< " emacs-lisp-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 (modify-syntax-entry ?% "." awk-mode-syntax-table)
43 (modify-syntax-entry ?< "." awk-mode-syntax-table)
44 (modify-syntax-entry ?> "." awk-mode-syntax-table)
45 (modify-syntax-entry ?& "." awk-mode-syntax-table)
46 (modify-syntax-entry ?| "." awk-mode-syntax-table)
47 (modify-syntax-entry ?\' "\"" awk-mode-syntax-table))
48
49(defvar awk-mode-abbrev-table nil
50 "Abbrev table in use in Awk-mode buffers.")
51(define-abbrev-table 'awk-mode-abbrev-table ())
52
53;;;###autoload
54(defun awk-mode ()
55 "Major mode for editing AWK code.
56This is much like C mode except for the syntax of comments. It uses
57the same keymap as C mode and has the same variables for customizing
58indentation. It has its own abbrev table and its own syntax table.
59
60Turning on AWK mode calls the value of the variable `awk-mode-hook'
61with no args, if that value is non-nil."
62 (interactive)
63 (kill-all-local-variables)
64 (use-local-map c-mode-map)
65 (setq major-mode 'awk-mode)
66 (setq mode-name "AWK")
67 (setq local-abbrev-table awk-mode-abbrev-table)
68 (set-syntax-table awk-mode-syntax-table)
69 (make-local-variable 'paragraph-start)
70 (setq paragraph-start (concat "^$\\|" page-delimiter))
71 (make-local-variable 'paragraph-separate)
72 (setq paragraph-separate paragraph-start)
73 (make-local-variable 'paragraph-ignore-fill-prefix)
74 (setq paragraph-ignore-fill-prefix t)
75 (make-local-variable 'indent-line-function)
76 (setq indent-line-function 'awk-indent-line)
77 (make-local-variable 'require-final-newline)
78 (setq require-final-newline t)
79 (make-local-variable 'comment-start)
80 (setq comment-start "# ")
81 (make-local-variable 'comment-end)
82 (setq comment-end "")
83 (make-local-variable 'comment-column)
84 (setq comment-column 32)
85 (make-local-variable 'comment-start-skip)
86 (setq comment-start-skip "#+ *")
87 (make-local-variable 'comment-indent-hook)
88 (setq comment-indent-hook 'c-comment-indent)
89 (run-hooks 'awk-mode-hook))
c0274f38
ER
90
91;;; awk-mode.el ends here