aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorMiles Bader2007-10-11 16:24:58 +0000
committerMiles Bader2007-10-11 16:24:58 +0000
commitc73bd236f75b742ad4642ec94798987ae6e3e1e8 (patch)
treeef5edc8db557fc1d25a17c379e4ae63a38b3ba5c /src/buffer.c
parentecb21060d5c1752d41d7a742be565c59b5fcb855 (diff)
parent58ade22bf16a9ec2ff0aee6c59d8db4d1703e94f (diff)
downloademacs-c73bd236f75b742ad4642ec94798987ae6e3e1e8.tar.gz
emacs-c73bd236f75b742ad4642ec94798987ae6e3e1e8.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 866-879) - Merge multi-tty branch - Update from CVS - Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-257
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c96
1 files changed, 86 insertions, 10 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 3a2b9460c17..237c549df8b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -216,25 +216,38 @@ frame parameter come first, followed by the rest of the buffers. */)
216 (frame) 216 (frame)
217 Lisp_Object frame; 217 Lisp_Object frame;
218{ 218{
219 Lisp_Object framelist, general; 219 Lisp_Object general;
220 general = Fmapcar (Qcdr, Vbuffer_alist); 220 general = Fmapcar (Qcdr, Vbuffer_alist);
221 221
222 if (FRAMEP (frame)) 222 if (FRAMEP (frame))
223 { 223 {
224 Lisp_Object tail; 224 Lisp_Object framelist, prevlist, tail;
225 Lisp_Object args[3];
225 226
226 CHECK_FRAME (frame); 227 CHECK_FRAME (frame);
227 228
228 framelist = Fcopy_sequence (XFRAME (frame)->buffer_list); 229 framelist = Fcopy_sequence (XFRAME (frame)->buffer_list);
230 prevlist = Fnreverse (Fcopy_sequence (XFRAME (frame)->buried_buffer_list));
229 231
230 /* Remove from GENERAL any buffer that duplicates one in FRAMELIST. */ 232 /* Remove from GENERAL any buffer that duplicates one in
233 FRAMELIST or PREVLIST. */
231 tail = framelist; 234 tail = framelist;
232 while (! NILP (tail)) 235 while (CONSP (tail))
233 { 236 {
234 general = Fdelq (XCAR (tail), general); 237 general = Fdelq (XCAR (tail), general);
235 tail = XCDR (tail); 238 tail = XCDR (tail);
236 } 239 }
237 return nconc2 (framelist, general); 240 tail = prevlist;
241 while (CONSP (tail))
242 {
243 general = Fdelq (XCAR (tail), general);
244 tail = XCDR (tail);
245 }
246
247 args[0] = framelist;
248 args[1] = general;
249 args[2] = prevlist;
250 return Fnconc (3, args);
238 } 251 }
239 252
240 return general; 253 return general;
@@ -417,6 +430,7 @@ The value is never nil. */)
417 b->name = name; 430 b->name = name;
418 431
419 /* Put this in the alist of all live buffers. */ 432 /* Put this in the alist of all live buffers. */
433 XSETPVECTYPE (b, PVEC_BUFFER);
420 XSETBUFFER (buf, b); 434 XSETBUFFER (buf, b);
421 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); 435 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
422 436
@@ -1584,6 +1598,23 @@ record_buffer (buf)
1584 XSETCDR (link, Vbuffer_alist); 1598 XSETCDR (link, Vbuffer_alist);
1585 Vbuffer_alist = link; 1599 Vbuffer_alist = link;
1586 1600
1601 /* Effectively do a delq on buried_buffer_list. */
1602
1603 prev = Qnil;
1604 for (link = XFRAME (frame)->buried_buffer_list; CONSP (link);
1605 link = XCDR (link))
1606 {
1607 if (EQ (XCAR (link), buf))
1608 {
1609 if (NILP (prev))
1610 XFRAME (frame)->buried_buffer_list = XCDR (link);
1611 else
1612 XSETCDR (prev, XCDR (XCDR (prev)));
1613 break;
1614 }
1615 prev = link;
1616 }
1617
1587 /* Now move this buffer to the front of frame_buffer_list also. */ 1618 /* Now move this buffer to the front of frame_buffer_list also. */
1588 1619
1589 prev = Qnil; 1620 prev = Qnil;
@@ -2066,10 +2097,10 @@ selected window if it is displayed there. */)
2066 XSETCDR (link, Qnil); 2097 XSETCDR (link, Qnil);
2067 Vbuffer_alist = nconc2 (Vbuffer_alist, link); 2098 Vbuffer_alist = nconc2 (Vbuffer_alist, link);
2068 2099
2069 /* Removing BUFFER from frame-specific lists 2100 XFRAME (selected_frame)->buffer_list
2070 has the effect of putting BUFFER at the end 2101 = Fdelq (buffer, XFRAME (selected_frame)->buffer_list);
2071 of the combined list in each frame. */ 2102 XFRAME (selected_frame)->buried_buffer_list
2072 frames_discard_buffer (buffer); 2103 = Fcons (buffer, Fdelq (buffer, XFRAME (selected_frame)->buried_buffer_list));
2073 } 2104 }
2074 2105
2075 return Qnil; 2106 return Qnil;
@@ -3953,7 +3984,7 @@ OVERLAY. */)
3953 3984
3954 3985
3955DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, 3986DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
3956 doc: /* Return a list of the overlays that contain position POS. */) 3987 doc: /* Return a list of the overlays that contain the character at POS. */)
3957 (pos) 3988 (pos)
3958 Lisp_Object pos; 3989 Lisp_Object pos;
3959{ 3990{
@@ -5022,7 +5053,9 @@ init_buffer_once ()
5022 buffer_local_symbols.text = &buffer_local_symbols.own_text; 5053 buffer_local_symbols.text = &buffer_local_symbols.own_text;
5023 BUF_INTERVALS (&buffer_defaults) = 0; 5054 BUF_INTERVALS (&buffer_defaults) = 0;
5024 BUF_INTERVALS (&buffer_local_symbols) = 0; 5055 BUF_INTERVALS (&buffer_local_symbols) = 0;
5056 XSETPVECTYPE (&buffer_defaults, PVEC_BUFFER);
5025 XSETBUFFER (Vbuffer_defaults, &buffer_defaults); 5057 XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
5058 XSETPVECTYPE (&buffer_local_symbols, PVEC_BUFFER);
5026 XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); 5059 XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols);
5027 5060
5028 /* Set up the default values of various buffer slots. */ 5061 /* Set up the default values of various buffer slots. */
@@ -5261,6 +5294,46 @@ init_buffer ()
5261 free (pwd); 5294 free (pwd);
5262} 5295}
5263 5296
5297/* Similar to defvar_lisp but define a variable whose value is the Lisp
5298 Object stored in the current buffer. address is the address of the slot
5299 in the buffer that is current now. */
5300
5301/* TYPE is nil for a general Lisp variable.
5302 An integer specifies a type; then only LIsp values
5303 with that type code are allowed (except that nil is allowed too).
5304 LNAME is the LIsp-level variable name.
5305 VNAME is the name of the buffer slot.
5306 DOC is a dummy where you write the doc string as a comment. */
5307#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \
5308 defvar_per_buffer (lname, vname, type, 0)
5309
5310static void
5311defvar_per_buffer (namestring, address, type, doc)
5312 char *namestring;
5313 Lisp_Object *address;
5314 Lisp_Object type;
5315 char *doc;
5316{
5317 Lisp_Object sym, val;
5318 int offset;
5319
5320 sym = intern (namestring);
5321 val = allocate_misc ();
5322 offset = (char *)address - (char *)current_buffer;
5323
5324 XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd;
5325 XBUFFER_OBJFWD (val)->offset = offset;
5326 SET_SYMBOL_VALUE (sym, val);
5327 PER_BUFFER_SYMBOL (offset) = sym;
5328 PER_BUFFER_TYPE (offset) = type;
5329
5330 if (PER_BUFFER_IDX (offset) == 0)
5331 /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
5332 slot of buffer_local_flags */
5333 abort ();
5334}
5335
5336
5264/* initialize the buffer routines */ 5337/* initialize the buffer routines */
5265void 5338void
5266syms_of_buffer () 5339syms_of_buffer ()
@@ -5546,6 +5619,9 @@ its hooks should not expect certain variables such as
5546 Qnil, 5619 Qnil,
5547 doc: /* Pretty name of current buffer's major mode (a string). */); 5620 doc: /* Pretty name of current buffer's major mode (a string). */);
5548 5621
5622 DEFVAR_PER_BUFFER ("local-abbrev-table", &current_buffer->abbrev_table, Qnil,
5623 doc: /* Local (mode-specific) abbrev table of current buffer. */);
5624
5549 DEFVAR_PER_BUFFER ("abbrev-mode", &current_buffer->abbrev_mode, Qnil, 5625 DEFVAR_PER_BUFFER ("abbrev-mode", &current_buffer->abbrev_mode, Qnil,
5550 doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */); 5626 doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */);
5551 5627