summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2013-06-30 18:29:23 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2013-06-30 18:29:23 -0400
commitef099a941f7fb2d74ce1768388463f18b284f9c5 (patch)
tree1573bfacf90fc940c297c5428c132e9e65318716 /src/buffer.c
parent6d89e343ab402851d94e37b2ca79a67e4c6fb474 (diff)
downloademacs-ef099a941f7fb2d74ce1768388463f18b284f9c5.tar.gz
Add `remember-notes' function to store random notes across Emacs
restarts. * remember.el (remember-data-file): Add :set callback to affect notes buffer (if any). (remember-notes): New command. (remember-notes-buffer-name, bury-remember-notes-on-kill): New defcustoms for the `remember-notes' function. (remember-notes-save-and-bury-buffer): New command. (remember-notes-mode-map): New variable. (remember-mode): New minor mode. (remember-notes--kill-buffer-query): New function. * lisp/startup.el (initial-buffer-choice): Add notes to custom type. * src/buffer.c (FKill_buffer): Run `kill-buffer-query-functions' before checking whether buffer is modified. This lets `kill-buffer-query-functions' cancel killing of the buffer or save its content before `kill-buffer' asks user the "Buffer %s modified; kill anyway?" question. * remember.el (remember-append-to-file): Don't mix `find-buffer-visiting' and `get-file-buffer'. * lisp/files.el (find-file-noselect): Simplify conditional expression.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c28
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. */)
if (!BUFFER_LIVE_P (b))
return Qnil;
- /* Query if the buffer is still modified. */
- if (INTERACTIVE && !NILP (BVAR (b, filename))
- && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
- {
- GCPRO1 (buffer);
- tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ",
- BVAR (b, name), make_number (0)));
- UNGCPRO;
- if (NILP (tem))
- return Qnil;
- }
-
/* Run hooks with the buffer to be killed the current buffer. */
{
ptrdiff_t count = SPECPDL_INDEX ();
@@ -1761,6 +1749,22 @@ cleaning up all windows currently displaying the buffer to be killed. */)
if (NILP (tem))
return unbind_to (count, Qnil);
+ /* Query if the buffer is still modified. */
+ if (INTERACTIVE && !NILP (BVAR (b, filename))
+ && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b))
+ {
+ GCPRO1 (buffer);
+ tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ",
+ BVAR (b, name), make_number (0)));
+ UNGCPRO;
+ if (NILP (tem))
+ return unbind_to (count, Qnil);
+ }
+
+ /* If the hooks have killed the buffer, exit now. */
+ if (!BUFFER_LIVE_P (b))
+ return unbind_to (count, Qt);
+
/* Then run the hooks. */
Frun_hooks (1, &Qkill_buffer_hook);
unbind_to (count, Qnil);