annotate src/cmds.c @ 867:804517e16990

[xemacs-hg @ 2002-06-05 09:54:39 by ben] Textual renaming: text/char names abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization. [a] distinguish between "charptr" when it refers to operations on the pointer itself and when it refers to operations on text; and [b] use consistent naming for everything referring to internal format, i.e. Itext == text in internal format Ibyte == a byte in such text Ichar == a char as represented in internal character format thus e.g. set_charptr_emchar -> set_itext_ichar The pre and post tags on either side of this change are: pre-internal-format-textual-renaming post-internal-format-textual-renaming See the Internals Manual for details of exactly how this was done, how to handle the change in your workspace, etc.
author ben
date Wed, 05 Jun 2002 09:58:45 +0000
parents 6728e641994e
children 79c6ff3eef26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Simple built-in editing commands.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1985, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 793
diff changeset
3 Copyright (C) 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Mule 2.0, FSF 19.30. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #include "commands.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include "buffer.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include "syntax.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include "insdel.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 Lisp_Object Qkill_forward_chars;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 Lisp_Object Qself_insert_command;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 Lisp_Object Qno_self_insert;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 Lisp_Object Vblink_paren_function;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 /* A possible value for a buffer's overwrite-mode variable. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 Lisp_Object Qoverwrite_mode_binary;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 /* Non-nil means put this face on the next self-inserting character. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 Lisp_Object Vself_insert_face;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 /* This is the command that set up Vself_insert_face. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 Lisp_Object Vself_insert_face_command;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
45
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
46 /* A char-table for characters which may invoke auto-filling. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
47 Lisp_Object Vauto_fill_chars;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 DEFUN ("forward-char", Fforward_char, 0, 2, "_p", /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
50 Move point right COUNT characters (left if COUNT is negative).
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 On attempt to pass end of buffer, stop and signal `end-of-buffer'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 On attempt to pass beginning of buffer, stop and signal `beginning-of-buffer'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 On reaching end of buffer, stop and signal error.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
54
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
55 The characters that are moved over may be added to the current selection
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
56 \(i.e. active region) if the Shift key is held down, a motion key is used
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
57 to invoke this command, and `shifted-motion-keys-select-region' is t; see
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
58 the documentation for this variable for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
60 (count, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 struct buffer *buf = decode_buffer (buffer, 1);
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
63 EMACS_INT n;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
65 if (NILP (count))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
66 n = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
69 CHECK_INT (count);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
70 n = XINT (count);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
73 /* This used to just set point to point + XINT (count), and then check
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 to see if it was within boundaries. But now that SET_PT can
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 potentially do a lot of stuff (calling entering and exiting
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 hooks, etcetera), that's not a good approach. So we validate the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 proposed position, then set point. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 {
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 563
diff changeset
79 Charbpos new_point = BUF_PT (buf) + n;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 if (new_point < BUF_BEGV (buf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 BUF_SET_PT (buf, BUF_BEGV (buf));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 Fsignal (Qbeginning_of_buffer, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 if (new_point > BUF_ZV (buf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 BUF_SET_PT (buf, BUF_ZV (buf));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 Fsignal (Qend_of_buffer, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 BUF_SET_PT (buf, new_point);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 DEFUN ("backward-char", Fbackward_char, 0, 2, "_p", /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
101 Move point left COUNT characters (right if COUNT is negative).
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 On attempt to pass end of buffer, stop and signal `end-of-buffer'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 On attempt to pass beginning of buffer, stop and signal `beginning-of-buffer'.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
104
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
105 The characters that are moved over may be added to the current selection
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
106 \(i.e. active region) if the Shift key is held down, a motion key is used
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
107 to invoke this command, and `shifted-motion-keys-select-region' is t; see
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
108 the documentation for this variable for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
110 (count, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
112 if (NILP (count))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
113 count = make_int (-1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
116 CHECK_INT (count);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
117 count = make_int (- XINT (count));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 }
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
119 return Fforward_char (count, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 DEFUN ("forward-line", Fforward_line, 0, 2, "_p", /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
123 Move COUNT lines forward (backward if COUNT is negative).
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
124 Precisely, if point is on line I, move to the start of line I + COUNT.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 If there isn't room, go as far as possible (no error).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 Returns the count of lines left to move. If moving forward,
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
127 that is COUNT - number of lines moved; if backward, COUNT + number moved.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
128 With positive COUNT, a non-empty line at the end counts as one line
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 successfully moved (for the return value).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 If BUFFER is nil, the current buffer is assumed.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
131
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
132 The characters that are moved over may be added to the current selection
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
133 \(i.e. active region) if the Shift key is held down, a motion key is used
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
134 to invoke this command, and `shifted-motion-keys-select-region' is t; see
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
135 the documentation for this variable for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
137 (count, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 struct buffer *buf = decode_buffer (buffer, 1);
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 563
diff changeset
140 Charbpos pos2 = BUF_PT (buf);
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 563
diff changeset
141 Charbpos pos;
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
142 EMACS_INT n, shortage, negp;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
144 if (NILP (count))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
145 n = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
148 CHECK_INT (count);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
149 n = XINT (count);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
152 negp = n <= 0;
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
153 pos = scan_buffer (buf, '\n', pos2, 0, n - negp, &shortage, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 if (shortage > 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 && (negp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 || (BUF_ZV (buf) > BUF_BEGV (buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 && pos != pos2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 && BUF_FETCH_CHAR (buf, pos - 1) != '\n')))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 shortage--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 BUF_SET_PT (buf, pos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 return make_int (negp ? - shortage : shortage);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 DEFUN ("point-at-bol", Fpoint_at_bol, 0, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 Return the character position of the first character on the current line.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
166 With argument COUNT not nil or 1, move forward COUNT - 1 lines first.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 If scan reaches end of buffer, return that position.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 This function does not move point.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
170 (count, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 struct buffer *b = decode_buffer (buffer, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 REGISTER int orig, end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 665
diff changeset
175 buffer = wrap_buffer (b);
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
176 if (NILP (count))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
177 count = make_int (0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
180 CHECK_INT (count);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
181 count = make_int (XINT (count) - 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 orig = BUF_PT (b);
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
185 Fforward_line (count, buffer);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 end = BUF_PT (b);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 BUF_SET_PT (b, orig);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 return make_int (end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 DEFUN ("beginning-of-line", Fbeginning_of_line, 0, 2, "_p", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 Move point to beginning of current line.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
194 With argument COUNT not nil or 1, move forward COUNT - 1 lines first.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 If scan reaches end of buffer, stop there without error.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 If BUFFER is nil, the current buffer is assumed.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
197
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
198 The characters that are moved over may be added to the current selection
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
199 \(i.e. active region) if the Shift key is held down, a motion key is used
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
200 to invoke this command, and `shifted-motion-keys-select-region' is t; see
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
201 the documentation for this variable for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
203 (count, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 struct buffer *b = decode_buffer (buffer, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
207 BUF_SET_PT (b, XINT (Fpoint_at_bol (count, buffer)));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 DEFUN ("point-at-eol", Fpoint_at_eol, 0, 2, 0, /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 Return the character position of the last character on the current line.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
213 With argument COUNT not nil or 1, move forward COUNT - 1 lines first.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 If scan reaches end of buffer, return that position.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 This function does not move point.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
217 (count, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 struct buffer *buf = decode_buffer (buffer, 1);
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
220 EMACS_INT n;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
222 if (NILP (count))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
223 n = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
226 CHECK_INT (count);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
227 n = XINT (count);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 return make_int (find_before_next_newline (buf, BUF_PT (buf), 0,
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
231 n - (n <= 0)));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 DEFUN ("end-of-line", Fend_of_line, 0, 2, "_p", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 Move point to end of current line.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
236 With argument COUNT not nil or 1, move forward COUNT - 1 lines first.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 If scan reaches end of buffer, stop there without error.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 If BUFFER is nil, the current buffer is assumed.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
239
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
240 The characters that are moved over may be added to the current selection
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
241 \(i.e. active region) if the Shift key is held down, a motion key is used
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
242 to invoke this command, and `shifted-motion-keys-select-region' is t; see
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
243 the documentation for this variable for more details.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
245 (count, buffer))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 struct buffer *b = decode_buffer (buffer, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
249 BUF_SET_PT (b, XINT (Fpoint_at_eol (count, buffer)));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
253 DEFUN ("delete-char", Fdelete_char, 0, 2, "*p\nP", /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
254 Delete the following COUNT characters (previous, with negative COUNT).
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
255 Optional second arg KILLP non-nil means kill instead (save in kill ring).
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
256 Interactively, COUNT is the prefix arg, and KILLP is set if
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
257 COUNT was explicitly specified.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
259 (count, killp))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 /* This function can GC */
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 563
diff changeset
262 Charbpos pos;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 struct buffer *buf = current_buffer;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
264 EMACS_INT n;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
266 if (NILP (count))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
267 n = 1;
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
268 else
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
269 {
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
270 CHECK_INT (count);
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
271 n = XINT (count);
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
272 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
274 pos = BUF_PT (buf) + n;
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
275 if (NILP (killp))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
277 if (n < 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 if (pos < BUF_BEGV (buf))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
280 signal_error (Qbeginning_of_buffer, 0, Qunbound);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 buffer_delete_range (buf, pos, BUF_PT (buf), 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 if (pos > BUF_ZV (buf))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
287 signal_error (Qend_of_buffer, 0, Qunbound);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 buffer_delete_range (buf, BUF_PT (buf), pos, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 {
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
294 call1 (Qkill_forward_chars, count);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
299 DEFUN ("delete-backward-char", Fdelete_backward_char, 0, 2, "*p\nP", /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
300 Delete the previous COUNT characters (following, with negative COUNT).
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
301 Optional second arg KILLP non-nil means kill instead (save in kill ring).
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
302 Interactively, COUNT is the prefix arg, and KILLP is set if
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
303 COUNT was explicitly specified.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
305 (count, killp))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 /* This function can GC */
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
308 EMACS_INT n;
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
309
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
310 if (NILP (count))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
311 n = 1;
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
312 else
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
313 {
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
314 CHECK_INT (count);
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
315 n = XINT (count);
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
316 }
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
317
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
318 return Fdelete_char (make_int (- n), killp);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
321 static void internal_self_insert (Ichar ch, int noautofill);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 DEFUN ("self-insert-command", Fself_insert_command, 1, 1, "*p", /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 Insert the character you type.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 Whichever character you type to run this command is inserted.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
326 If a prefix arg COUNT is specified, the character is inserted COUNT times.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
328 (count))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 /* This function can GC */
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
331 Ichar ch;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 Lisp_Object c;
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
333 EMACS_INT n;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
335 CHECK_NATNUM (count);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
336 n = XINT (count);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 if (CHAR_OR_CHAR_INTP (Vlast_command_char))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 c = Vlast_command_char;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 c = Fevent_to_character (Vlast_command_event, Qnil, Qnil, Qt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 if (NILP (c))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
344 invalid_operation ("Last typed character has no ASCII equivalent",
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
345 Fcopy_event (Vlast_command_event, Qnil));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 CHECK_CHAR_COERCE_INT (c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 ch = XCHAR (c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
351 while (n--)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
352 internal_self_insert (ch, (n != 0));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 /* Insert character C1. If NOAUTOFILL is nonzero, don't do autofill
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 even if it is enabled.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 FSF:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 If this insertion is suitable for direct output (completely simple),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 return 0. A value of 1 indicates this *might* not have been simple.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 A value of 2 means this did things that call for an undo boundary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 static void
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
367 internal_self_insert (Ichar c1, int noautofill)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 /* int hairy = 0; -- unused */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 REGISTER enum syntaxcode synt;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 826
diff changeset
372 REGISTER Ichar c2;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 Lisp_Object overwrite;
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 793
diff changeset
374 Lisp_Object syntax_table;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 struct buffer *buf = current_buffer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 int tab_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 overwrite = buf->overwrite_mode;
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 793
diff changeset
379 syntax_table = buf->mirror_syntax_table;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 /* No, this is very bad, it makes undo *always* undo a character at a time
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 instead of grouping consecutive self-inserts together. Nasty nasty.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 || !NILP (Vbefore_change_function) || !NILP (Vafter_change_function))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 hairy = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 if (!NILP (overwrite)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 && BUF_PT (buf) < BUF_ZV (buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 && (EQ (overwrite, Qoverwrite_mode_binary)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 || (c1 != '\n' && BUF_FETCH_CHAR (buf, BUF_PT (buf)) != '\n'))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 && (EQ (overwrite, Qoverwrite_mode_binary)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 || BUF_FETCH_CHAR (buf, BUF_PT (buf)) != '\t'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 || ((tab_width = XINT (buf->tab_width), tab_width <= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 || tab_width > 20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 || !((current_column (buf) + 1) % tab_width))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 buffer_delete_range (buf, BUF_PT (buf), BUF_PT (buf) + 1, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 /* hairy = 2; */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 if (!NILP (buf->abbrev_mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 && !WORD_SYNTAX_P (syntax_table, c1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 && NILP (buf->read_only)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 && BUF_PT (buf) > BUF_BEGV (buf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 c2 = BUF_FETCH_CHAR (buf, BUF_PT (buf) - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 if (WORD_SYNTAX_P (syntax_table, c2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 #if 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 Fexpand_abbrev ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 #else /* FSFmacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 Lisp_Object sym = Fexpand_abbrev ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 /* I think this is too bogus to add. The function should
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 have a way of examining the character to be inserted, so
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 it can decide whether to insert it or not. We should
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 design it better than that. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 /* Here FSFmacs remembers MODIFF, compares it after
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 Fexpand_abbrev() finishes, and updates HAIRY. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 /* NOTE: we cannot simply check for Vlast_abbrev, because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 Fexpand_abbrev() can bail out before setting it to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 anything meaningful, leaving us stuck with an old value.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 Thus Fexpand_abbrev() was extended to return the actual
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 abbrev symbol. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 if (!NILP (sym)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 && !NILP (symbol_function (XSYMBOL (sym)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 && SYMBOLP (symbol_function (XSYMBOL (sym))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 Lisp_Object prop = Fget (symbol_function (XSYMBOL (sym)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 Qno_self_insert, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 if (!NILP (prop))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 #endif /* FSFmacs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
443 if ((CHAR_TABLEP (Vauto_fill_chars)
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 793
diff changeset
444 ? !NILP (get_char_table (c1, Vauto_fill_chars))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
445 : (c1 == ' ' || c1 == '\n'))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 && !noautofill
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 && !NILP (buf->auto_fill_function))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 buffer_insert_emacs_char (buf, c1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 if (c1 == '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 /* After inserting a newline, move to previous line and fill */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 /* that. Must have the newline in place already so filling and */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 /* justification, if any, know where the end is going to be. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 BUF_SET_PT (buf, BUF_PT (buf) - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 call0 (buf->auto_fill_function);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 if (c1 == '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 BUF_SET_PT (buf, BUF_PT (buf) + 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 /* hairy = 2; */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 buffer_insert_emacs_char (buf, c1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 /* If previous command specified a face to use, use it. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 if (!NILP (Vself_insert_face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 && EQ (Vlast_command, Vself_insert_face_command))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 Lisp_Object before = make_int (BUF_PT (buf) - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 Lisp_Object after = make_int (BUF_PT (buf));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 Fput_text_property (before, after, Qface, Vself_insert_face, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 Fput_text_property (before, after, Qstart_open, Qt, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 Fput_text_property (before, after, Qend_open, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 /* #### FSFmacs properties are normally closed ("sticky") on the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 end but not the beginning. It's the opposite for us. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 Vself_insert_face = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 synt = SYNTAX (syntax_table, c1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 if ((synt == Sclose || synt == Smath)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 && !NILP (Vblink_paren_function) && INTERACTIVE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 && !noautofill)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 call0 (Vblink_paren_function);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 /* hairy = 2; */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 /* return hairy; */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 /* (this comes from Mule but is a generally good idea) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 DEFUN ("self-insert-internal", Fself_insert_internal, 1, 1, 0, /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
491 Invoke `self-insert-command' as if CHARACTER is entered from keyboard.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
493 (character))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 /* This function can GC */
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
496 CHECK_CHAR_COERCE_INT (character);
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
497 internal_self_insert (XCHAR (character), 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 /* module initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 syms_of_cmds (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
506 DEFSYMBOL (Qkill_forward_chars);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
507 DEFSYMBOL (Qself_insert_command);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
508 DEFSYMBOL (Qoverwrite_mode_binary);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
509 DEFSYMBOL (Qno_self_insert);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 DEFSUBR (Fforward_char);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 DEFSUBR (Fbackward_char);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 DEFSUBR (Fforward_line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 DEFSUBR (Fbeginning_of_line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 DEFSUBR (Fend_of_line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 DEFSUBR (Fpoint_at_bol);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 DEFSUBR (Fpoint_at_eol);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 DEFSUBR (Fdelete_char);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 DEFSUBR (Fdelete_backward_char);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 DEFSUBR (Fself_insert_command);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 DEFSUBR (Fself_insert_internal);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 vars_of_cmds (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 DEFVAR_LISP ("self-insert-face", &Vself_insert_face /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 If non-nil, set the face of the next self-inserting character to this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 See also `self-insert-face-command'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 Vself_insert_face = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 DEFVAR_LISP ("self-insert-face-command", &Vself_insert_face_command /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 This is the command that set up `self-insert-face'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 If `last-command' does not equal this value, we ignore `self-insert-face'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 Vself_insert_face_command = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 Function called, if non-nil, whenever a close parenthesis is inserted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 More precisely, a char with closeparen syntax is self-inserted.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 Vblink_paren_function = Qnil;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
547
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
548 DEFVAR_LISP ("auto-fill-chars", &Vauto_fill_chars /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
549 A char-table for characters which invoke auto-filling.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
550 Such characters have value t in this table.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
551 */);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
552 Vauto_fill_chars = Fmake_char_table (Qgeneric);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
553 XCHAR_TABLE (Vauto_fill_chars)->ascii[' '] = Qt;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
554 XCHAR_TABLE (Vauto_fill_chars)->ascii['\n'] = Qt;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 }