comparison lisp/modes/awk-mode.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
comparison
equal deleted inserted replaced
-1:000000000000 0:376386a54a3c
1 ;;; awk-mode.el --- AWK code editing commands for Emacs
2
3 ;; Copyright (C) 1988, 1994 Free Software Foundation, Inc.
4
5 ;; Maintainer: FSF
6 ;; Keywords: unix, languages
7
8 ;; This file is part of GNU Emacs.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23
24 ;;; Synched up with: FSF 19.30.
25
26 ;;; Commentary:
27
28 ;; Sets up C-mode with support for awk-style #-comments and a lightly
29 ;; hacked syntax table.
30
31 ;;; Code:
32
33 (defvar awk-mode-syntax-table nil
34 "Syntax table in use in Awk-mode buffers.")
35
36 (if awk-mode-syntax-table
37 ()
38 (setq awk-mode-syntax-table (make-syntax-table))
39 (modify-syntax-entry ?\\ "\\" awk-mode-syntax-table)
40 (modify-syntax-entry ?\n "> " awk-mode-syntax-table)
41 (modify-syntax-entry ?\f "> " 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 (modify-syntax-entry ?% "." awk-mode-syntax-table)
49 (modify-syntax-entry ?< "." awk-mode-syntax-table)
50 (modify-syntax-entry ?> "." awk-mode-syntax-table)
51 (modify-syntax-entry ?& "." awk-mode-syntax-table)
52 (modify-syntax-entry ?| "." awk-mode-syntax-table)
53 (modify-syntax-entry ?\' "\"" awk-mode-syntax-table))
54
55 (defvar awk-mode-abbrev-table nil
56 "Abbrev table in use in Awk-mode buffers.")
57 (define-abbrev-table 'awk-mode-abbrev-table ())
58
59 ;;;###autoload
60 (defun awk-mode ()
61 "Major mode for editing AWK code.
62 This is much like C mode except for the syntax of comments. It uses
63 the same keymap as C mode and has the same variables for customizing
64 indentation. It has its own abbrev table and its own syntax table.
65
66 Turning on AWK mode calls the value of the variable `awk-mode-hook'
67 with no args, if that value is non-nil."
68 (interactive)
69 (kill-all-local-variables)
70 (require 'cc-mode)
71 (use-local-map c-mode-map)
72 (setq major-mode 'awk-mode)
73 (setq mode-name "AWK")
74 (setq local-abbrev-table awk-mode-abbrev-table)
75 (set-syntax-table awk-mode-syntax-table)
76 (make-local-variable 'paragraph-start)
77 (setq paragraph-start (concat "$\\|" page-delimiter))
78 (make-local-variable 'paragraph-separate)
79 (setq paragraph-separate paragraph-start)
80 (make-local-variable 'paragraph-ignore-fill-prefix)
81 (setq paragraph-ignore-fill-prefix t)
82 (make-local-variable 'indent-line-function)
83 (setq indent-line-function 'c-indent-line)
84 (make-local-variable 'require-final-newline)
85 (setq require-final-newline t)
86 (make-local-variable 'comment-start)
87 (setq comment-start "# ")
88 (make-local-variable 'comment-end)
89 (setq comment-end "")
90 (make-local-variable 'comment-column)
91 (setq comment-column 32)
92 (make-local-variable 'comment-start-skip)
93 (setq comment-start-skip "#+ *")
94 (make-local-variable 'comment-indent-function)
95 (setq comment-indent-function 'c-comment-indent)
96 (run-hooks 'awk-mode-hook))
97
98 ;;; awk-mode.el ends here