annotate lisp/progmodes/awk-mode.el @ 14887:11a44a4c4bfe

(ange-ftp-wait-not-busy): New subroutine. Kill ftp process if user quits. (ange-ftp-raw-send-cmd): Use that. (ange-ftp-fix-dir-name-for-cms): Fix error message.
author Richard M. Stallman <rms@gnu.org>
date Wed, 27 Mar 1996 00:10:38 +0000
parents 83f275dcd93a
children 0e181c85b17e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 257
diff changeset
1 ;;; awk-mode.el --- AWK code editing commands for Emacs
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 257
diff changeset
2
7300
cc7cd83ccf3f Update copyright.
Karl Heuer <kwzh@gnu.org>
parents: 5329
diff changeset
3 ;; Copyright (C) 1988, 1994 Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 811
diff changeset
4
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
5 ;; Maintainer: FSF
2247
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 845
diff changeset
6 ;; Keywords: unix, languages
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
7
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;; any later version.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; GNU General Public License for more details.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13471
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13471
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13471
diff changeset
23 ;; Boston, MA 02111-1307, USA.
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
25 ;;; Commentary:
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
26
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
27 ;; Sets up C-mode with support for awk-style #-comments and a lightly
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
28 ;; hacked syntax table.
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
29
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 662
diff changeset
30 ;;; Code:
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 (defvar awk-mode-syntax-table nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 "Syntax table in use in Awk-mode buffers.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 (if awk-mode-syntax-table
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 (setq awk-mode-syntax-table (make-syntax-table))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 (modify-syntax-entry ?\\ "\\" awk-mode-syntax-table)
5329
af96725f9e00 (awk-mode-syntax-table): Was mistakenly changing
Richard M. Stallman <rms@gnu.org>
parents: 5266
diff changeset
39 (modify-syntax-entry ?\n "> " awk-mode-syntax-table)
af96725f9e00 (awk-mode-syntax-table): Was mistakenly changing
Richard M. Stallman <rms@gnu.org>
parents: 5266
diff changeset
40 (modify-syntax-entry ?\f "> " awk-mode-syntax-table)
af96725f9e00 (awk-mode-syntax-table): Was mistakenly changing
Richard M. Stallman <rms@gnu.org>
parents: 5266
diff changeset
41 (modify-syntax-entry ?\# "< " awk-mode-syntax-table)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 (modify-syntax-entry ?/ "." awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 (modify-syntax-entry ?* "." awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 (modify-syntax-entry ?+ "." awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 (modify-syntax-entry ?- "." awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 (modify-syntax-entry ?= "." awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 (modify-syntax-entry ?% "." awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 (modify-syntax-entry ?< "." awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 (modify-syntax-entry ?> "." awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 (modify-syntax-entry ?& "." awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (modify-syntax-entry ?| "." awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 (modify-syntax-entry ?\' "\"" awk-mode-syntax-table))
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 (defvar awk-mode-abbrev-table nil
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 "Abbrev table in use in Awk-mode buffers.")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 (define-abbrev-table 'awk-mode-abbrev-table ())
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 ;;;###autoload
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 (defun awk-mode ()
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 "Major mode for editing AWK code.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 This is much like C mode except for the syntax of comments. It uses
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 the same keymap as C mode and has the same variables for customizing
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 indentation. It has its own abbrev table and its own syntax table.
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 Turning on AWK mode calls the value of the variable `awk-mode-hook'
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 with no args, if that value is non-nil."
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 (interactive)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 (kill-all-local-variables)
13471
0fe6457bc953 (awk-mode): Require cc-mode.
Richard M. Stallman <rms@gnu.org>
parents: 10868
diff changeset
69 (require 'cc-mode)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 (use-local-map c-mode-map)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 (setq major-mode 'awk-mode)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 (setq mode-name "AWK")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 (setq local-abbrev-table awk-mode-abbrev-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 (set-syntax-table awk-mode-syntax-table)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 (make-local-variable 'paragraph-start)
10868
276209d90df9 (awk-mode): Remove ^ from paragraph-start & paragraph-separate.
Boris Goldowsky <boris@gnu.org>
parents: 7300
diff changeset
76 (setq paragraph-start (concat "$\\|" page-delimiter))
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 (make-local-variable 'paragraph-separate)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 (setq paragraph-separate paragraph-start)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 (make-local-variable 'paragraph-ignore-fill-prefix)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 (setq paragraph-ignore-fill-prefix t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 (make-local-variable 'indent-line-function)
5266
0581b0d428e9 (awk-mode): Use c-indent-line.
Richard M. Stallman <rms@gnu.org>
parents: 2307
diff changeset
82 (setq indent-line-function 'c-indent-line)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 (make-local-variable 'require-final-newline)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (setq require-final-newline t)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 (make-local-variable 'comment-start)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 (setq comment-start "# ")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 (make-local-variable 'comment-end)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 (setq comment-end "")
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (make-local-variable 'comment-column)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 (setq comment-column 32)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (make-local-variable 'comment-start-skip)
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 (setq comment-start-skip "#+ *")
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
93 (make-local-variable 'comment-indent-function)
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2247
diff changeset
94 (setq comment-indent-function 'c-comment-indent)
257
e5ba2ba35226 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 (run-hooks 'awk-mode-hook))
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 257
diff changeset
96
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 257
diff changeset
97 ;;; awk-mode.el ends here