diff options
| author | Dmitry Antipov | 2012-09-11 08:22:03 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-09-11 08:22:03 +0400 |
| commit | e578f3813ff7f48663eb4821caee267e3ec47aa8 (patch) | |
| tree | b48cd4a8fb778a2a991a342932d357fa8ba4ccc2 /src | |
| parent | 3057e615af94af8d08f475208c7e459f5d7115ac (diff) | |
| download | emacs-e578f3813ff7f48663eb4821caee267e3ec47aa8.tar.gz emacs-e578f3813ff7f48663eb4821caee267e3ec47aa8.zip | |
Convenient macro to check whether the buffer is live.
* buffer.h (BUFFER_LIVE_P): New macro.
* alloc.c, buffer.c, editfns.c, insdel.c, lread.c, marker.c:
* minibuf.c, print.c, process.c, window.c, xdisp.c: Use it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/alloc.c | 2 | ||||
| -rw-r--r-- | src/buffer.c | 32 | ||||
| -rw-r--r-- | src/buffer.h | 5 | ||||
| -rw-r--r-- | src/editfns.c | 6 | ||||
| -rw-r--r-- | src/insdel.c | 2 | ||||
| -rw-r--r-- | src/lread.c | 2 | ||||
| -rw-r--r-- | src/marker.c | 8 | ||||
| -rw-r--r-- | src/minibuf.c | 2 | ||||
| -rw-r--r-- | src/print.c | 2 | ||||
| -rw-r--r-- | src/process.c | 4 | ||||
| -rw-r--r-- | src/window.c | 14 | ||||
| -rw-r--r-- | src/xdisp.c | 4 |
13 files changed, 50 insertions, 40 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 362d0b775b0..cecd31ddab4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-09-11 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Convenient macro to check whether the buffer is live. | ||
| 4 | * buffer.h (BUFFER_LIVE_P): New macro. | ||
| 5 | * alloc.c, buffer.c, editfns.c, insdel.c, lread.c, marker.c: | ||
| 6 | * minibuf.c, print.c, process.c, window.c, xdisp.c: Use it. | ||
| 7 | |||
| 1 | 2012-09-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 8 | 2012-09-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 9 | ||
| 3 | * xdisp.c (right_overwritten, right_overwriting): Also handle gstring | 10 | * xdisp.c (right_overwritten, right_overwriting): Also handle gstring |
diff --git a/src/alloc.c b/src/alloc.c index 33dc68df48e..7bbc0abcd9a 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3682,7 +3682,7 @@ build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos) | |||
| 3682 | struct Lisp_Marker *m; | 3682 | struct Lisp_Marker *m; |
| 3683 | 3683 | ||
| 3684 | /* No dead buffers here. */ | 3684 | /* No dead buffers here. */ |
| 3685 | eassert (!NILP (BVAR (buf, name))); | 3685 | eassert (BUFFER_LIVE_P (buf)); |
| 3686 | 3686 | ||
| 3687 | /* Every character is at least one byte. */ | 3687 | /* Every character is at least one byte. */ |
| 3688 | eassert (charpos <= bytepos); | 3688 | eassert (charpos <= bytepos); |
diff --git a/src/buffer.c b/src/buffer.c index 3af45122a0d..d512547d34e 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -388,7 +388,7 @@ DEFUN ("buffer-live-p", Fbuffer_live_p, Sbuffer_live_p, 1, 1, 0, | |||
| 388 | Value is nil if OBJECT is not a buffer or if it has been killed. */) | 388 | Value is nil if OBJECT is not a buffer or if it has been killed. */) |
| 389 | (Lisp_Object object) | 389 | (Lisp_Object object) |
| 390 | { | 390 | { |
| 391 | return ((BUFFERP (object) && ! NILP (BVAR (XBUFFER (object), name))) | 391 | return ((BUFFERP (object) && BUFFER_LIVE_P (XBUFFER (object))) |
| 392 | ? Qt : Qnil); | 392 | ? Qt : Qnil); |
| 393 | } | 393 | } |
| 394 | 394 | ||
| @@ -776,7 +776,7 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 776 | base_buffer = Fget_buffer (base_buffer); | 776 | base_buffer = Fget_buffer (base_buffer); |
| 777 | if (NILP (base_buffer)) | 777 | if (NILP (base_buffer)) |
| 778 | error ("No such buffer: `%s'", SDATA (tem)); | 778 | error ("No such buffer: `%s'", SDATA (tem)); |
| 779 | if (NILP (BVAR (XBUFFER (base_buffer), name))) | 779 | if (!BUFFER_LIVE_P (XBUFFER (base_buffer))) |
| 780 | error ("Base buffer has been killed"); | 780 | error ("Base buffer has been killed"); |
| 781 | 781 | ||
| 782 | if (SCHARS (name) == 0) | 782 | if (SCHARS (name) == 0) |
| @@ -1553,7 +1553,7 @@ exists, return the buffer `*scratch*' (creating it if necessary). */) | |||
| 1553 | { | 1553 | { |
| 1554 | buf = XCAR (tail); | 1554 | buf = XCAR (tail); |
| 1555 | if (BUFFERP (buf) && !EQ (buf, buffer) | 1555 | if (BUFFERP (buf) && !EQ (buf, buffer) |
| 1556 | && !NILP (BVAR (XBUFFER (buf), name)) | 1556 | && BUFFER_LIVE_P (XBUFFER (buf)) |
| 1557 | && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ') | 1557 | && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ') |
| 1558 | /* If the frame has a buffer_predicate, disregard buffers that | 1558 | /* If the frame has a buffer_predicate, disregard buffers that |
| 1559 | don't fit the predicate. */ | 1559 | don't fit the predicate. */ |
| @@ -1573,7 +1573,7 @@ exists, return the buffer `*scratch*' (creating it if necessary). */) | |||
| 1573 | { | 1573 | { |
| 1574 | buf = Fcdr (XCAR (tail)); | 1574 | buf = Fcdr (XCAR (tail)); |
| 1575 | if (BUFFERP (buf) && !EQ (buf, buffer) | 1575 | if (BUFFERP (buf) && !EQ (buf, buffer) |
| 1576 | && !NILP (BVAR (XBUFFER (buf), name)) | 1576 | && BUFFER_LIVE_P (XBUFFER (buf)) |
| 1577 | && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ') | 1577 | && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ') |
| 1578 | /* If the frame has a buffer_predicate, disregard buffers that | 1578 | /* If the frame has a buffer_predicate, disregard buffers that |
| 1579 | don't fit the predicate. */ | 1579 | don't fit the predicate. */ |
| @@ -1615,7 +1615,7 @@ other_buffer_safely (Lisp_Object buffer) | |||
| 1615 | { | 1615 | { |
| 1616 | buf = Fcdr (XCAR (tail)); | 1616 | buf = Fcdr (XCAR (tail)); |
| 1617 | if (BUFFERP (buf) && !EQ (buf, buffer) | 1617 | if (BUFFERP (buf) && !EQ (buf, buffer) |
| 1618 | && !NILP (BVAR (XBUFFER (buf), name)) | 1618 | && BUFFER_LIVE_P (XBUFFER (buf)) |
| 1619 | && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ')) | 1619 | && (SREF (BVAR (XBUFFER (buf), name), 0) != ' ')) |
| 1620 | return buf; | 1620 | return buf; |
| 1621 | } | 1621 | } |
| @@ -1734,7 +1734,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1734 | b = XBUFFER (buffer); | 1734 | b = XBUFFER (buffer); |
| 1735 | 1735 | ||
| 1736 | /* Avoid trouble for buffer already dead. */ | 1736 | /* Avoid trouble for buffer already dead. */ |
| 1737 | if (NILP (BVAR (b, name))) | 1737 | if (!BUFFER_LIVE_P (b)) |
| 1738 | return Qnil; | 1738 | return Qnil; |
| 1739 | 1739 | ||
| 1740 | /* Query if the buffer is still modified. */ | 1740 | /* Query if the buffer is still modified. */ |
| @@ -1770,7 +1770,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1770 | } | 1770 | } |
| 1771 | 1771 | ||
| 1772 | /* If the hooks have killed the buffer, exit now. */ | 1772 | /* If the hooks have killed the buffer, exit now. */ |
| 1773 | if (NILP (BVAR (b, name))) | 1773 | if (!BUFFER_LIVE_P (b)) |
| 1774 | return Qt; | 1774 | return Qt; |
| 1775 | 1775 | ||
| 1776 | /* We have no more questions to ask. Verify that it is valid | 1776 | /* We have no more questions to ask. Verify that it is valid |
| @@ -1802,7 +1802,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1802 | UNGCPRO; | 1802 | UNGCPRO; |
| 1803 | 1803 | ||
| 1804 | /* Exit if we now have killed the base buffer (Bug#11665). */ | 1804 | /* Exit if we now have killed the base buffer (Bug#11665). */ |
| 1805 | if (NILP (BVAR (b, name))) | 1805 | if (!BUFFER_LIVE_P (b)) |
| 1806 | return Qt; | 1806 | return Qt; |
| 1807 | } | 1807 | } |
| 1808 | 1808 | ||
| @@ -1813,7 +1813,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1813 | replace_buffer_in_windows (buffer); | 1813 | replace_buffer_in_windows (buffer); |
| 1814 | 1814 | ||
| 1815 | /* Exit if replacing the buffer in windows has killed our buffer. */ | 1815 | /* Exit if replacing the buffer in windows has killed our buffer. */ |
| 1816 | if (NILP (BVAR (b, name))) | 1816 | if (!BUFFER_LIVE_P (b)) |
| 1817 | return Qt; | 1817 | return Qt; |
| 1818 | 1818 | ||
| 1819 | /* Make this buffer not be current. Exit if it is the sole visible | 1819 | /* Make this buffer not be current. Exit if it is the sole visible |
| @@ -1846,7 +1846,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1846 | 1846 | ||
| 1847 | /* Killing buffer processes may run sentinels which may have killed | 1847 | /* Killing buffer processes may run sentinels which may have killed |
| 1848 | our buffer. */ | 1848 | our buffer. */ |
| 1849 | if (NILP (BVAR (b, name))) | 1849 | if (!BUFFER_LIVE_P (b)) |
| 1850 | return Qt; | 1850 | return Qt; |
| 1851 | 1851 | ||
| 1852 | /* These may run Lisp code and into infinite loops (if someone | 1852 | /* These may run Lisp code and into infinite loops (if someone |
| @@ -1878,7 +1878,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1878 | } | 1878 | } |
| 1879 | 1879 | ||
| 1880 | /* Deleting an auto-save file could have killed our buffer. */ | 1880 | /* Deleting an auto-save file could have killed our buffer. */ |
| 1881 | if (NILP (BVAR (b, name))) | 1881 | if (!BUFFER_LIVE_P (b)) |
| 1882 | return Qt; | 1882 | return Qt; |
| 1883 | 1883 | ||
| 1884 | if (b->base_buffer) | 1884 | if (b->base_buffer) |
| @@ -2047,7 +2047,7 @@ the current buffer's major mode. */) | |||
| 2047 | 2047 | ||
| 2048 | CHECK_BUFFER (buffer); | 2048 | CHECK_BUFFER (buffer); |
| 2049 | 2049 | ||
| 2050 | if (NILP (BVAR (XBUFFER (buffer), name))) | 2050 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) |
| 2051 | error ("Attempt to set major mode for a dead buffer"); | 2051 | error ("Attempt to set major mode for a dead buffer"); |
| 2052 | 2052 | ||
| 2053 | if (strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0) | 2053 | if (strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0) |
| @@ -2183,7 +2183,7 @@ ends when the current command terminates. Use `switch-to-buffer' or | |||
| 2183 | buffer = Fget_buffer (buffer_or_name); | 2183 | buffer = Fget_buffer (buffer_or_name); |
| 2184 | if (NILP (buffer)) | 2184 | if (NILP (buffer)) |
| 2185 | nsberror (buffer_or_name); | 2185 | nsberror (buffer_or_name); |
| 2186 | if (NILP (BVAR (XBUFFER (buffer), name))) | 2186 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) |
| 2187 | error ("Selecting deleted buffer"); | 2187 | error ("Selecting deleted buffer"); |
| 2188 | set_buffer_internal (XBUFFER (buffer)); | 2188 | set_buffer_internal (XBUFFER (buffer)); |
| 2189 | return buffer; | 2189 | return buffer; |
| @@ -2194,7 +2194,7 @@ ends when the current command terminates. Use `switch-to-buffer' or | |||
| 2194 | Lisp_Object | 2194 | Lisp_Object |
| 2195 | set_buffer_if_live (Lisp_Object buffer) | 2195 | set_buffer_if_live (Lisp_Object buffer) |
| 2196 | { | 2196 | { |
| 2197 | if (! NILP (BVAR (XBUFFER (buffer), name))) | 2197 | if (BUFFER_LIVE_P (XBUFFER (buffer))) |
| 2198 | set_buffer_internal (XBUFFER (buffer)); | 2198 | set_buffer_internal (XBUFFER (buffer)); |
| 2199 | return Qnil; | 2199 | return Qnil; |
| 2200 | } | 2200 | } |
| @@ -2289,7 +2289,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2289 | CHECK_BUFFER (buffer); | 2289 | CHECK_BUFFER (buffer); |
| 2290 | other_buffer = XBUFFER (buffer); | 2290 | other_buffer = XBUFFER (buffer); |
| 2291 | 2291 | ||
| 2292 | if (NILP (BVAR (other_buffer, name))) | 2292 | if (!BUFFER_LIVE_P (other_buffer)) |
| 2293 | error ("Cannot swap a dead buffer's text"); | 2293 | error ("Cannot swap a dead buffer's text"); |
| 2294 | 2294 | ||
| 2295 | /* Actually, it probably works just fine. | 2295 | /* Actually, it probably works just fine. |
| @@ -2685,7 +2685,7 @@ current buffer is cleared. */) | |||
| 2685 | /* Copy this buffer's new multibyte status | 2685 | /* Copy this buffer's new multibyte status |
| 2686 | into all of its indirect buffers. */ | 2686 | into all of its indirect buffers. */ |
| 2687 | FOR_EACH_BUFFER (other) | 2687 | FOR_EACH_BUFFER (other) |
| 2688 | if (other->base_buffer == current_buffer && !NILP (BVAR (other, name))) | 2688 | if (other->base_buffer == current_buffer && BUFFER_LIVE_P (other)) |
| 2689 | { | 2689 | { |
| 2690 | BVAR (other, enable_multibyte_characters) | 2690 | BVAR (other, enable_multibyte_characters) |
| 2691 | = BVAR (current_buffer, enable_multibyte_characters); | 2691 | = BVAR (current_buffer, enable_multibyte_characters); |
diff --git a/src/buffer.h b/src/buffer.h index da40a7ce3d8..d18ef30ea38 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -959,7 +959,10 @@ bset_width_table (struct buffer *b, Lisp_Object val) | |||
| 959 | b->INTERNAL_FIELD (width_table) = val; | 959 | b->INTERNAL_FIELD (width_table) = val; |
| 960 | } | 960 | } |
| 961 | 961 | ||
| 962 | 962 | /* Convenient check whether buffer B is live. */ | |
| 963 | |||
| 964 | #define BUFFER_LIVE_P(b) (!NILP (BVAR (b, name))) | ||
| 965 | |||
| 963 | /* Chain of all buffers, including killed ones. */ | 966 | /* Chain of all buffers, including killed ones. */ |
| 964 | 967 | ||
| 965 | extern struct buffer *all_buffers; | 968 | extern struct buffer *all_buffers; |
diff --git a/src/editfns.c b/src/editfns.c index 65baaf4e3f8..299cad07fd7 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -2613,7 +2613,7 @@ They default to the values of (point-min) and (point-max) in BUFFER. */) | |||
| 2613 | if (NILP (buf)) | 2613 | if (NILP (buf)) |
| 2614 | nsberror (buffer); | 2614 | nsberror (buffer); |
| 2615 | bp = XBUFFER (buf); | 2615 | bp = XBUFFER (buf); |
| 2616 | if (NILP (BVAR (bp, name))) | 2616 | if (!BUFFER_LIVE_P (bp)) |
| 2617 | error ("Selecting deleted buffer"); | 2617 | error ("Selecting deleted buffer"); |
| 2618 | 2618 | ||
| 2619 | if (NILP (start)) | 2619 | if (NILP (start)) |
| @@ -2677,7 +2677,7 @@ determines whether case is significant or ignored. */) | |||
| 2677 | if (NILP (buf1)) | 2677 | if (NILP (buf1)) |
| 2678 | nsberror (buffer1); | 2678 | nsberror (buffer1); |
| 2679 | bp1 = XBUFFER (buf1); | 2679 | bp1 = XBUFFER (buf1); |
| 2680 | if (NILP (BVAR (bp1, name))) | 2680 | if (!BUFFER_LIVE_P (bp1)) |
| 2681 | error ("Selecting deleted buffer"); | 2681 | error ("Selecting deleted buffer"); |
| 2682 | } | 2682 | } |
| 2683 | 2683 | ||
| @@ -2715,7 +2715,7 @@ determines whether case is significant or ignored. */) | |||
| 2715 | if (NILP (buf2)) | 2715 | if (NILP (buf2)) |
| 2716 | nsberror (buffer2); | 2716 | nsberror (buffer2); |
| 2717 | bp2 = XBUFFER (buf2); | 2717 | bp2 = XBUFFER (buf2); |
| 2718 | if (NILP (BVAR (bp2, name))) | 2718 | if (!BUFFER_LIVE_P (bp2)) |
| 2719 | error ("Selecting deleted buffer"); | 2719 | error ("Selecting deleted buffer"); |
| 2720 | } | 2720 | } |
| 2721 | 2721 | ||
diff --git a/src/insdel.c b/src/insdel.c index 604a9bbf3df..b12a390633e 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -2107,7 +2107,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute, | |||
| 2107 | non-nil, and insertion calls a file handler (e.g. through | 2107 | non-nil, and insertion calls a file handler (e.g. through |
| 2108 | lock_file) which scribbles into a temp file -- cyd */ | 2108 | lock_file) which scribbles into a temp file -- cyd */ |
| 2109 | if (!BUFFERP (combine_after_change_buffer) | 2109 | if (!BUFFERP (combine_after_change_buffer) |
| 2110 | || NILP (BVAR (XBUFFER (combine_after_change_buffer), name))) | 2110 | || !BUFFER_LIVE_P (XBUFFER (combine_after_change_buffer))) |
| 2111 | { | 2111 | { |
| 2112 | combine_after_change_list = Qnil; | 2112 | combine_after_change_list = Qnil; |
| 2113 | return Qnil; | 2113 | return Qnil; |
diff --git a/src/lread.c b/src/lread.c index 02b13affb6a..08a2e856c00 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1734,7 +1734,7 @@ readevalloop (Lisp_Object readcharfun, | |||
| 1734 | { | 1734 | { |
| 1735 | ptrdiff_t count1 = SPECPDL_INDEX (); | 1735 | ptrdiff_t count1 = SPECPDL_INDEX (); |
| 1736 | 1736 | ||
| 1737 | if (b != 0 && NILP (BVAR (b, name))) | 1737 | if (b != 0 && !BUFFER_LIVE_P (b)) |
| 1738 | error ("Reading from killed buffer"); | 1738 | error ("Reading from killed buffer"); |
| 1739 | 1739 | ||
| 1740 | if (!NILP (start)) | 1740 | if (!NILP (start)) |
diff --git a/src/marker.c b/src/marker.c index de3c19c3bcb..bfbb161a71d 100644 --- a/src/marker.c +++ b/src/marker.c | |||
| @@ -407,7 +407,7 @@ Returns nil if MARKER points into a dead buffer. */) | |||
| 407 | does not preserve the buffer from being GC'd (it's weak), so | 407 | does not preserve the buffer from being GC'd (it's weak), so |
| 408 | markers have to be unlinked from their buffer as soon as the buffer | 408 | markers have to be unlinked from their buffer as soon as the buffer |
| 409 | is killed. */ | 409 | is killed. */ |
| 410 | eassert (!NILP (BVAR (XBUFFER (buf), name))); | 410 | eassert (BUFFER_LIVE_P (XBUFFER (buf))); |
| 411 | return buf; | 411 | return buf; |
| 412 | } | 412 | } |
| 413 | return Qnil; | 413 | return Qnil; |
| @@ -462,13 +462,13 @@ live_buffer (Lisp_Object buffer) | |||
| 462 | if (NILP (buffer)) | 462 | if (NILP (buffer)) |
| 463 | { | 463 | { |
| 464 | b = current_buffer; | 464 | b = current_buffer; |
| 465 | eassert (!NILP (BVAR (b, name))); | 465 | eassert (BUFFER_LIVE_P (b)); |
| 466 | } | 466 | } |
| 467 | else | 467 | else |
| 468 | { | 468 | { |
| 469 | CHECK_BUFFER (buffer); | 469 | CHECK_BUFFER (buffer); |
| 470 | b = XBUFFER (buffer); | 470 | b = XBUFFER (buffer); |
| 471 | if (NILP (BVAR (b, name))) | 471 | if (!BUFFER_LIVE_P (b)) |
| 472 | b = NULL; | 472 | b = NULL; |
| 473 | } | 473 | } |
| 474 | return b; | 474 | return b; |
| @@ -595,7 +595,7 @@ unchain_marker (register struct Lisp_Marker *marker) | |||
| 595 | register struct Lisp_Marker *tail, **prev; | 595 | register struct Lisp_Marker *tail, **prev; |
| 596 | 596 | ||
| 597 | /* No dead buffers here. */ | 597 | /* No dead buffers here. */ |
| 598 | eassert (!NILP (BVAR (b, name))); | 598 | eassert (BUFFER_LIVE_P (b)); |
| 599 | 599 | ||
| 600 | marker->buffer = NULL; | 600 | marker->buffer = NULL; |
| 601 | prev = &BUF_MARKERS (b); | 601 | prev = &BUF_MARKERS (b); |
diff --git a/src/minibuf.c b/src/minibuf.c index 655a02f5eca..4ed480a8408 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -798,7 +798,7 @@ get_minibuffer (EMACS_INT depth) | |||
| 798 | Vminibuffer_list = nconc2 (Vminibuffer_list, tail); | 798 | Vminibuffer_list = nconc2 (Vminibuffer_list, tail); |
| 799 | } | 799 | } |
| 800 | buf = Fcar (tail); | 800 | buf = Fcar (tail); |
| 801 | if (NILP (buf) || NILP (BVAR (XBUFFER (buf), name))) | 801 | if (NILP (buf) || !BUFFER_LIVE_P (XBUFFER (buf))) |
| 802 | { | 802 | { |
| 803 | buf = Fget_buffer_create | 803 | buf = Fget_buffer_create |
| 804 | (make_formatted_string (name, " *Minibuf-%"pI"d*", depth)); | 804 | (make_formatted_string (name, " *Minibuf-%"pI"d*", depth)); |
diff --git a/src/print.c b/src/print.c index ab86ee1a8b5..16116643ad0 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1873,7 +1873,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1873 | } | 1873 | } |
| 1874 | else if (BUFFERP (obj)) | 1874 | else if (BUFFERP (obj)) |
| 1875 | { | 1875 | { |
| 1876 | if (NILP (BVAR (XBUFFER (obj), name))) | 1876 | if (!BUFFER_LIVE_P (XBUFFER (obj))) |
| 1877 | strout ("#<killed buffer>", -1, -1, printcharfun); | 1877 | strout ("#<killed buffer>", -1, -1, printcharfun); |
| 1878 | else if (escapeflag) | 1878 | else if (escapeflag) |
| 1879 | { | 1879 | { |
diff --git a/src/process.c b/src/process.c index 0cc9bc353a1..0ae68567d6b 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -5298,7 +5298,7 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5298 | } | 5298 | } |
| 5299 | 5299 | ||
| 5300 | /* If no filter, write into buffer if it isn't dead. */ | 5300 | /* If no filter, write into buffer if it isn't dead. */ |
| 5301 | else if (!NILP (p->buffer) && !NILP (BVAR (XBUFFER (p->buffer), name))) | 5301 | else if (!NILP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer))) |
| 5302 | { | 5302 | { |
| 5303 | Lisp_Object old_read_only; | 5303 | Lisp_Object old_read_only; |
| 5304 | ptrdiff_t old_begv, old_zv; | 5304 | ptrdiff_t old_begv, old_zv; |
| @@ -6722,7 +6722,7 @@ status_notify (struct Lisp_Process *deleting_process) | |||
| 6722 | 6722 | ||
| 6723 | /* Avoid error if buffer is deleted | 6723 | /* Avoid error if buffer is deleted |
| 6724 | (probably that's why the process is dead, too) */ | 6724 | (probably that's why the process is dead, too) */ |
| 6725 | if (NILP (BVAR (XBUFFER (buffer), name))) | 6725 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) |
| 6726 | continue; | 6726 | continue; |
| 6727 | Fset_buffer (buffer); | 6727 | Fset_buffer (buffer); |
| 6728 | 6728 | ||
diff --git a/src/window.c b/src/window.c index 1869a3b65cf..4a833a120b3 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -2668,7 +2668,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2668 | /* Check for a window that has a killed buffer. */ | 2668 | /* Check for a window that has a killed buffer. */ |
| 2669 | case CHECK_ALL_WINDOWS: | 2669 | case CHECK_ALL_WINDOWS: |
| 2670 | if (! NILP (w->buffer) | 2670 | if (! NILP (w->buffer) |
| 2671 | && NILP (BVAR (XBUFFER (w->buffer), name))) | 2671 | && !BUFFER_LIVE_P (XBUFFER (w->buffer))) |
| 2672 | emacs_abort (); | 2672 | emacs_abort (); |
| 2673 | break; | 2673 | break; |
| 2674 | 2674 | ||
| @@ -3273,7 +3273,7 @@ This function runs `window-scroll-functions' before running | |||
| 3273 | XSETWINDOW (window, w); | 3273 | XSETWINDOW (window, w); |
| 3274 | buffer = Fget_buffer (buffer_or_name); | 3274 | buffer = Fget_buffer (buffer_or_name); |
| 3275 | CHECK_BUFFER (buffer); | 3275 | CHECK_BUFFER (buffer); |
| 3276 | if (NILP (BVAR (XBUFFER (buffer), name))) | 3276 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) |
| 3277 | error ("Attempt to display deleted buffer"); | 3277 | error ("Attempt to display deleted buffer"); |
| 3278 | 3278 | ||
| 3279 | tem = w->buffer; | 3279 | tem = w->buffer; |
| @@ -3338,7 +3338,7 @@ displaying that buffer. */) | |||
| 3338 | 3338 | ||
| 3339 | if (STRINGP (object)) | 3339 | if (STRINGP (object)) |
| 3340 | object = Fget_buffer (object); | 3340 | object = Fget_buffer (object); |
| 3341 | if (BUFFERP (object) && !NILP (BVAR (XBUFFER (object), name))) | 3341 | if (BUFFERP (object) && BUFFER_LIVE_P (XBUFFER (object))) |
| 3342 | { | 3342 | { |
| 3343 | /* Walk all windows looking for buffer, and force update | 3343 | /* Walk all windows looking for buffer, and force update |
| 3344 | of each of those windows. */ | 3344 | of each of those windows. */ |
| @@ -5549,7 +5549,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5549 | saved_windows = XVECTOR (data->saved_windows); | 5549 | saved_windows = XVECTOR (data->saved_windows); |
| 5550 | 5550 | ||
| 5551 | new_current_buffer = data->current_buffer; | 5551 | new_current_buffer = data->current_buffer; |
| 5552 | if (NILP (BVAR (XBUFFER (new_current_buffer), name))) | 5552 | if (!BUFFER_LIVE_P (XBUFFER (new_current_buffer))) |
| 5553 | new_current_buffer = Qnil; | 5553 | new_current_buffer = Qnil; |
| 5554 | else | 5554 | else |
| 5555 | { | 5555 | { |
| @@ -5624,7 +5624,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5624 | w = XWINDOW (window); | 5624 | w = XWINDOW (window); |
| 5625 | if (!NILP (w->buffer) | 5625 | if (!NILP (w->buffer) |
| 5626 | && !EQ (w->buffer, p->buffer) | 5626 | && !EQ (w->buffer, p->buffer) |
| 5627 | && !NILP (BVAR (XBUFFER (p->buffer), name))) | 5627 | && BUFFER_LIVE_P (XBUFFER (p->buffer))) |
| 5628 | /* If a window we restore gets another buffer, record the | 5628 | /* If a window we restore gets another buffer, record the |
| 5629 | window's old buffer. */ | 5629 | window's old buffer. */ |
| 5630 | call1 (Qrecord_window_buffer, window); | 5630 | call1 (Qrecord_window_buffer, window); |
| @@ -5774,7 +5774,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5774 | if (NILP (p->buffer)) | 5774 | if (NILP (p->buffer)) |
| 5775 | /* An internal window. */ | 5775 | /* An internal window. */ |
| 5776 | wset_buffer (w, p->buffer); | 5776 | wset_buffer (w, p->buffer); |
| 5777 | else if (!NILP (BVAR (XBUFFER (p->buffer), name))) | 5777 | else if (BUFFER_LIVE_P (XBUFFER (p->buffer))) |
| 5778 | /* If saved buffer is alive, install it. */ | 5778 | /* If saved buffer is alive, install it. */ |
| 5779 | { | 5779 | { |
| 5780 | wset_buffer (w, p->buffer); | 5780 | wset_buffer (w, p->buffer); |
| @@ -5793,7 +5793,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5793 | Fgoto_char (w->pointm); | 5793 | Fgoto_char (w->pointm); |
| 5794 | } | 5794 | } |
| 5795 | else if (!NILP (w->buffer) | 5795 | else if (!NILP (w->buffer) |
| 5796 | && !NILP (BVAR (XBUFFER (w->buffer), name))) | 5796 | && BUFFER_LIVE_P (XBUFFER (w->buffer))) |
| 5797 | /* Keep window's old buffer; make sure the markers are | 5797 | /* Keep window's old buffer; make sure the markers are |
| 5798 | real. */ | 5798 | real. */ |
| 5799 | { | 5799 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index 1deda682192..c1e05d6df15 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3667,7 +3667,7 @@ handle_fontified_prop (struct it *it) | |||
| 3667 | } | 3667 | } |
| 3668 | /* There isn't much we can reasonably do to protect against | 3668 | /* There isn't much we can reasonably do to protect against |
| 3669 | misbehaving fontification, but here's a fig leaf. */ | 3669 | misbehaving fontification, but here's a fig leaf. */ |
| 3670 | else if (!NILP (BVAR (obuf, name))) | 3670 | else if (BUFFER_LIVE_P (obuf)) |
| 3671 | set_buffer_internal_1 (obuf); | 3671 | set_buffer_internal_1 (obuf); |
| 3672 | 3672 | ||
| 3673 | /* The fontification code may have added/removed text. | 3673 | /* The fontification code may have added/removed text. |
| @@ -9910,7 +9910,7 @@ ensure_echo_area_buffers (void) | |||
| 9910 | 9910 | ||
| 9911 | for (i = 0; i < 2; ++i) | 9911 | for (i = 0; i < 2; ++i) |
| 9912 | if (!BUFFERP (echo_buffer[i]) | 9912 | if (!BUFFERP (echo_buffer[i]) |
| 9913 | || NILP (BVAR (XBUFFER (echo_buffer[i]), name))) | 9913 | || !BUFFER_LIVE_P (XBUFFER (echo_buffer[i]))) |
| 9914 | { | 9914 | { |
| 9915 | char name[30]; | 9915 | char name[30]; |
| 9916 | Lisp_Object old_buffer; | 9916 | Lisp_Object old_buffer; |