From: Richard M. Stallman Date: Wed, 21 Dec 1994 22:50:22 +0000 (+0000) Subject: (Fget_buffer_create): Copy the name, and clear text props. X-Git-Tag: emacs-19.34~5646 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=04ae1b489a19335cad1e1c92581b4af5e029e372;p=emacs.git (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. --- 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, return Fmapcar (Qcdr, Vbuffer_alist); } +/* Like Fassoc, but use Fstring_equal to compare + (which ignores text properties), + and don't ever QUIT. */ + +static Lisp_Object +assoc_ignore_text_properties (key, list) + register Lisp_Object key; + Lisp_Object list; +{ + register Lisp_Object tail; + for (tail = list; !NILP (tail); tail = Fcdr (tail)) + { + register Lisp_Object elt, tem; + elt = Fcar (tail); + tem = Fstring_equal (Fcar (elt), key); + if (!NILP (tem)) + return elt; + } + return Qnil; +} + DEFUN ("get-buffer", Fget_buffer, Sget_buffer, 1, 1, 0, "Return the buffer named NAME (a string).\n\ If 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.") return name; CHECK_STRING (name, 0); - return Fcdr (Fassoc (name, Vbuffer_alist)); + return Fcdr (assoc_ignore_text_properties (name, Vbuffer_alist)); } DEFUN ("get-file-buffer", Fget_file_buffer, Sget_file_buffer, 1, 1, 0, @@ -258,7 +279,11 @@ The value is never nil.") b->mark = Fmake_marker (); /*b->number = make_number (++buffer_count);*/ + + name = Fcopy_sequence (name); + INITIALIZE_INTERVAL (XSTRING (name), NULL_INTERVAL); b->name = name; + if (XSTRING (name)->data[0] != ' ') b->undo_list = Qnil; else @@ -627,6 +652,18 @@ If BUFFER is omitted or nil, some interesting buffer is returned.") continue; if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ') continue; +#ifdef MULTI_FRAME + /* If the selected frame has a buffer_predicate, + disregard buffers that don't fit the predicate. */ + tem = frame_buffer_predicate (); + if (!NILP (tem)) + { + tem = call1 (tem, buf); + if (NILP (tem)) + continue; + } +#endif + if (NILP (visible_ok)) tem = Fget_buffer_window (buf, Qt); else