diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/buffer.c b/src/buffer.c index 08299daa7dc..ad670e0a121 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1734,18 +1734,6 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1734 | if (!BUFFER_LIVE_P (b)) | 1734 | if (!BUFFER_LIVE_P (b)) |
| 1735 | return Qnil; | 1735 | return Qnil; |
| 1736 | 1736 | ||
| 1737 | /* Query if the buffer is still modified. */ | ||
| 1738 | if (INTERACTIVE && !NILP (BVAR (b, filename)) | ||
| 1739 | && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) | ||
| 1740 | { | ||
| 1741 | GCPRO1 (buffer); | ||
| 1742 | tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", | ||
| 1743 | BVAR (b, name), make_number (0))); | ||
| 1744 | UNGCPRO; | ||
| 1745 | if (NILP (tem)) | ||
| 1746 | return Qnil; | ||
| 1747 | } | ||
| 1748 | |||
| 1749 | /* Run hooks with the buffer to be killed the current buffer. */ | 1737 | /* Run hooks with the buffer to be killed the current buffer. */ |
| 1750 | { | 1738 | { |
| 1751 | ptrdiff_t count = SPECPDL_INDEX (); | 1739 | ptrdiff_t count = SPECPDL_INDEX (); |
| @@ -1761,6 +1749,22 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1761 | if (NILP (tem)) | 1749 | if (NILP (tem)) |
| 1762 | return unbind_to (count, Qnil); | 1750 | return unbind_to (count, Qnil); |
| 1763 | 1751 | ||
| 1752 | /* Query if the buffer is still modified. */ | ||
| 1753 | if (INTERACTIVE && !NILP (BVAR (b, filename)) | ||
| 1754 | && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) | ||
| 1755 | { | ||
| 1756 | GCPRO1 (buffer); | ||
| 1757 | tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", | ||
| 1758 | BVAR (b, name), make_number (0))); | ||
| 1759 | UNGCPRO; | ||
| 1760 | if (NILP (tem)) | ||
| 1761 | return unbind_to (count, Qnil); | ||
| 1762 | } | ||
| 1763 | |||
| 1764 | /* If the hooks have killed the buffer, exit now. */ | ||
| 1765 | if (!BUFFER_LIVE_P (b)) | ||
| 1766 | return unbind_to (count, Qt); | ||
| 1767 | |||
| 1764 | /* Then run the hooks. */ | 1768 | /* Then run the hooks. */ |
| 1765 | Frun_hooks (1, &Qkill_buffer_hook); | 1769 | Frun_hooks (1, &Qkill_buffer_hook); |
| 1766 | unbind_to (count, Qnil); | 1770 | unbind_to (count, Qnil); |