1: /* Header file for the buffer manipulation primitives.
2: Copyright (C) 1985 Richard M. Stallman.
3:
4: This file is part of GNU Emacs.
5:
6: GNU Emacs is distributed in the hope that it will be useful,
7: but WITHOUT ANY WARRANTY. No author or distributor
8: accepts responsibility to anyone for the consequences of using it
9: or for whether it serves any particular purpose or works at all,
10: unless he says so in writing. Refer to the GNU Emacs General Public
11: License for full details.
12:
13: Everyone is granted permission to copy, modify and redistribute
14: GNU Emacs, but only under the conditions described in the
15: GNU Emacs General Public License. A copy of this license is
16: supposed to have been given to you along with GNU Emacs so you
17: can know your rights and responsibilities. It should be in a
18: file named COPYING. Among other things, the copyright notice
19: and this notice must be preserved on all copies. */
20:
21:
22: #ifdef lint
23: #include "undo.h"
24: #endif /* lint */
25:
26:
27: #define SetPoint point =
28:
29: #define PointRight point +=
30: #define PointLeft point -=
31:
32: struct buffer_text
33: {
34: unsigned char *p1; /* Address of first data char, minus 1 */
35: unsigned char *p2; /* p1 plus gap size */
36: int size1; /* # characters before gap */
37: int size2; /* # characters after gap */
38: int gap; /* gap size in chars */
39: int modified; /* tick at which contents last modified */
40: int head_clip; /* # of first char that's visible (origin 1) */
41: int tail_clip; /* # chars not visible at end of buffer */
42: int pointloc; /* # of char point is at (origin 1) */
43: };
44:
45: /* structure that defines a buffer */
46: struct buffer
47: {
48: struct buffer_text text; /* This describes the buffer's text */
49:
50: Lisp_Object number; /* buffer number, assigned when buffer made */
51: Lisp_Object name; /* the name of this buffer */
52: Lisp_Object filename; /* the name of the file associated
53: with this buffer */
54: Lisp_Object directory; /* Dir for expanding relative pathnames */
55: int save_modified; /* Value of text.modified when buffer last saved */
56: Lisp_Object save_length; /* Length of file when last read or saved. */
57: int modtime; /* Set to the modtime of the file when read */
58: /* Really should be time_t */
59: int backed_up; /* true iff this buffer has been been backed
60: up (if you write to its associated file
61: and it hasn't been backed up, then a
62: backup will be made) */
63: Lisp_Object auto_save_file_name; /* file name used for auto-saving this
64: buffer */
65: int auto_save_modified; /* the value of text.modified at the last auto-save. */
66: Lisp_Object read_only; /* Non-nil if buffer read-only */
67:
68: Lisp_Object markers; /* the markers that refer to this buffer.
69: This is actually a single marker ---
70: successive elements in its marker `chain'
71: are the other markers referring to this
72: buffer */
73: Lisp_Object mark; /* "The mark"; may be nil */
74:
75: Lisp_Object major_mode; /* Symbol naming major mode (eg lisp-mode) */
76: Lisp_Object mode_name; /* Pretty name of major mode (eg "Lisp") */
77: Lisp_Object mode_line_format; /* Format string for mode line */
78:
79: Lisp_Object keymap; /* Keys that are bound local to this buffer
80: (stuff like $J) */
81: struct Lisp_Vector *syntax_table_v; /* the syntax table in use */
82: Lisp_Object abbrev_table; /* This buffer's local abbrev table */
83:
84: /* Values of several buffer-local variables */
85: /* tab-width is buffer-local so that redisplay can find it
86: in buffers that are not current */
87: Lisp_Object case_fold_search;
88: Lisp_Object tab_width;
89: Lisp_Object fill_column;
90: Lisp_Object left_margin;
91: Lisp_Object auto_fill_hook; /* Function to call when insert space past fiull column */
92: /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER)
93: for all per-buffer variables of this buffer. */
94: Lisp_Object local_var_alist;
95:
96: /* Position in buffer at which display started
97: the last time this buffer was displayed */
98: int last_window_start;
99: /* Non-nil means do not display continuation lines */
100: Lisp_Object truncate_lines;
101: /* Non-nil means display ctl chars with uparrow */
102: Lisp_Object ctl_arrow;
103: /* Non-nil means do selective display;
104: See doc string in syms_of_buffer (buffer.c) for details. */
105: Lisp_Object selective_display;
106: /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */
107: Lisp_Object minor_modes;
108: /* Undo records for changes in this buffer. */
109: struct UndoData *undodata;
110: /* t if "self-insertion" should overwrite */
111: Lisp_Object overwrite_mode;
112: /* non-nil means abbrev mode is on. Expand abbrevs automatically. */
113: Lisp_Object abbrev_mode;
114: /* Next buffer, in chain of all buffers that exist. */
115: struct buffer *next;
116: };
117:
118: extern struct buffer *bf_cur; /* the current buffer */
119:
120: /* This structure contains data describing the text of the current buffer.
121: Switching buffers swaps their text data in and out of here */
122:
123: extern struct buffer_text bf_text;
124:
125: #define bf_p1 bf_text.p1
126: #define bf_p2 bf_text.p2
127: #define bf_s1 bf_text.size1
128: #define bf_s2 bf_text.size2
129: #define bf_gap bf_text.gap
130: #define bf_modified bf_text.modified
131: #define bf_head_clip bf_text.head_clip
132: #define bf_tail_clip bf_text.tail_clip
133: #define point bf_text.pointloc
134:
135: /* Lowest legal value of point for current buffer */
136: #define FirstCharacter bf_text.head_clip
137:
138: /* Number of last visible character in current buffer */
139: /* The highest legal value for point is one greater than this */
140: #define NumCharacters (bf_text.size1+bf_text.size2-bf_text.tail_clip)
141:
142: /* Return character at position n. No range checking */
143: #define CharAt(n) *(((n)>bf_s1 ? bf_p2 : bf_p1) + (n))
144:
145: extern void reset_buffer ();
Defined struct's
buffer
defined in line
46; used 108 times
- in line 115-118(4)
- in /usr/src/new/emacs/src/alloc.c line
859(2),
1029(2),
1156(2)
- in /usr/src/new/emacs/src/buffer.c line
37(2),
47(2),
143-144(4),
150(4),
205(2),
219(2),
333(2),
381(2),
460(2),
653-657(6),
763(2),
808(2)
- in /usr/src/new/emacs/src/callproc.c line
90(2)
- in /usr/src/new/emacs/src/doc.c line
239(2)
- in /usr/src/new/emacs/src/editfns.c line
667(2)
- in /usr/src/new/emacs/src/fileio.c line
973(2),
1023(2)
- in /usr/src/new/emacs/src/filelock.c line
226(2)
- in /usr/src/new/emacs/src/keymap.c line
679(2),
995(2)
- in /usr/src/new/emacs/src/marker.c line
53(2),
87(2),
176(2)
- in /usr/src/new/emacs/src/minibuf.c line
876(2)
- in /usr/src/new/emacs/src/print.c line
170(2),
186(2),
204(2),
220(2),
292(2),
313(2),
337(2),
363(2),
385(2)
- in /usr/src/new/emacs/src/process.c line
541(2),
1180(2),
1633(2)
- in /usr/src/new/emacs/src/syntax.c line
315(2)
- in /usr/src/new/emacs/src/undo.c line
37(2),
44-49(4),
64(2)
- in /usr/src/new/emacs/src/window.c line
932(2),
1350(2)
- in /usr/src/new/emacs/src/xdisp.c line
66(2),
473(2)
Defined macros
CharAt
defined in line
143; used 106 times
- in /usr/src/new/emacs/src/abbrev.c line
225
- in /usr/src/new/emacs/src/bytecode.c line
601-606(2)
- in /usr/src/new/emacs/src/casefiddle.c line
115-119(2)
- in /usr/src/new/emacs/src/cmds.c line
94,
102,
111,
156,
247,
272-273(2),
283
- in /usr/src/new/emacs/src/editfns.c line
337-340(2),
352-356(2),
369,
495,
504,
581-585(2)
- in /usr/src/new/emacs/src/fileio.c line
893,
899
- in /usr/src/new/emacs/src/indent.c line
68,
200,
235,
302,
322,
341,
350,
359,
392,
429
- in /usr/src/new/emacs/src/keyboard.c line
511,
527,
565
- in /usr/src/new/emacs/src/minibuf.c line
146
- in /usr/src/new/emacs/src/process.c line
1308
- in /usr/src/new/emacs/src/search.c line
203,
214,
301-306(2),
424,
432,
480,
488,
549,
568,
765,
834-836(2),
855
- in /usr/src/new/emacs/src/syntax.c line
358,
365,
380,
387,
445-449(2),
471-473(2),
496-500(2),
508,
525-533(4),
567-570(2),
589-590(2),
599,
620-625(2),
632-637(2),
675,
732,
823-826(3),
851-853(2),
879-883(2),
912-921(4)
- in /usr/src/new/emacs/src/undo.c line
156-161(2),
409,
420,
426
- in /usr/src/new/emacs/src/xdisp.c line
306-308(2),
710,
823,
844,
935,
1135,
1153,
1179,
1247,
1262
FirstCharacter
defined in line
136; used 77 times
- in /usr/src/new/emacs/src/buffer.c line
676,
686-687(2),
798
- in /usr/src/new/emacs/src/bytecode.c line
592,
606
- in /usr/src/new/emacs/src/casefiddle.c line
183
- in /usr/src/new/emacs/src/cmds.c line
43-45(2),
91,
175,
247,
283
- in /usr/src/new/emacs/src/editfns.c line
180(2),
311,
318,
340-345(2),
352,
367,
502-504(4),
686-687(2)
- in /usr/src/new/emacs/src/indent.c line
392,
429-433(2),
456,
462
- in /usr/src/new/emacs/src/insdel.c line
250-251(2)
- in /usr/src/new/emacs/src/keyboard.c line
524
- in /usr/src/new/emacs/src/lread.c line
377,
404
- in /usr/src/new/emacs/src/search.c line
128-134(4),
211,
255,
331,
340-341(2),
448-453(3),
508-512(3),
745,
847-848(2)
- in /usr/src/new/emacs/src/syntax.c line
343,
412,
561,
671,
729
- in /usr/src/new/emacs/src/undo.c line
339,
347,
368
- in /usr/src/new/emacs/src/window.c line
866-867(2),
1241,
1444
- in /usr/src/new/emacs/src/xdisp.c line
306,
521-522(2),
619-621(2),
822,
1484,
1491-1500(3)
NumCharacters
defined in line
140; used 82 times
- in /usr/src/new/emacs/src/buffer.c line
676,
688-689(2),
778,
799
- in /usr/src/new/emacs/src/bytecode.c line
587,
601
- in /usr/src/new/emacs/src/casefiddle.c line
183
- in /usr/src/new/emacs/src/cmds.c line
48-50(2),
105,
155,
182,
271
- in /usr/src/new/emacs/src/editfns.c line
181(2),
325,
332-337(2),
349,
356,
367,
502-504(2),
688-689(2)
- in /usr/src/new/emacs/src/fileio.c line
812,
920,
1060
- in /usr/src/new/emacs/src/indent.c line
194,
218,
349,
447
- in /usr/src/new/emacs/src/insdel.c line
252-253(2)
- in /usr/src/new/emacs/src/keyboard.c line
509,
565
- in /usr/src/new/emacs/src/minibuf.c line
630,
639,
756,
811-824(5),
856
- in /usr/src/new/emacs/src/process.c line
1203,
1696
- in /usr/src/new/emacs/src/search.c line
129,
200,
255,
331,
338-339(2),
747,
849-853(4)
- in /usr/src/new/emacs/src/syntax.c line
344,
412,
442
- in /usr/src/new/emacs/src/undo.c line
340,
348,
369
- in /usr/src/new/emacs/src/window.c line
868-869(2),
1249,
1444
- in /usr/src/new/emacs/src/xdisp.c line
307,
523-524(2),
542,
619-621(2),
960,
983,
993,
1024,
1106,
1245,
1484
SetPoint
defined in line
27; used 61 times
- in /usr/src/new/emacs/src/abbrev.c line
244,
284-286(2),
297
- in /usr/src/new/emacs/src/buffer.c line
685
- in /usr/src/new/emacs/src/casefiddle.c line
187
- in /usr/src/new/emacs/src/cmds.c line
42-50(3),
114,
157
- in /usr/src/new/emacs/src/editfns.c line
182,
643-645(2),
687-689(2)
- in /usr/src/new/emacs/src/indent.c line
251,
394-396(2),
515
- in /usr/src/new/emacs/src/keyboard.c line
512,
526
- in /usr/src/new/emacs/src/lread.c line
377,
403
- in /usr/src/new/emacs/src/minibuf.c line
156,
634-636(2),
821
- in /usr/src/new/emacs/src/print.c line
71,
79
- in /usr/src/new/emacs/src/process.c line
1201-1203(2),
1211,
1696,
1704
- in /usr/src/new/emacs/src/search.c line
351-355(2),
799
- in /usr/src/new/emacs/src/syntax.c line
412-415(2),
735,
981
- in /usr/src/new/emacs/src/undo.c line
342,
350,
371,
381
- in /usr/src/new/emacs/src/window.c line
865,
937,
1240-1244(2),
1255-1261(3),
1361,
1377,
1413,
1452
- in /usr/src/new/emacs/src/xdisp.c line
520,
545,
673-675(2)
bf_gap
defined in line
129; used 16 times
- in /usr/src/new/emacs/src/fileio.c line
785,
792
- in /usr/src/new/emacs/src/insdel.c line
32,
62,
96(3),
154,
163,
170,
177-178(2),
184,
218-223(2),
280
bf_modified
defined in line
130; used 43 times
- in /usr/src/new/emacs/src/buffer.c line
342,
362,
370,
384,
521,
811
- in /usr/src/new/emacs/src/dispnew.c line
476-480(2)
- in /usr/src/new/emacs/src/fileio.c line
782,
810-811(2),
919,
1078
- in /usr/src/new/emacs/src/filelock.c line
250,
262
- in /usr/src/new/emacs/src/indent.c line
65,
113,
150,
255
- in /usr/src/new/emacs/src/insdel.c line
49,
83,
214,
274,
295-300(3),
310
- in /usr/src/new/emacs/src/keyboard.c line
515,
530,
552-555(2)
- in /usr/src/new/emacs/src/undo.c line
118,
140,
216,
388
- in /usr/src/new/emacs/src/window.c line
936
- in /usr/src/new/emacs/src/xdisp.c line
278,
296,
311,
432,
569,
622,
1466
bf_p1
defined in line
125; used 18 times
- in line 143
- in /usr/src/new/emacs/src/fileio.c line
789
- in /usr/src/new/emacs/src/indent.c line
69,
78-80(2)
- in /usr/src/new/emacs/src/insdel.c line
32,
65,
99,
159,
166-170(2),
178,
221
- in /usr/src/new/emacs/src/regex.c line
1310,
1317,
1324
- in /usr/src/new/emacs/src/search.c line
111,
398
bf_p2
defined in line
126; used 15 times
bf_s1
defined in line
127; used 92 times
- in line 143
- in /usr/src/new/emacs/src/dispnew.c line
477
- in /usr/src/new/emacs/src/editfns.c line
306,
493(2),
502(2),
637-641(2),
676
- in /usr/src/new/emacs/src/fileio.c line
789-791(2),
850,
892-898(4)
- in /usr/src/new/emacs/src/indent.c line
69(2),
81-82(2)
- in /usr/src/new/emacs/src/insdel.c line
35-37(2),
52,
62-72(4),
86-106(9),
159,
170,
184(2),
216,
225,
267-269(2),
282-286(4),
297-299(2)
- in /usr/src/new/emacs/src/minibuf.c line
146-148(3)
- in /usr/src/new/emacs/src/process.c line
1305(2)
- in /usr/src/new/emacs/src/search.c line
112-113(2),
399-400(2),
547-550(2)
- in /usr/src/new/emacs/src/undo.c line
154-158(5),
418-423(6)
- in /usr/src/new/emacs/src/xdisp.c line
293-298(2),
641,
723,
758-759(2),
804,
811,
824,
836,
890,
950,
996-998(2),
1032,
1132-1133(3),
1297
bf_s2
defined in line
128; used 42 times
- in /usr/src/new/emacs/src/editfns.c line
306,
637-641(2),
676
- in /usr/src/new/emacs/src/fileio.c line
850
- in /usr/src/new/emacs/src/insdel.c line
52-57(3),
71,
86-91(3),
105,
159,
170-172(2),
184,
282-288(3),
297-299(2)
- in /usr/src/new/emacs/src/minibuf.c line
146-149(2)
- in /usr/src/new/emacs/src/search.c line
114,
401
- in /usr/src/new/emacs/src/xdisp.c line
293,
300,
641,
723,
760-761(2),
804,
811,
824,
836,
890,
950,
996-998(2),
1032,
1297
point
defined in line
133; used 203 times
- in line 27-30(3)
- in /usr/src/new/emacs/src/abbrev.c line
218-223(4),
245-249(3),
270-277(3),
283,
305(2)
- in /usr/src/new/emacs/src/buffer.c line
674-676(3),
686-689(4),
843
- in /usr/src/new/emacs/src/bytecode.c line
570,
601-606(4)
- in /usr/src/new/emacs/src/callint.c line
250,
308-311(4)
- in /usr/src/new/emacs/src/casefiddle.c line
181-185(5)
- in /usr/src/new/emacs/src/cmds.c line
42-48(3),
80,
154,
175-185(6),
247(2),
271-277(5),
283(2)
- in /usr/src/new/emacs/src/dispnew.c line
478,
501
- in /usr/src/new/emacs/src/editfns.c line
162,
168,
194,
205,
337-356(10),
642-644(2),
686-688(2)
- in /usr/src/new/emacs/src/fileio.c line
781-784(2)
- in /usr/src/new/emacs/src/indent.c line
64-69(3),
112,
149,
185,
215,
254,
389,
508
- in /usr/src/new/emacs/src/insdel.c line
213-226(5),
236,
258-263(4)
- in /usr/src/new/emacs/src/keyboard.c line
509-517(4),
524-532(4),
554,
565(2)
- in /usr/src/new/emacs/src/minibuf.c line
639
- in /usr/src/new/emacs/src/print.c line
70-79(4)
- in /usr/src/new/emacs/src/process.c line
1195,
1204-1208(2),
1695-1697(2)
- in /usr/src/new/emacs/src/regex.c line
1311,
1318,
1325
- in /usr/src/new/emacs/src/search.c line
128,
301-306(4),
336(2),
344,
824-832(5),
854
- in /usr/src/new/emacs/src/syntax.c line
410,
730
- in /usr/src/new/emacs/src/undo.c line
258,
276,
343(2),
358-364(4)
- in /usr/src/new/emacs/src/window.c line
124,
794,
825,
854,
866-869(4),
1222,
1229,
1235,
1241-1243(2),
1260,
1352,
1375,
1391,
1411,
1447-1449(2)
- in /usr/src/new/emacs/src/xdisp.c line
292-293(2),
330,
340,
472,
512,
521-524(4),
547-549(2),
570-575(2),
600,
639,
647-650(2),
662,
771,
854-859(4),
865-868(2),
984,
1006,
1123,
1130-1131(3),
1273(2)
Usage of this include