aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/buffer.c b/src/buffer.c
index e220981243f..baa7f6104d4 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -39,6 +39,7 @@ Boston, MA 02111-1307, USA. */
39#include "region-cache.h" 39#include "region-cache.h"
40#include "indent.h" 40#include "indent.h"
41#include "blockinput.h" 41#include "blockinput.h"
42#include "frame.h"
42 43
43struct buffer *current_buffer; /* the current buffer */ 44struct buffer *current_buffer; /* the current buffer */
44 45
@@ -179,11 +180,34 @@ Value is nil if OBJECT is not a buffer or if it has been killed.")
179 ? Qt : Qnil); 180 ? Qt : Qnil);
180} 181}
181 182
182DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 0, 0, 183DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 1, 0,
183 "Return a list of all existing live buffers.") 184 "Return a list of all existing live buffers.\n\
184 () 185If the optional arg FRAME is a frame, we return that frame's buffer list.")
186 (frame)
187 Lisp_Object frame;
185{ 188{
186 return Fmapcar (Qcdr, Vbuffer_alist); 189 Lisp_Object framelist, general;
190 general = Fmapcar (Qcdr, Vbuffer_alist);
191
192 if (FRAMEP (frame))
193 {
194 Lisp_Object tail;
195
196 CHECK_FRAME (frame, 1);
197
198 framelist = Fcopy_sequence (XFRAME (frame)->buffer_list);
199
200 /* Remove from GENERAL any buffer that duplicates one in FRAMELIST. */
201 tail = framelist;
202 while (! NILP (tail))
203 {
204 general = Fdelq (XCONS (tail)->car, general);
205 tail = XCONS (tail)->cdr;
206 }
207 return nconc2 (framelist, general);
208 }
209
210 return general;
187} 211}
188 212
189/* Like Fassoc, but use Fstring_equal to compare 213/* Like Fassoc, but use Fstring_equal to compare