diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/src/buffer.c b/src/buffer.c index dfc6b8bcc02..f9154d42b03 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -108,9 +108,9 @@ static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, | |||
| 108 | static void swap_out_buffer_local_variables (struct buffer *b); | 108 | static void swap_out_buffer_local_variables (struct buffer *b); |
| 109 | static void reset_buffer_local_variables (struct buffer *, bool); | 109 | static void reset_buffer_local_variables (struct buffer *, bool); |
| 110 | 110 | ||
| 111 | /* Alist of all buffer names vs the buffers. */ | 111 | /* Alist of all buffer names vs the buffers. This used to be |
| 112 | /* This used to be a variable, but is no longer, | 112 | a Lisp-visible variable, but is no longer, to prevent lossage |
| 113 | to prevent lossage due to user rplac'ing this alist or its elements. */ | 113 | due to user rplac'ing this alist or its elements. */ |
| 114 | Lisp_Object Vbuffer_alist; | 114 | Lisp_Object Vbuffer_alist; |
| 115 | 115 | ||
| 116 | static Lisp_Object Qkill_buffer_query_functions; | 116 | static Lisp_Object Qkill_buffer_query_functions; |
| @@ -478,8 +478,7 @@ If there is no such live buffer, return nil. | |||
| 478 | See also `find-buffer-visiting'. */) | 478 | See also `find-buffer-visiting'. */) |
| 479 | (register Lisp_Object filename) | 479 | (register Lisp_Object filename) |
| 480 | { | 480 | { |
| 481 | register Lisp_Object tail, buf, tem; | 481 | register Lisp_Object tail, buf, handler; |
| 482 | Lisp_Object handler; | ||
| 483 | 482 | ||
| 484 | CHECK_STRING (filename); | 483 | CHECK_STRING (filename); |
| 485 | filename = Fexpand_file_name (filename, Qnil); | 484 | filename = Fexpand_file_name (filename, Qnil); |
| @@ -494,13 +493,10 @@ See also `find-buffer-visiting'. */) | |||
| 494 | return BUFFERP (handled_buf) ? handled_buf : Qnil; | 493 | return BUFFERP (handled_buf) ? handled_buf : Qnil; |
| 495 | } | 494 | } |
| 496 | 495 | ||
| 497 | for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) | 496 | FOR_EACH_LIVE_BUFFER (tail, buf) |
| 498 | { | 497 | { |
| 499 | buf = Fcdr (XCAR (tail)); | ||
| 500 | if (!BUFFERP (buf)) continue; | ||
| 501 | if (!STRINGP (BVAR (XBUFFER (buf), filename))) continue; | 498 | if (!STRINGP (BVAR (XBUFFER (buf), filename))) continue; |
| 502 | tem = Fstring_equal (BVAR (XBUFFER (buf), filename), filename); | 499 | if (!NILP (Fstring_equal (BVAR (XBUFFER (buf), filename), filename))) |
| 503 | if (!NILP (tem)) | ||
| 504 | return buf; | 500 | return buf; |
| 505 | } | 501 | } |
| 506 | return Qnil; | 502 | return Qnil; |
| @@ -509,15 +505,12 @@ See also `find-buffer-visiting'. */) | |||
| 509 | Lisp_Object | 505 | Lisp_Object |
| 510 | get_truename_buffer (register Lisp_Object filename) | 506 | get_truename_buffer (register Lisp_Object filename) |
| 511 | { | 507 | { |
| 512 | register Lisp_Object tail, buf, tem; | 508 | register Lisp_Object tail, buf; |
| 513 | 509 | ||
| 514 | for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) | 510 | FOR_EACH_LIVE_BUFFER (tail, buf) |
| 515 | { | 511 | { |
| 516 | buf = Fcdr (XCAR (tail)); | ||
| 517 | if (!BUFFERP (buf)) continue; | ||
| 518 | if (!STRINGP (BVAR (XBUFFER (buf), file_truename))) continue; | 512 | if (!STRINGP (BVAR (XBUFFER (buf), file_truename))) continue; |
| 519 | tem = Fstring_equal (BVAR (XBUFFER (buf), file_truename), filename); | 513 | if (!NILP (Fstring_equal (BVAR (XBUFFER (buf), file_truename), filename))) |
| 520 | if (!NILP (tem)) | ||
| 521 | return buf; | 514 | return buf; |
| 522 | } | 515 | } |
| 523 | return Qnil; | 516 | return Qnil; |
| @@ -1581,10 +1574,8 @@ exists, return the buffer `*scratch*' (creating it if necessary). */) | |||
| 1581 | } | 1574 | } |
| 1582 | 1575 | ||
| 1583 | /* Consider alist of all buffers next. */ | 1576 | /* Consider alist of all buffers next. */ |
| 1584 | tail = Vbuffer_alist; | 1577 | FOR_EACH_LIVE_BUFFER (tail, buf) |
| 1585 | for (; CONSP (tail); tail = XCDR (tail)) | ||
| 1586 | { | 1578 | { |
| 1587 | buf = Fcdr (XCAR (tail)); | ||
| 1588 | if (candidate_buffer (buf, buffer) | 1579 | if (candidate_buffer (buf, buffer) |
| 1589 | /* If the frame has a buffer_predicate, disregard buffers that | 1580 | /* If the frame has a buffer_predicate, disregard buffers that |
| 1590 | don't fit the predicate. */ | 1581 | don't fit the predicate. */ |
| @@ -1621,12 +1612,9 @@ other_buffer_safely (Lisp_Object buffer) | |||
| 1621 | { | 1612 | { |
| 1622 | Lisp_Object tail, buf; | 1613 | Lisp_Object tail, buf; |
| 1623 | 1614 | ||
| 1624 | for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) | 1615 | FOR_EACH_LIVE_BUFFER (tail, buf) |
| 1625 | { | 1616 | if (candidate_buffer (buf, buffer)) |
| 1626 | buf = Fcdr (XCAR (tail)); | 1617 | return buf; |
| 1627 | if (candidate_buffer (buf, buffer)) | ||
| 1628 | return buf; | ||
| 1629 | } | ||
| 1630 | 1618 | ||
| 1631 | buf = Fget_buffer (build_string ("*scratch*")); | 1619 | buf = Fget_buffer (build_string ("*scratch*")); |
| 1632 | if (NILP (buf)) | 1620 | if (NILP (buf)) |