comparison src/buffer.c @ 18455:9f5626727351

(Fbuffer_list): New optional argument FRAME.
author Richard M. Stallman <rms@gnu.org>
date Thu, 26 Jun 1997 21:09:22 +0000
parents b45b431879bf
children d6e8b92585e9
comparison
equal deleted inserted replaced
18454:b44129078db3 18455:9f5626727351
37 #include "buffer.h" 37 #include "buffer.h"
38 #include "charset.h" 38 #include "charset.h"
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
43 struct buffer *current_buffer; /* the current buffer */ 44 struct buffer *current_buffer; /* the current buffer */
44 45
45 /* First buffer in chain of all buffers (in reverse order of creation). 46 /* First buffer in chain of all buffers (in reverse order of creation).
46 Threaded through ->next. */ 47 Threaded through ->next. */
177 { 178 {
178 return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name)) 179 return ((BUFFERP (object) && ! NILP (XBUFFER (object)->name))
179 ? Qt : Qnil); 180 ? Qt : Qnil);
180 } 181 }
181 182
182 DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 0, 0, 183 DEFUN ("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 () 185 If the optional arg FRAME is a frame, we return that frame's buffer list.")
185 { 186 (frame)
186 return Fmapcar (Qcdr, Vbuffer_alist); 187 Lisp_Object frame;
188 {
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
190 (which ignores text properties), 214 (which ignores text properties),
191 and don't ever QUIT. */ 215 and don't ever QUIT. */