GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
(frame)
Lisp_Object frame;
{
- Lisp_Object framelist, general;
+ Lisp_Object general;
general = Fmapcar (Qcdr, Vbuffer_alist);
if (FRAMEP (frame))
{
- Lisp_Object tail;
+ Lisp_Object framelist, prevlist, tail;
+ Lisp_Object args[3];
CHECK_FRAME (frame);
framelist = Fcopy_sequence (XFRAME (frame)->buffer_list);
+ prevlist = Fnreverse (Fcopy_sequence (XFRAME (frame)->buried_buffer_list));
- /* Remove from GENERAL any buffer that duplicates one in FRAMELIST. */
+ /* Remove from GENERAL any buffer that duplicates one in
+ FRAMELIST or PREVLIST. */
tail = framelist;
- while (! NILP (tail))
+ while (CONSP (tail))
{
general = Fdelq (XCAR (tail), general);
tail = XCDR (tail);
}
- return nconc2 (framelist, general);
+ tail = prevlist;
+ while (CONSP (tail))
+ {
+ general = Fdelq (XCAR (tail), general);
+ tail = XCDR (tail);
+ }
+
+ args[0] = framelist;
+ args[1] = general;
+ args[2] = prevlist;
+ return Fnconc (3, args);
}
return general;
XSETCDR (link, Vbuffer_alist);
Vbuffer_alist = link;
+ /* Effectively do a delq on buried_buffer_list. */
+
+ prev = Qnil;
+ for (link = XFRAME (frame)->buried_buffer_list; CONSP (link);
+ link = XCDR (link))
+ {
+ if (EQ (XCAR (link), buf))
+ {
+ if (NILP (prev))
+ XFRAME (frame)->buried_buffer_list = XCDR (link);
+ else
+ XSETCDR (prev, XCDR (XCDR (prev)));
+ break;
+ }
+ prev = link;
+ }
+
/* Now move this buffer to the front of frame_buffer_list also. */
prev = Qnil;
XSETCDR (link, Qnil);
Vbuffer_alist = nconc2 (Vbuffer_alist, link);
- /* Removing BUFFER from frame-specific lists
- has the effect of putting BUFFER at the end
- of the combined list in each frame. */
- frames_discard_buffer (buffer);
+ XFRAME (selected_frame)->buffer_list
+ = Fdelq (buffer, XFRAME (selected_frame)->buffer_list);
+ XFRAME (selected_frame)->buried_buffer_list
+ = Fcons (buffer, Fdelq (buffer, XFRAME (selected_frame)->buried_buffer_list));
}
return Qnil;
free (pwd);
}
+/* Similar to defvar_lisp but define a variable whose value is the Lisp
+ Object stored in the current buffer. address is the address of the slot
+ in the buffer that is current now. */
+
+/* TYPE is nil for a general Lisp variable.
+ An integer specifies a type; then only LIsp values
+ with that type code are allowed (except that nil is allowed too).
+ LNAME is the LIsp-level variable name.
+ VNAME is the name of the buffer slot.
+ DOC is a dummy where you write the doc string as a comment. */
+#define DEFVAR_PER_BUFFER(lname, vname, type, doc) \
+ defvar_per_buffer (lname, vname, type, 0)
+
+static void
+defvar_per_buffer (namestring, address, type, doc)
+ char *namestring;
+ Lisp_Object *address;
+ Lisp_Object type;
+ char *doc;
+{
+ Lisp_Object sym, val;
+ int offset;
+
+ sym = intern (namestring);
+ val = allocate_misc ();
+ offset = (char *)address - (char *)current_buffer;
+
+ XMISCTYPE (val) = Lisp_Misc_Buffer_Objfwd;
+ XBUFFER_OBJFWD (val)->offset = offset;
+ SET_SYMBOL_VALUE (sym, val);
+ PER_BUFFER_SYMBOL (offset) = sym;
+ PER_BUFFER_TYPE (offset) = type;
+
+ if (PER_BUFFER_IDX (offset) == 0)
+ /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
+ slot of buffer_local_flags */
+ abort ();
+}
+
+
/* initialize the buffer routines */
void
syms_of_buffer ()
%P -- print percent of buffer above bottom of window, perhaps plus Top,
or print Bottom or All.
%n -- print Narrow if appropriate.
- %R -- print R or hyphen. R means that default-directory is on a
- remote machine.
%t -- visited file is text or binary (if OS supports this distinction).
%z -- print mnemonics of keyboard, terminal, and buffer coding systems.
%Z -- like %z, but including the end-of-line format.
%e -- print error message about full memory.
+ %@ -- print @ or hyphen. @ means that default-directory is on a
+ remote machine.
%[ -- print one [ for each recursive editing level. %] similar.
%% -- print %. %- -- print infinitely many dashes.
Decimal digits after the % specify field width to which to pad. */);
Qnil,
doc: /* Pretty name of current buffer's major mode (a string). */);
+ DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil,
+ doc: /* Local (mode-specific) abbrev table of current buffer. */);
+
DEFVAR_PER_BUFFER ("abbrev-mode", ¤t_buffer->abbrev_mode, Qnil,
doc: /* Non-nil turns on automatic expansion of abbrevs as they are inserted. */);