diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/buffer.c b/src/buffer.c index e78962e1550..2555b5c17ac 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -148,6 +148,12 @@ static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool); +static void +CHECK_OVERLAY (Lisp_Object x) +{ + CHECK_TYPE (OVERLAYP (x), Qoverlayp, x); +} + /* These setters are used only in this file, so they can be private. */ static void bset_abbrev_mode (struct buffer *b, Lisp_Object val) @@ -1537,7 +1543,7 @@ candidate_buffer (Lisp_Object b, Lisp_Object buffer) && BUFFER_LIVE_P (XBUFFER (b)) && !BUFFER_HIDDEN_P (XBUFFER (b))); } - + DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, doc: /* Return most recently selected buffer other than BUFFER. Buffers not visible in windows are preferred to visible buffers, unless @@ -1729,18 +1735,6 @@ cleaning up all windows currently displaying the buffer to be killed. */) if (thread_check_current_buffer (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 (); @@ -1756,6 +1750,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); @@ -4594,7 +4604,6 @@ evaporate_overlays (ptrdiff_t pos) #ifdef USE_MMAP_FOR_BUFFERS -#include <sys/types.h> #include <sys/mman.h> #ifndef MAP_ANON @@ -4609,8 +4618,6 @@ evaporate_overlays (ptrdiff_t pos) #define MAP_FAILED ((void *) -1) #endif -#include <stdio.h> - #if MAP_ANON == 0 #include <fcntl.h> #endif @@ -4720,7 +4727,7 @@ mmap_init (void) if (mmap_fd <= 0) { /* No anonymous mmap -- we need the file descriptor. */ - mmap_fd = open ("/dev/zero", O_RDONLY); + mmap_fd = emacs_open ("/dev/zero", O_RDONLY, 0); if (mmap_fd == -1) fatal ("Cannot open /dev/zero: %s", emacs_strerror (errno)); } |
