diff options
| author | Michal Nazarewicz | 2013-06-30 18:29:23 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-06-30 18:29:23 -0400 |
| commit | ef099a941f7fb2d74ce1768388463f18b284f9c5 (patch) | |
| tree | 1573bfacf90fc940c297c5428c132e9e65318716 /src/buffer.c | |
| parent | 6d89e343ab402851d94e37b2ca79a67e4c6fb474 (diff) | |
| download | emacs-ef099a941f7fb2d74ce1768388463f18b284f9c5.tar.gz emacs-ef099a941f7fb2d74ce1768388463f18b284f9c5.zip | |
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.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); |