aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 4e0dbe778ef..3bb80c66ee6 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -154,6 +154,12 @@ static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay
154static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); 154static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t);
155static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool); 155static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool);
156 156
157static void
158CHECK_OVERLAY (Lisp_Object x)
159{
160 CHECK_TYPE (OVERLAYP (x), Qoverlayp, x);
161}
162
157/* These setters are used only in this file, so they can be private. */ 163/* These setters are used only in this file, so they can be private. */
158static void 164static void
159bset_abbrev_mode (struct buffer *b, Lisp_Object val) 165bset_abbrev_mode (struct buffer *b, Lisp_Object val)
@@ -1543,7 +1549,7 @@ candidate_buffer (Lisp_Object b, Lisp_Object buffer)
1543 && BUFFER_LIVE_P (XBUFFER (b)) 1549 && BUFFER_LIVE_P (XBUFFER (b))
1544 && !BUFFER_HIDDEN_P (XBUFFER (b))); 1550 && !BUFFER_HIDDEN_P (XBUFFER (b)));
1545} 1551}
1546 1552
1547DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, 1553DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0,
1548 doc: /* Return most recently selected buffer other than BUFFER. 1554 doc: /* Return most recently selected buffer other than BUFFER.
1549Buffers not visible in windows are preferred to visible buffers, unless 1555Buffers not visible in windows are preferred to visible buffers, unless
@@ -1732,18 +1738,6 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1732 if (!BUFFER_LIVE_P (b)) 1738 if (!BUFFER_LIVE_P (b))
1733 return Qnil; 1739 return Qnil;
1734 1740
1735 /* Query if the buffer is still modified. */
1736 if (INTERACTIVE && !NILP (BVAR (b, filename))
1737 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
1738 {
1739 GCPRO1 (buffer);
1740 tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ",
1741 BVAR (b, name), make_number (0)));
1742 UNGCPRO;
1743 if (NILP (tem))
1744 return Qnil;
1745 }
1746
1747 /* Run hooks with the buffer to be killed the current buffer. */ 1741 /* Run hooks with the buffer to be killed the current buffer. */
1748 { 1742 {
1749 ptrdiff_t count = SPECPDL_INDEX (); 1743 ptrdiff_t count = SPECPDL_INDEX ();
@@ -1759,6 +1753,22 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1759 if (NILP (tem)) 1753 if (NILP (tem))
1760 return unbind_to (count, Qnil); 1754 return unbind_to (count, Qnil);
1761 1755
1756 /* Query if the buffer is still modified. */
1757 if (INTERACTIVE && !NILP (BVAR (b, filename))
1758 && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
1759 {
1760 GCPRO1 (buffer);
1761 tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ",
1762 BVAR (b, name), make_number (0)));
1763 UNGCPRO;
1764 if (NILP (tem))
1765 return unbind_to (count, Qnil);
1766 }
1767
1768 /* If the hooks have killed the buffer, exit now. */
1769 if (!BUFFER_LIVE_P (b))
1770 return unbind_to (count, Qt);
1771
1762 /* Then run the hooks. */ 1772 /* Then run the hooks. */
1763 Frun_hooks (1, &Qkill_buffer_hook); 1773 Frun_hooks (1, &Qkill_buffer_hook);
1764 unbind_to (count, Qnil); 1774 unbind_to (count, Qnil);