annotate lisp/modes/awk-mode.el @ 27:0a3286277d9b

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