diff options
| author | Joakim Verona | 2013-07-02 22:46:17 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-07-02 22:46:17 +0200 |
| commit | 3718127221fbbc31f8ebd027ab7c95403dbe9118 (patch) | |
| tree | ef422898f3344c8f94f6ecf63eb583122bbf2bd8 /src/buffer.c | |
| parent | 1ce45b902c67b8a0dda8d71bd2812de29a9988a6 (diff) | |
| parent | a3b49114c186d84404226af75ae7905bd1cd018f (diff) | |
| download | emacs-3718127221fbbc31f8ebd027ab7c95403dbe9118.tar.gz emacs-3718127221fbbc31f8ebd027ab7c95403dbe9118.zip | |
Merge branch 'trunk' into xwidget
Conflicts:
src/window.c
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 36 |
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 | |||
| 154 | static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); | 154 | static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 155 | static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool); | 155 | static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool); |
| 156 | 156 | ||
| 157 | static void | ||
| 158 | CHECK_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. */ |
| 158 | static void | 164 | static void |
| 159 | bset_abbrev_mode (struct buffer *b, Lisp_Object val) | 165 | bset_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 | ||
| 1547 | DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, | 1553 | DEFUN ("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. |
| 1549 | Buffers not visible in windows are preferred to visible buffers, unless | 1555 | Buffers 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); |