annotate src/cmds.c @ 1932:56dd1fbd33c2

* xfns.c (x_set_icon_type): Pass the proper number of arguments to x_bitmap_icon.
author Jim Blandy <jimb@redhat.com>
date Mon, 22 Feb 1993 15:08:57 +0000
parents 79f020f34683
children e7b8107294b7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* Simple built-in editing commands.
647
529171c8b71c entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
2 Copyright (C) 1985, 1992 Free Software Foundation, Inc.
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 This file is part of GNU Emacs.
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
647
529171c8b71c entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 any later version.
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 GNU General Public License for more details.
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 #include "config.h"
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 #include "lisp.h"
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 #include "commands.h"
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 #include "buffer.h"
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 #include "syntax.h"
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 Lisp_Object Qkill_forward_chars, Qkill_backward_chars, Vblink_paren_function;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "p",
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 "Move point right ARG characters (left if ARG negative).\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 On reaching end of buffer, stop and signal error.")
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 (n)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 Lisp_Object n;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 {
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
36 if (NILP (n))
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 XFASTINT (n) = 1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 CHECK_NUMBER (n, 0);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 SET_PT (point + XINT (n));
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 if (point < BEGV)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 SET_PT (BEGV);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 Fsignal (Qbeginning_of_buffer, Qnil);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 if (point > ZV)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 SET_PT (ZV);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 Fsignal (Qend_of_buffer, Qnil);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 return Qnil;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "p",
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 "Move point left ARG characters (right if ARG negative).\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 On attempt to pass beginning or end of buffer, stop and signal error.")
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 (n)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 Lisp_Object n;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 {
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
61 if (NILP (n))
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 XFASTINT (n) = 1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 CHECK_NUMBER (n, 0);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 XSETINT (n, - XINT (n));
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 return Fforward_char (n);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 DEFUN ("forward-line", Fforward_line, Sforward_line, 0, 1, "p",
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 "Move ARG lines forward (backward if ARG is negative).\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 Precisely, if point is on line I, move to the start of line I + ARG.\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 If there isn't room, go as far as possible (no error).\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 Returns the count of lines left to move. If moving forward,\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 that is ARG - number of lines moved; if backward, ARG + number moved.\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 With positive ARG, a non-empty line at the end counts as one line\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 successfully moved (for the return value).")
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 (n)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 Lisp_Object n;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 int pos2 = point;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 int pos;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 int count, shortage, negp;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
85 if (NILP (n))
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 count = 1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 CHECK_NUMBER (n, 0);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 count = XINT (n);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 negp = count <= 0;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 pos = scan_buffer ('\n', pos2, count - negp, &shortage);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 if (shortage > 0
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 && (negp
647
529171c8b71c entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
97 || (ZV > BEGV
529171c8b71c entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 485
diff changeset
98 && pos != pos2
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 && FETCH_CHAR (pos - 1) != '\n')))
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 shortage--;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 SET_PT (pos);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 return make_number (negp ? - shortage : shortage);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 DEFUN ("beginning-of-line", Fbeginning_of_line, Sbeginning_of_line,
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 0, 1, "p",
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 "Move point to beginning of current line.\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 With argument ARG not nil or 1, move forward ARG - 1 lines first.\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 If scan reaches end of buffer, stop there without error.")
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 (n)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 Lisp_Object n;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 {
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
113 if (NILP (n))
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 XFASTINT (n) = 1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 CHECK_NUMBER (n, 0);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 Fforward_line (make_number (XINT (n) - 1));
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 return Qnil;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 DEFUN ("end-of-line", Fend_of_line, Send_of_line,
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 0, 1, "p",
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 "Move point to end of current line.\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 With argument ARG not nil or 1, move forward ARG - 1 lines first.\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 If scan reaches end of buffer, stop there without error.")
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 (n)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 Lisp_Object n;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 register int pos;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 register int stop;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
133 if (NILP (n))
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 XFASTINT (n) = 1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 CHECK_NUMBER (n, 0);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 if (XINT (n) != 1)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 Fforward_line (make_number (XINT (n) - 1));
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 pos = point;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 stop = ZV;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 while (pos < stop && FETCH_CHAR (pos) != '\n') pos++;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 SET_PT (pos);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 return Qnil;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 DEFUN ("delete-char", Fdelete_char, Sdelete_char, 1, 2, "p\nP",
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 "Delete the following ARG characters (previous, with negative arg).\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 Interactively, ARG is the prefix arg, and KILLFLAG is set if\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 ARG was explicitly specified.")
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 (n, killflag)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 Lisp_Object n, killflag;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 CHECK_NUMBER (n, 0);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
159 if (NILP (killflag))
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 if (XINT (n) < 0)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 if (point + XINT (n) < BEGV)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 Fsignal (Qbeginning_of_buffer, Qnil);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 del_range (point + XINT (n), point);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 if (point + XINT (n) > ZV)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 Fsignal (Qend_of_buffer, Qnil);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 del_range (point, point + XINT (n));
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 call1 (Qkill_forward_chars, n);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 return Qnil;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 DEFUN ("delete-backward-char", Fdelete_backward_char, Sdelete_backward_char,
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 1, 2, "p\nP",
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 "Delete the previous ARG characters (following, with negative ARG).\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 Optional second arg KILLFLAG non-nil means kill instead (save in kill ring).\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 Interactively, ARG is the prefix arg, and KILLFLAG is set if\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 ARG was explicitly specified.")
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 (n, killflag)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 Lisp_Object n, killflag;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 CHECK_NUMBER (n, 0);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 return Fdelete_char (make_number (-XINT (n)), killflag);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 1, "p",
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 "Insert the character you type.\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 Whichever character you type to run this command is inserted.")
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 (arg)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 Lisp_Object arg;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 CHECK_NUMBER (arg, 0);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 /* Barf if the key that invoked this was not a character. */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 if (XTYPE (last_command_char) != Lisp_Int)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 bitch_at_user ();
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 while (XINT (arg) > 0)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 XFASTINT (arg)--; /* Ok since old and new vals both nonneg */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 internal_self_insert (XINT (last_command_char), XFASTINT (arg) != 0);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 return Qnil;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 DEFUN ("newline", Fnewline, Snewline, 0, 1, "P",
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 "Insert a newline. With arg, insert that many newlines.\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 In Auto Fill mode, if no numeric arg, break the preceding line if it's long.")
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 (arg1)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 Lisp_Object arg1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 int flag;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 Lisp_Object arg;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 char c1 = '\n';
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 arg = Fprefix_numeric_value (arg1);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
229 if (!NILP (current_buffer->read_only))
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 Fsignal (Qbuffer_read_only, Qnil);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 /* Inserting a newline at the end of a line
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 produces better redisplay in try_window_id
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 than inserting at the ebginning fo a line,
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 And the textual result is the same.
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 So if at beginning, pretend to be at the end.
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 Must avoid internal_self_insert in that case since point is wrong.
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 Luckily internal_self_insert's special features all do nothing in that case. */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 flag = point > BEGV && FETCH_CHAR (point - 1) == '\n';
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 if (flag)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 SET_PT (point - 1);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 while (XINT (arg) > 0)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 if (flag)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 insert (&c1, 1);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 else
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
249 internal_self_insert ('\n', !NILP (arg1));
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 XFASTINT (arg)--; /* Ok since old and new vals both nonneg */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 if (flag)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 SET_PT (point + 1);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 return Qnil;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258
1022
f7e3bac23a06 (internal_self_insert): Ignore value of Fexpand_abbrev;
Richard M. Stallman <rms@gnu.org>
parents: 647
diff changeset
259 /* Insert character C1. If NOAUTOFILL is nonzero, don't do autofill
f7e3bac23a06 (internal_self_insert): Ignore value of Fexpand_abbrev;
Richard M. Stallman <rms@gnu.org>
parents: 647
diff changeset
260 even if it is enabled.
f7e3bac23a06 (internal_self_insert): Ignore value of Fexpand_abbrev;
Richard M. Stallman <rms@gnu.org>
parents: 647
diff changeset
261
f7e3bac23a06 (internal_self_insert): Ignore value of Fexpand_abbrev;
Richard M. Stallman <rms@gnu.org>
parents: 647
diff changeset
262 If this insertion is suitable for direct output (completely simple),
f7e3bac23a06 (internal_self_insert): Ignore value of Fexpand_abbrev;
Richard M. Stallman <rms@gnu.org>
parents: 647
diff changeset
263 return 0. A value of 1 indicates this *might* not have been simple. */
f7e3bac23a06 (internal_self_insert): Ignore value of Fexpand_abbrev;
Richard M. Stallman <rms@gnu.org>
parents: 647
diff changeset
264
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 internal_self_insert (c1, noautofill)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 char c1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 int noautofill;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 extern Lisp_Object Fexpand_abbrev ();
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 int hairy = 0;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 Lisp_Object tem;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 register enum syntaxcode synt;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 register int c = c1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
275 if (!NILP (Vbefore_change_function) || !NILP (Vafter_change_function))
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 hairy = 1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
278 if (!NILP (current_buffer->overwrite_mode)
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 && point < ZV
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 && c != '\n' && FETCH_CHAR (point) != '\n'
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 && (FETCH_CHAR (point) != '\t'
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 || XINT (current_buffer->tab_width) <= 0
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 || !((current_column () + 1) % XFASTINT (current_buffer->tab_width))))
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 del_range (point, point + 1);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 hairy = 1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 }
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
288 if (!NILP (current_buffer->abbrev_mode)
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 && SYNTAX (c) != Sword
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
290 && NILP (current_buffer->read_only)
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 && point > BEGV && SYNTAX (FETCH_CHAR (point - 1)) == Sword)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 {
1098
79f020f34683 (internal_self_insert): Assume Fexpand_abbrev expanded
Richard M. Stallman <rms@gnu.org>
parents: 1022
diff changeset
293 int modiff = MODIFF;
1022
f7e3bac23a06 (internal_self_insert): Ignore value of Fexpand_abbrev;
Richard M. Stallman <rms@gnu.org>
parents: 647
diff changeset
294 Fexpand_abbrev ();
f7e3bac23a06 (internal_self_insert): Ignore value of Fexpand_abbrev;
Richard M. Stallman <rms@gnu.org>
parents: 647
diff changeset
295 /* We can't trust the value of Fexpand_abbrev,
1098
79f020f34683 (internal_self_insert): Assume Fexpand_abbrev expanded
Richard M. Stallman <rms@gnu.org>
parents: 1022
diff changeset
296 but if Fexpand_abbrev changed the buffer,
79f020f34683 (internal_self_insert): Assume Fexpand_abbrev expanded
Richard M. Stallman <rms@gnu.org>
parents: 1022
diff changeset
297 assume it expanded something. */
79f020f34683 (internal_self_insert): Assume Fexpand_abbrev expanded
Richard M. Stallman <rms@gnu.org>
parents: 1022
diff changeset
298 if (MODIFF != modiff)
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 hairy = 1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 if ((c == ' ' || c == '\n')
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 && !noautofill
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
303 && !NILP (current_buffer->auto_fill_function)
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 && current_column () > XFASTINT (current_buffer->fill_column))
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 if (c1 != '\n')
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 insert (&c1, 1);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 call0 (current_buffer->auto_fill_function);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 if (c1 == '\n')
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 insert (&c1, 1);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 hairy = 1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 else
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 insert (&c1, 1);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 synt = SYNTAX (c);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 if ((synt == Sclose || synt == Smath)
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 239
diff changeset
317 && !NILP (Vblink_paren_function) && INTERACTIVE)
239
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 call0 (Vblink_paren_function);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 hairy = 1;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 return hairy;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 /* module initialization */
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 syms_of_cmds ()
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 Qkill_backward_chars = intern ("kill-backward-chars");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 staticpro (&Qkill_backward_chars);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 Qkill_forward_chars = intern ("kill-forward-chars");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 staticpro (&Qkill_forward_chars);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function,
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 "Function called, if non-nil, whenever a close parenthesis is inserted.\n\
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 More precisely, a char with closeparen syntax is self-inserted.");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 Vblink_paren_function = Qnil;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 defsubr (&Sforward_char);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 defsubr (&Sbackward_char);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 defsubr (&Sforward_line);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343 defsubr (&Sbeginning_of_line);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 defsubr (&Send_of_line);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 defsubr (&Sdelete_char);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 defsubr (&Sdelete_backward_char);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349 defsubr (&Sself_insert_command);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 defsubr (&Snewline);
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 }
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 keys_of_cmds ()
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 {
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 int n;
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 initial_define_key (global_map, Ctl('M'), "newline");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 initial_define_key (global_map, Ctl('I'), "self-insert-command");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 for (n = 040; n < 0177; n++)
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 initial_define_key (global_map, n, "self-insert-command");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 initial_define_key (global_map, Ctl ('A'), "beginning-of-line");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 initial_define_key (global_map, Ctl ('B'), "backward-char");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 initial_define_key (global_map, Ctl ('D'), "delete-char");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 initial_define_key (global_map, Ctl ('E'), "end-of-line");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 initial_define_key (global_map, Ctl ('F'), "forward-char");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 initial_define_key (global_map, 0177, "delete-backward-char");
ed9362406f5f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 }