annotate src/insdel.h @ 5518:3cc7470ea71c

gnuclient: if TMPDIR was set and connect failed, try again with /tmp 2011-06-03 Aidan Kehoe <kehoea@parhasard.net> * gnuslib.c (connect_to_unix_server): Retry with /tmp as a directory in which to search for Unix sockets if an attempt to connect with some other directory failed (which may be because gnuclient and gnuserv don't share an environment value for TMPDIR, or because gnuserv was compiled with USE_TMPDIR turned off).
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 03 Jun 2011 18:40:57 +0100
parents 308d34e9f07d
children 65d65b52d608
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 /* Buffer insertion/deletion and gap motion for XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1985-1994 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4953
diff changeset
6 XEmacs is free software: you can redistribute it and/or modify it
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4953
diff changeset
8 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4953
diff changeset
9 option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 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
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 4953
diff changeset
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 /* Mostly rewritten by Ben Wing. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
23 #ifndef INCLUDED_insdel_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
24 #define INCLUDED_insdel_h_
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 /* changing a buffer's text */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
30 int begin_multiple_change (struct buffer *buf, Charbpos start, Charbpos end);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 void end_multiple_change (struct buffer *buf, int count);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 /* flags for functions below */
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 #define INSDEL_BEFORE_MARKERS 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #define INSDEL_NO_LOCKING 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
38 Charcount buffer_insert_string_1 (struct buffer *buf, Charbpos pos,
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 665
diff changeset
39 const Ibyte *nonreloc, Lisp_Object reloc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 Bytecount offset, Bytecount length,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 int flags);
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
42 Charcount buffer_insert_raw_string_1 (struct buffer *buf, Charbpos pos,
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 665
diff changeset
43 const Ibyte *nonreloc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 Bytecount length, int flags);
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
45 Charcount buffer_insert_lisp_string_1 (struct buffer *buf, Charbpos pos,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 Lisp_Object str, int flags);
4953
304aebb79cd3 function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents: 867
diff changeset
47 Charcount buffer_insert_ascstring_1 (struct buffer *buf, Charbpos pos,
304aebb79cd3 function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents: 867
diff changeset
48 const Ascbyte *s, int flags);
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
49 Charcount buffer_insert_emacs_char_1 (struct buffer *buf, Charbpos pos,
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 665
diff changeset
50 Ichar ch, int flags);
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
51 Charcount buffer_insert_c_char_1 (struct buffer *buf, Charbpos pos, char c,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 int flags);
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
53 Charcount buffer_insert_from_buffer_1 (struct buffer *buf, Charbpos pos,
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
54 struct buffer *buf2, Charbpos pos2,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 Charcount length, int flags);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 /* Macros for insertion functions that insert at point after markers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 All of these can GC. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 #define buffer_insert_string(buf, nonreloc, reloc, offset, length) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 buffer_insert_string_1 (buf, -1, nonreloc, reloc, offset, length, 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 #define buffer_insert_raw_string(buf, string, length) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 buffer_insert_raw_string_1 (buf, -1, string, length, 0)
4953
304aebb79cd3 function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents: 867
diff changeset
64 #define buffer_insert_ascstring(buf, s) \
304aebb79cd3 function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents: 867
diff changeset
65 buffer_insert_ascstring_1 (buf, -1, s, 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 #define buffer_insert_lisp_string(buf, str) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 buffer_insert_lisp_string_1 (buf, -1, str, 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 #define buffer_insert_c_char(buf, c) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 buffer_insert_c_char_1 (buf, -1, c, 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 #define buffer_insert_emacs_char(buf, ch) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 buffer_insert_emacs_char_1 (buf, -1, ch, 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 #define buffer_insert_from_buffer(buf, b, index, length) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 buffer_insert_from_buffer_1 (buf, -1, b, index, length, 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
75 void buffer_delete_range (struct buffer *buf, Charbpos from, Charbpos to,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 int flags);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 665
diff changeset
77 void buffer_replace_char (struct buffer *b, Charbpos pos, Ichar ch,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 int not_real_change, int force_lock_check);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79
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 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 /* tracking buffer changes */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 /* Split into two parts. One part goes with a buffer's text (possibly
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 shared), the other with the buffer itself. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 struct buffer_text_change_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 /* multiple change stuff */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 int in_multiple_change;
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
92 Charbpos mc_begin, mc_orig_end, mc_new_end;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 int mc_begin_signaled;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 };
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 struct each_buffer_change_data
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 Charcount begin_unchanged, end_unchanged;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 /* redisplay needs to know if a newline was deleted so its
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 incremental-redisplay algorithm will fail */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 int newline_was_deleted;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 Charcount begin_extent_unchanged, end_extent_unchanged;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 /* Number of characters at the beginning and end of the buffer that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 have not changed since the last call to buffer_reset_changes().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 If no changes have occurred since then, both values will be -1.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 "Changed" means that the text has changed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 #define BUF_BEGIN_UNCHANGED(buf) ((buf)->changes->begin_unchanged)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 #define BUF_END_UNCHANGED(buf) ((buf)->changes->end_unchanged)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 /* Number of characters at the beginning and end of the buffer that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 have not had a covering extent change since the last call to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 buffer_reset_changes (). If no changes have occurred since then,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 both values will be -1.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 "Changed" means that the extents covering the text have changed. */
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 #define BUF_EXTENT_BEGIN_UNCHANGED(buf) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 ((buf)->changes->begin_extent_unchanged)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 #define BUF_EXTENT_END_UNCHANGED(buf) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 ((buf)->changes->end_extent_unchanged)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 #define BUF_NEWLINE_WAS_DELETED(buf) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 ((buf)->changes->newline_was_deleted)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 void buffer_extent_signal_changed_region (struct buffer *buf,
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
130 Charbpos start,
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
131 Charbpos end);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 void buffer_reset_changes (struct buffer *buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 /* other related functions */
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
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
140 Membpos do_marker_adjustment (Membpos mpos, Membpos from,
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
141 Membpos to, Bytecount amount);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 665
diff changeset
143 void fixup_internal_substring (const Ibyte *nonreloc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 Lisp_Object reloc,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 Bytecount offset, Bytecount *len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 /* In font-lock.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 void font_lock_maybe_update_syntactic_caches (struct buffer *buf,
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
149 Charbpos start,
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
150 Charbpos orig_end,
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
151 Charbpos new_end);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 void font_lock_buffer_was_killed (struct buffer *buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
154 void barf_if_buffer_read_only (struct buffer *buf, Charbpos from,
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 442
diff changeset
155 Charbpos to);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 void init_buffer_text (struct buffer *b);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 void uninit_buffer_text (struct buffer *b);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
160 #endif /* INCLUDED_insdel_h_ */