diff options
| author | Tom Tromey | 2013-07-06 23:18:58 -0600 |
|---|---|---|
| committer | Tom Tromey | 2013-07-06 23:18:58 -0600 |
| commit | 6dacdad5fcb278e5a16b38bb81786aac9ca27be4 (patch) | |
| tree | f5f331ea361ba0f99e0f9b638d183ad492a7da31 /src/buffer.c | |
| parent | 0a6f2ff0c8ceb29703e76cddd46ea3f176dd873a (diff) | |
| parent | 219afb88d9d484393418820d1c08dc93299110ec (diff) | |
| download | emacs-6dacdad5fcb278e5a16b38bb81786aac9ca27be4.tar.gz emacs-6dacdad5fcb278e5a16b38bb81786aac9ca27be4.zip | |
merge from trunk
this merges frmo trunk and fixes various build issues.
this needed a few ugly tweaks.
this hangs in "make check" now
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 | |||
| 148 | static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); | 148 | static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 149 | static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool); | 149 | static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool); |
| 150 | 150 | ||
| 151 | static void | ||
| 152 | CHECK_OVERLAY (Lisp_Object x) | ||
| 153 | { | ||
| 154 | CHECK_TYPE (OVERLAYP (x), Qoverlayp, x); | ||
| 155 | } | ||
| 156 | |||
| 151 | /* These setters are used only in this file, so they can be private. */ | 157 | /* These setters are used only in this file, so they can be private. */ |
| 152 | static void | 158 | static void |
| 153 | bset_abbrev_mode (struct buffer *b, Lisp_Object val) | 159 | bset_abbrev_mode (struct buffer *b, Lisp_Object val) |
| @@ -1537,7 +1543,7 @@ candidate_buffer (Lisp_Object b, Lisp_Object buffer) | |||
| 1537 | && BUFFER_LIVE_P (XBUFFER (b)) | 1543 | && BUFFER_LIVE_P (XBUFFER (b)) |
| 1538 | && !BUFFER_HIDDEN_P (XBUFFER (b))); | 1544 | && !BUFFER_HIDDEN_P (XBUFFER (b))); |
| 1539 | } | 1545 | } |
| 1540 | 1546 | ||
| 1541 | DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, | 1547 | DEFUN ("other-buffer", Fother_buffer, Sother_buffer, 0, 3, 0, |
| 1542 | doc: /* Return most recently selected buffer other than BUFFER. | 1548 | doc: /* Return most recently selected buffer other than BUFFER. |
| 1543 | Buffers not visible in windows are preferred to visible buffers, unless | 1549 | 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. */) | |||
| 1729 | if (thread_check_current_buffer (b)) | 1735 | if (thread_check_current_buffer (b)) |
| 1730 | return Qnil; | 1736 | return Qnil; |
| 1731 | 1737 | ||
| 1732 | /* Query if the buffer is still modified. */ | ||
| 1733 | if (INTERACTIVE && !NILP (BVAR (b, filename)) | ||
| 1734 | && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) | ||
| 1735 | { | ||
| 1736 | GCPRO1 (buffer); | ||
| 1737 | tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", | ||
| 1738 | BVAR (b, name), make_number (0))); | ||
| 1739 | UNGCPRO; | ||
| 1740 | if (NILP (tem)) | ||
| 1741 | return Qnil; | ||
| 1742 | } | ||
| 1743 | |||
| 1744 | /* Run hooks with the buffer to be killed the current buffer. */ | 1738 | /* Run hooks with the buffer to be killed the current buffer. */ |
| 1745 | { | 1739 | { |
| 1746 | ptrdiff_t count = SPECPDL_INDEX (); | 1740 | ptrdiff_t count = SPECPDL_INDEX (); |
| @@ -1756,6 +1750,22 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1756 | if (NILP (tem)) | 1750 | if (NILP (tem)) |
| 1757 | return unbind_to (count, Qnil); | 1751 | return unbind_to (count, Qnil); |
| 1758 | 1752 | ||
| 1753 | /* Query if the buffer is still modified. */ | ||
| 1754 | if (INTERACTIVE && !NILP (BVAR (b, filename)) | ||
| 1755 | && BUF_MODIFF (b) > BUF_SAVE_MODIFF (b)) | ||
| 1756 | { | ||
| 1757 | GCPRO1 (buffer); | ||
| 1758 | tem = do_yes_or_no_p (format2 ("Buffer %s modified; kill anyway? ", | ||
| 1759 | BVAR (b, name), make_number (0))); | ||
| 1760 | UNGCPRO; | ||
| 1761 | if (NILP (tem)) | ||
| 1762 | return unbind_to (count, Qnil); | ||
| 1763 | } | ||
| 1764 | |||
| 1765 | /* If the hooks have killed the buffer, exit now. */ | ||
| 1766 | if (!BUFFER_LIVE_P (b)) | ||
| 1767 | return unbind_to (count, Qt); | ||
| 1768 | |||
| 1759 | /* Then run the hooks. */ | 1769 | /* Then run the hooks. */ |
| 1760 | Frun_hooks (1, &Qkill_buffer_hook); | 1770 | Frun_hooks (1, &Qkill_buffer_hook); |
| 1761 | unbind_to (count, Qnil); | 1771 | unbind_to (count, Qnil); |
| @@ -4594,7 +4604,6 @@ evaporate_overlays (ptrdiff_t pos) | |||
| 4594 | 4604 | ||
| 4595 | #ifdef USE_MMAP_FOR_BUFFERS | 4605 | #ifdef USE_MMAP_FOR_BUFFERS |
| 4596 | 4606 | ||
| 4597 | #include <sys/types.h> | ||
| 4598 | #include <sys/mman.h> | 4607 | #include <sys/mman.h> |
| 4599 | 4608 | ||
| 4600 | #ifndef MAP_ANON | 4609 | #ifndef MAP_ANON |
| @@ -4609,8 +4618,6 @@ evaporate_overlays (ptrdiff_t pos) | |||
| 4609 | #define MAP_FAILED ((void *) -1) | 4618 | #define MAP_FAILED ((void *) -1) |
| 4610 | #endif | 4619 | #endif |
| 4611 | 4620 | ||
| 4612 | #include <stdio.h> | ||
| 4613 | |||
| 4614 | #if MAP_ANON == 0 | 4621 | #if MAP_ANON == 0 |
| 4615 | #include <fcntl.h> | 4622 | #include <fcntl.h> |
| 4616 | #endif | 4623 | #endif |
| @@ -4720,7 +4727,7 @@ mmap_init (void) | |||
| 4720 | if (mmap_fd <= 0) | 4727 | if (mmap_fd <= 0) |
| 4721 | { | 4728 | { |
| 4722 | /* No anonymous mmap -- we need the file descriptor. */ | 4729 | /* No anonymous mmap -- we need the file descriptor. */ |
| 4723 | mmap_fd = open ("/dev/zero", O_RDONLY); | 4730 | mmap_fd = emacs_open ("/dev/zero", O_RDONLY, 0); |
| 4724 | if (mmap_fd == -1) | 4731 | if (mmap_fd == -1) |
| 4725 | fatal ("Cannot open /dev/zero: %s", emacs_strerror (errno)); | 4732 | fatal ("Cannot open /dev/zero: %s", emacs_strerror (errno)); |
| 4726 | } | 4733 | } |