aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorRichard M. Stallman1994-12-21 22:50:22 +0000
committerRichard M. Stallman1994-12-21 22:50:22 +0000
commit04ae1b489a19335cad1e1c92581b4af5e029e372 (patch)
tree70451ed56179a1b8d8dfdd5255f59697d672efc1 /src/buffer.c
parent4ed715c128dced9eede0482852e5125287bb5f70 (diff)
downloademacs-04ae1b489a19335cad1e1c92581b4af5e029e372.tar.gz
emacs-04ae1b489a19335cad1e1c92581b4af5e029e372.zip
(Fget_buffer_create): Copy the name, and clear text props.
(assoc_ignore_text_properties): New function. (Fget_buffer): Use assoc_ignore_text_properties. (Fother_buffer): Take account of frame's buffer predicate.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index e4d8932458d..6591dac0dd7 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -164,6 +164,27 @@ DEFUN ("buffer-list", Fbuffer_list, Sbuffer_list, 0, 0, 0,
164 return Fmapcar (Qcdr, Vbuffer_alist); 164 return Fmapcar (Qcdr, Vbuffer_alist);
165} 165}
166 166
167/* Like Fassoc, but use Fstring_equal to compare
168 (which ignores text properties),
169 and don't ever QUIT. */
170
171static Lisp_Object
172assoc_ignore_text_properties (key, list)
173 register Lisp_Object key;
174 Lisp_Object list;
175{
176 register Lisp_Object tail;
177 for (tail = list; !NILP (tail); tail = Fcdr (tail))
178 {
179 register Lisp_Object elt, tem;
180 elt = Fcar (tail);
181 tem = Fstring_equal (Fcar (elt), key);
182 if (!NILP (tem))
183 return elt;
184 }
185 return Qnil;
186}
187
167DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0, 188DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0,
168 "Return the buffer named NAME (a string).\n\ 189 "Return the buffer named NAME (a string).\n\
169If there is no live buffer named NAME, return nil.\n\ 190If there is no live buffer named NAME, return nil.\n\
@@ -175,7 +196,7 @@ NAME may also be a buffer; if so, the value is that buffer.")
175 return name; 196 return name;
176 CHECK_STRING (name, 0); 197 CHECK_STRING (name, 0);
177 198
178 return Fcdr (Fassoc (name, Vbuffer_alist)); 199 return Fcdr (assoc_ignore_text_properties (name, Vbuffer_alist));
179} 200}
180 201
181DEFUN ("get-file-buffer", Fget_file_buffer, Sget_file_buffer, 1, 1, 0, 202DEFUN ("get-file-buffer", Fget_file_buffer, Sget_file_buffer, 1, 1, 0,
@@ -258,7 +279,11 @@ The value is never nil.")
258 279
259 b->mark = Fmake_marker (); 280 b->mark = Fmake_marker ();
260 /*b->number = make_number (++buffer_count);*/ 281 /*b->number = make_number (++buffer_count);*/
282
283 name = Fcopy_sequence (name);
284 INITIALIZE_INTERVAL (XSTRING (name), NULL_INTERVAL);
261 b->name = name; 285 b->name = name;
286
262 if (XSTRING (name)->data[0] != ' ') 287 if (XSTRING (name)->data[0] != ' ')
263 b->undo_list = Qnil; 288 b->undo_list = Qnil;
264 else 289 else
@@ -627,6 +652,18 @@ If BUFFER is omitted or nil, some interesting buffer is returned.")
627 continue; 652 continue;
628 if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ') 653 if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ')
629 continue; 654 continue;
655#ifdef MULTI_FRAME
656 /* If the selected frame has a buffer_predicate,
657 disregard buffers that don't fit the predicate. */
658 tem = frame_buffer_predicate ();
659 if (!NILP (tem))
660 {
661 tem = call1 (tem, buf);
662 if (NILP (tem))
663 continue;
664 }
665#endif
666
630 if (NILP (visible_ok)) 667 if (NILP (visible_ok))
631 tem = Fget_buffer_window (buf, Qt); 668 tem = Fget_buffer_window (buf, Qt);
632 else 669 else