aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2014-09-14 17:20:21 -0700
committerGlenn Morris2014-09-14 17:20:21 -0700
commit11af46027d22daa11d0df7d5032e6925c990dad1 (patch)
tree4d0d528afaf7449dba3cb73af0745980306c57d0
parent5ce52d05c93e0c006bbd145b938aa9fab7dfcb8d (diff)
parentd4dc0e1691a15efd1ea0a8793cf889e683a37933 (diff)
downloademacs-11af46027d22daa11d0df7d5032e6925c990dad1.tar.gz
emacs-11af46027d22daa11d0df7d5032e6925c990dad1.zip
Merge from emacs-24; up to 2014-07-09T02:04:12Z!rgm@gnu.org
-rw-r--r--ChangeLog5
-rw-r--r--configure.ac2
-rw-r--r--etc/NEWS11
-rw-r--r--lisp/ChangeLog27
-rw-r--r--lisp/calendar/diary-lib.el20
-rw-r--r--lisp/desktop.el4
-rw-r--r--lisp/image.el4
-rw-r--r--lisp/mouse.el17
-rw-r--r--lisp/window.el2
-rw-r--r--src/ChangeLog37
-rw-r--r--src/nsterm.m17
-rw-r--r--src/sound.c17
-rw-r--r--src/w32.c56
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c17
15 files changed, 193 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index aa7c6405bcf..597c2eb0f90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
12014-09-15 Eli Zaretskii <eliz@gnu.org>
2
3 * configure.ac (HAVE_SOUND): Check for mmsystem.h header that
4 defines the sound stuff on MS-Windows. (Bug#18463)
5
12014-09-10 Paul Eggert <eggert@cs.ucla.edu> 62014-09-10 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 Improve the experimental local and scoped allocation. 8 Improve the experimental local and scoped allocation.
diff --git a/configure.ac b/configure.ac
index 93487246f29..16b891f8786 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1443,7 +1443,7 @@ AC_DEFUN([EMACS_CHECK_MODULES],
1443HAVE_SOUND=no 1443HAVE_SOUND=no
1444if test "${with_sound}" != "no"; then 1444if test "${with_sound}" != "no"; then
1445 # Sound support for GNU/Linux, the free BSDs, and MinGW. 1445 # Sound support for GNU/Linux, the free BSDs, and MinGW.
1446 AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h soundcard.h], 1446 AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h soundcard.h mmsystem.h],
1447 have_sound_header=yes, [], [ 1447 have_sound_header=yes, [], [
1448 #ifdef __MINGW32__ 1448 #ifdef __MINGW32__
1449 #define WIN32_LEAN_AND_MEAN 1449 #define WIN32_LEAN_AND_MEAN
diff --git a/etc/NEWS b/etc/NEWS
index 95f578ce11d..398a39ea9f8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -533,9 +533,6 @@ of the buffer is visible).
533 533
534*** New display actions functions for `display-buffer': 534*** New display actions functions for `display-buffer':
535 535
536**** `display-buffer-in-previous-window' displays a buffer in a window
537previously showing that buffer.
538
539**** `display-buffer-at-bottom' chooses or creates a window at the 536**** `display-buffer-at-bottom' chooses or creates a window at the
540bottom of the selected frame. 537bottom of the selected frame.
541 538
@@ -545,6 +542,9 @@ bottom of the selected frame.
545caller of `display-buffer' is ready to handle the case of not displaying 542caller of `display-buffer' is ready to handle the case of not displaying
546the buffer in a window. 543the buffer in a window.
547 544
545*** `display-buffer-in-previous-window' is now a member of
546`display-buffer-fallback-action'.
547
548** Lisp evaluation 548** Lisp evaluation
549 549
550*** `eval-defun' on an already defined defcustom calls the :set function, 550*** `eval-defun' on an already defined defcustom calls the :set function,
@@ -1417,6 +1417,11 @@ and can be accessed by calling the `coding-system-type' function.)
1417 1417
1418*** `with-demoted-errors' takes an additional argument `format'. 1418*** `with-demoted-errors' takes an additional argument `format'.
1419 1419
1420*** Errors from timer functions are no longer silently discarded,
1421but are reported as messages. So you may see "Error running timer"
1422messages from code that was failing silently till now. Set
1423`debug-on-error' non-nil to get a real error and a backtrace.
1424
1420** Faces 1425** Faces
1421 1426
1422*** Face specs set via Custom themes now replace the `defface' spec 1427*** Face specs set via Custom themes now replace the `defface' spec
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b9990cbe594..9b844bf38cb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,30 @@
12014-09-15 Glenn Morris <rgm@gnu.org>
2
3 * image.el (image-multi-frame-p): Fix thinko - do not force
4 a delay if none was specified. (Bug#18334)
5
62014-09-15 Kan-Ru Chen <kanru@kanru.info>
7
8 * window.el (fit-window-to-buffer): Doc fix.
9
102014-09-15 Ivan Shmakov <ivan@siamics.net> (tiny change)
11
12 * desktop.el (desktop-create-buffer): Check that buffers are still live
13 before burying them (bug#18373).
14
152014-09-15 Glenn Morris <rgm@gnu.org>
16
17 * calendar/diary-lib.el (diary-list-entries):
18 Restore 24.3 display behavior. (Bug#18381)
19
202014-09-15 Eli Zaretskii <eliz@gnu.org>
21
22 * mouse.el (mouse-drag-line): On text-mode frames, count the mode
23 line and header line as 1 pixel. This fixes the 1-"pixel" (row)
24 discrepancy between window-pixel-edges and mouse events, and
25 avoids moving mode line up when the mouse click is on the modeline
26 and no drag is attempted.
27
12014-09-14 Daniel Colascione <dancol@dancol.org> 282014-09-14 Daniel Colascione <dancol@dancol.org>
2 29
3 * register.el (insert-register): Change default interactive 30 * register.el (insert-register): Change default interactive
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 155af0da623..17937c87fc9 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -901,12 +901,20 @@ LIST-ONLY is non-nil, in which case it just returns the list."
901 ;;; (diary-include-other-diary-files) ; recurse 901 ;;; (diary-include-other-diary-files) ; recurse
902 ;;; (run-hooks 'diary-list-entries-hook)) 902 ;;; (run-hooks 'diary-list-entries-hook))
903 (unless list-only 903 (unless list-only
904 (if (and diary-display-function 904 ;; Avoid M-x diary; M-x calendar; M-x diary
905 (listp diary-display-function)) 905 ;; clobbering the calendar window.
906 ;; Backwards compatibility. 906 ;; FIXME this is not the right solution.
907 (run-hooks 'diary-display-function) 907 (let ((display-buffer-fallback-action
908 (funcall (or diary-display-function 908 (list (delq
909 'diary-simple-display)))) 909 'display-buffer-in-previous-window
910 (copy-sequence
911 (car display-buffer-fallback-action))))))
912 (if (and diary-display-function
913 (listp diary-display-function))
914 ;; Backwards compatibility.
915 (run-hooks 'diary-display-function)
916 (funcall (or diary-display-function
917 'diary-simple-display)))))
910 (run-hooks 'diary-hook))))) 918 (run-hooks 'diary-hook)))))
911 (and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff))) 919 (and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff)))
912 (or d-incp (message "Preparing diary...done")) 920 (or d-incp (message "Preparing diary...done"))
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 40e6b364e45..360ff48339b 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1375,7 +1375,9 @@ after that many seconds of idle time."
1375 ;; Restore buffer list order with new buffer at end. Don't change 1375 ;; Restore buffer list order with new buffer at end. Don't change
1376 ;; the order for old desktop files (old desktop module behavior). 1376 ;; the order for old desktop files (old desktop module behavior).
1377 (unless (< desktop-file-version 206) 1377 (unless (< desktop-file-version 206)
1378 (mapc 'bury-buffer buffer-list) 1378 (dolist (buf buffer-list)
1379 (and (buffer-live-p buf)
1380 (bury-buffer buf)))
1379 (when result (bury-buffer result))) 1381 (when result (bury-buffer result)))
1380 (when result 1382 (when result
1381 (unless (or desktop-first-buffer (< desktop-file-version 206)) 1383 (unless (or desktop-first-buffer (< desktop-file-version 206))
diff --git a/lisp/image.el b/lisp/image.el
index ef39fa7909f..8430d36a627 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -637,8 +637,8 @@ in which case you might want to use `image-default-frame-delay'."
637 (images (plist-get metadata 'count)) 637 (images (plist-get metadata 'count))
638 (delay (plist-get metadata 'delay))) 638 (delay (plist-get metadata 'delay)))
639 (when (and images (> images 1)) 639 (when (and images (> images 1))
640 (if (or (not (numberp delay)) (< delay 0)) 640 (and delay (or (not (numberp delay)) (< delay 0))
641 (setq delay image-default-frame-delay)) 641 (setq delay image-default-frame-delay))
642 (cons images delay))))) 642 (cons images delay)))))
643 643
644(defun image-animated-p (image) 644(defun image-animated-p (image)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index a10f4d67593..93bd6283158 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -396,7 +396,16 @@ must be one of the symbols `header', `mode', or `vertical'."
396 ;; Check whether header-line can be dragged at all. 396 ;; Check whether header-line can be dragged at all.
397 (if (window-at-side-p window 'top) 397 (if (window-at-side-p window 'top)
398 (setq draggable nil) 398 (setq draggable nil)
399 (setq height (/ (window-header-line-height window) 2)) 399 ;; window-pixel-edges includes the header and mode lines, so
400 ;; we need to account for that when calculating window growth.
401 ;; On GUI frames, assume the mouse is approximately in the
402 ;; middle of the header/mode line, so we need only half the
403 ;; height in pixels.
404 (setq height
405 (cond
406 ((display-graphic-p frame)
407 (/ (window-header-line-height window) 2))
408 (t (window-header-line-height window))))
400 (setq window (window-in-direction 'above window t)))) 409 (setq window (window-in-direction 'above window t))))
401 ((eq line 'mode) 410 ((eq line 'mode)
402 ;; Check whether mode-line can be dragged at all. 411 ;; Check whether mode-line can be dragged at all.
@@ -411,7 +420,11 @@ must be one of the symbols `header', `mode', or `vertical'."
411 (eq minibuffer-window 420 (eq minibuffer-window
412 (active-minibuffer-window)))))) 421 (active-minibuffer-window))))))
413 (setq draggable nil) 422 (setq draggable nil)
414 (setq height (/ (window-mode-line-height window) 2)))) 423 (setq height
424 (cond
425 ((display-graphic-p frame)
426 (/ (window-mode-line-height window) 2))
427 (t (window-mode-line-height window))))))
415 ((eq line 'vertical) 428 ((eq line 'vertical)
416 ;; Get the window to adjust for the vertical case. If the scroll 429 ;; Get the window to adjust for the vertical case. If the scroll
417 ;; bar is on the window's right or we drag a vertical divider, 430 ;; bar is on the window's right or we drag a vertical divider,
diff --git a/lisp/window.el b/lisp/window.el
index d88f2901197..c19392f1fe9 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -7260,7 +7260,7 @@ and header line and a bottom divider, if any.
7260 7260
7261If WINDOW is part of a horizontal combination and the value of 7261If WINDOW is part of a horizontal combination and the value of
7262the option `fit-window-to-buffer-horizontally' is non-nil, adjust 7262the option `fit-window-to-buffer-horizontally' is non-nil, adjust
7263WINDOW's height. The new width of WINDOW is calculated from the 7263WINDOW's width. The new width of WINDOW is calculated from the
7264maximum length of its buffer's lines that follow the current 7264maximum length of its buffer's lines that follow the current
7265start position of WINDOW. The optional argument MAX-WIDTH 7265start position of WINDOW. The optional argument MAX-WIDTH
7266specifies a maximum width and defaults to the width of WINDOW's 7266specifies a maximum width and defaults to the width of WINDOW's
diff --git a/src/ChangeLog b/src/ChangeLog
index 015ed3618cf..5f1dfbfe785 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,40 @@
12014-09-15 Eli Zaretskii <eliz@gnu.org>
2
3 * w32.c (fcntl): Support O_NONBLOCK fcntl on the write side of pipes.
4 (sys_write): When a write to a non-blocking pipe returns ENOSPC,
5 set errno to EAGAIN instead, to allow the caller to retry the
6 write after some waiting. Fixes deadlocks when Emacs exchanges a
7 lot of data through the pipe. (Bug#18420)
8
9 * sound.c (Fplay_sound_internal): Encode the sound file name in
10 the ANSI codepage. Expand it against data-directory, as per docs,
11 not against the current directory. No need to make a local copy
12 of the file name; pass the encoded file name directly to
13 do_play_sound. (Bug#18463)
14
15 * w32.c (ansi_encode_filename): If w32_get_short_filename returns
16 NULL, and the file name is not encodable in ANSI codepage, return
17 the string with "?" replacement characters, which will fail the
18 caller. This avoids returning a random value in that case.
19
202014-09-15 Martin Rudalics <rudalics@gmx.at>
21
22 * window.c (Fresize_mini_window_internal): Set w->total_lines
23 from w->pixel_height (Bug#18422).
24
252014-09-15 Jan Djärv <jan.h.d@swipnet.se>
26
27 * nsterm.m (updateFrameSize:, initFrameFromEmacs:)
28 (toggleFullScreen:): Take frame_resize_pixelwise into account when
29 setting resize increments (Bug#18435).
30
312014-09-15 Eli Zaretskii <eliz@gnu.org>
32
33 * xdisp.c (pos_visible_p): Properly save and restore the iterator
34 state around the call to line_bottom, since it can move the
35 iterator to another screen line. This fixes off-by-one errors in
36 the reported row in some rare cases.
37
12014-09-14 Jan Djärv <jan.h.d@swipnet.se> 382014-09-14 Jan Djärv <jan.h.d@swipnet.se>
2 39
3 * callproc.c (init_callproc): Fix bug introduced at 40 * callproc.c (init_callproc): Fix bug introduced at
diff --git a/src/nsterm.m b/src/nsterm.m
index dc775fc417a..5f86369a8c4 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -5849,10 +5849,13 @@ not_in_argv (NSString *arg)
5849 5849
5850 // Did resize increments change because of a font change? 5850 // Did resize increments change because of a font change?
5851 if (sz.width != FRAME_COLUMN_WIDTH (emacsframe) || 5851 if (sz.width != FRAME_COLUMN_WIDTH (emacsframe) ||
5852 sz.height != FRAME_LINE_HEIGHT (emacsframe)) 5852 sz.height != FRAME_LINE_HEIGHT (emacsframe) ||
5853 (frame_resize_pixelwise && sz.width != 1))
5853 { 5854 {
5854 sz.width = FRAME_COLUMN_WIDTH (emacsframe); 5855 sz.width = frame_resize_pixelwise
5855 sz.height = FRAME_LINE_HEIGHT (emacsframe); 5856 ? 1 : FRAME_COLUMN_WIDTH (emacsframe);
5857 sz.height = frame_resize_pixelwise
5858 ? 1 : FRAME_LINE_HEIGHT (emacsframe);
5856 [win setResizeIncrements: sz]; 5859 [win setResizeIncrements: sz];
5857 5860
5858 NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); 5861 NSTRACE_SIZE ("New size", NSMakeSize (neww, newh));
@@ -6122,8 +6125,8 @@ if (cols > 0 && rows > 0)
6122 [win setDelegate: self]; 6125 [win setDelegate: self];
6123 [win useOptimizedDrawing: YES]; 6126 [win useOptimizedDrawing: YES];
6124 6127
6125 sz.width = FRAME_COLUMN_WIDTH (f); 6128 sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f);
6126 sz.height = FRAME_LINE_HEIGHT (f); 6129 sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f);
6127 [win setResizeIncrements: sz]; 6130 [win setResizeIncrements: sz];
6128 6131
6129 [[win contentView] addSubview: self]; 6132 [[win contentView] addSubview: self];
@@ -6470,8 +6473,8 @@ if (cols > 0 && rows > 0)
6470 (FRAME_DEFAULT_FACE (f)), 6473 (FRAME_DEFAULT_FACE (f)),
6471 f); 6474 f);
6472 6475
6473 sz.width = FRAME_COLUMN_WIDTH (f); 6476 sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f);
6474 sz.height = FRAME_LINE_HEIGHT (f); 6477 sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f);
6475 6478
6476 if (fs_state != FULLSCREEN_BOTH) 6479 if (fs_state != FULLSCREEN_BOTH)
6477 { 6480 {
diff --git a/src/sound.c b/src/sound.c
index 9351097138d..7ba14b36f33 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -88,6 +88,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
88#include <limits.h> 88#include <limits.h>
89#include <windows.h> 89#include <windows.h>
90#include <mmsystem.h> 90#include <mmsystem.h>
91
92#include "coding.h"
93#include "w32.h"
91/* END: Windows Specific Includes */ 94/* END: Windows Specific Includes */
92 95
93#endif /* WINDOWSNT */ 96#endif /* WINDOWSNT */
@@ -1310,8 +1313,7 @@ Internal use only, use `play-sound' instead. */)
1310 struct gcpro gcpro1, gcpro2; 1313 struct gcpro gcpro1, gcpro2;
1311 Lisp_Object args[2]; 1314 Lisp_Object args[2];
1312#else /* WINDOWSNT */ 1315#else /* WINDOWSNT */
1313 Lisp_Object lo_file = {0}; 1316 Lisp_Object lo_file;
1314 char * psz_file = NULL;
1315 unsigned long ui_volume_tmp = UINT_MAX; 1317 unsigned long ui_volume_tmp = UINT_MAX;
1316 unsigned long ui_volume = UINT_MAX; 1318 unsigned long ui_volume = UINT_MAX;
1317#endif /* WINDOWSNT */ 1319#endif /* WINDOWSNT */
@@ -1384,10 +1386,11 @@ Internal use only, use `play-sound' instead. */)
1384 1386
1385#else /* WINDOWSNT */ 1387#else /* WINDOWSNT */
1386 1388
1387 lo_file = Fexpand_file_name (attrs[SOUND_FILE], Qnil); 1389 lo_file = Fexpand_file_name (attrs[SOUND_FILE], Vdata_directory);
1388 len = XSTRING (lo_file)->size; 1390 lo_file = ENCODE_FILE (lo_file);
1389 psz_file = alloca (len + 1); 1391 /* Since UNICOWS.DLL includes only a stub for mciSendStringW, we
1390 strcpy (psz_file, XSTRING (lo_file)->data); 1392 need to encode the file in the ANSI codepage. */
1393 lo_file = ansi_encode_filename (lo_file);
1391 if (INTEGERP (attrs[SOUND_VOLUME])) 1394 if (INTEGERP (attrs[SOUND_VOLUME]))
1392 { 1395 {
1393 ui_volume_tmp = XFASTINT (attrs[SOUND_VOLUME]); 1396 ui_volume_tmp = XFASTINT (attrs[SOUND_VOLUME]);
@@ -1409,7 +1412,7 @@ Internal use only, use `play-sound' instead. */)
1409 { 1412 {
1410 ui_volume = ui_volume_tmp * (UINT_MAX / 100); 1413 ui_volume = ui_volume_tmp * (UINT_MAX / 100);
1411 } 1414 }
1412 do_play_sound (psz_file, ui_volume); 1415 do_play_sound (SDATA (lo_file), ui_volume);
1413 1416
1414#endif /* WINDOWSNT */ 1417#endif /* WINDOWSNT */
1415 1418
diff --git a/src/w32.c b/src/w32.c
index cc0d0af3445..95e6d394ee0 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2391,6 +2391,8 @@ ansi_encode_filename (Lisp_Object filename)
2391 dostounix_filename (shortname); 2391 dostounix_filename (shortname);
2392 encoded_filename = build_string (shortname); 2392 encoded_filename = build_string (shortname);
2393 } 2393 }
2394 else
2395 encoded_filename = build_unibyte_string (fname);
2394 } 2396 }
2395 else 2397 else
2396 encoded_filename = build_unibyte_string (fname); 2398 encoded_filename = build_unibyte_string (fname);
@@ -7720,15 +7722,15 @@ fcntl (int s, int cmd, int options)
7720 if (cmd == F_DUPFD_CLOEXEC) 7722 if (cmd == F_DUPFD_CLOEXEC)
7721 return sys_dup (s); 7723 return sys_dup (s);
7722 7724
7723 if (winsock_lib == NULL)
7724 {
7725 errno = ENETDOWN;
7726 return -1;
7727 }
7728
7729 check_errno (); 7725 check_errno ();
7730 if (fd_info[s].flags & FILE_SOCKET) 7726 if (fd_info[s].flags & FILE_SOCKET)
7731 { 7727 {
7728 if (winsock_lib == NULL)
7729 {
7730 errno = ENETDOWN;
7731 return -1;
7732 }
7733
7732 if (cmd == F_SETFL && options == O_NONBLOCK) 7734 if (cmd == F_SETFL && options == O_NONBLOCK)
7733 { 7735 {
7734 unsigned long nblock = 1; 7736 unsigned long nblock = 1;
@@ -7745,13 +7747,36 @@ fcntl (int s, int cmd, int options)
7745 return SOCKET_ERROR; 7747 return SOCKET_ERROR;
7746 } 7748 }
7747 } 7749 }
7750 else if ((fd_info[s].flags & (FILE_PIPE | FILE_WRITE))
7751 == (FILE_PIPE | FILE_WRITE))
7752 {
7753 /* Force our writes to pipes be non-blocking. */
7754 if (cmd == F_SETFL && options == O_NONBLOCK)
7755 {
7756 HANDLE h = (HANDLE)_get_osfhandle (s);
7757 DWORD pipe_mode = PIPE_NOWAIT;
7758
7759 if (!SetNamedPipeHandleState (h, &pipe_mode, NULL, NULL))
7760 {
7761 DebPrint (("SetNamedPipeHandleState: %lu\n", GetLastError ()));
7762 return SOCKET_ERROR;
7763 }
7764 fd_info[s].flags |= FILE_NDELAY;
7765 return 0;
7766 }
7767 else
7768 {
7769 errno = EINVAL;
7770 return SOCKET_ERROR;
7771 }
7772 }
7748 errno = ENOTSOCK; 7773 errno = ENOTSOCK;
7749 return SOCKET_ERROR; 7774 return SOCKET_ERROR;
7750} 7775}
7751 7776
7752 7777
7753/* Shadow main io functions: we need to handle pipes and sockets more 7778/* Shadow main io functions: we need to handle pipes and sockets more
7754 intelligently, and implement non-blocking mode as well. */ 7779 intelligently. */
7755 7780
7756int 7781int
7757sys_close (int fd) 7782sys_close (int fd)
@@ -8236,7 +8261,6 @@ sys_read (int fd, char * buffer, unsigned int count)
8236/* From w32xfns.c */ 8261/* From w32xfns.c */
8237extern HANDLE interrupt_handle; 8262extern HANDLE interrupt_handle;
8238 8263
8239/* For now, don't bother with a non-blocking mode */
8240int 8264int
8241sys_write (int fd, const void * buffer, unsigned int count) 8265sys_write (int fd, const void * buffer, unsigned int count)
8242{ 8266{
@@ -8388,6 +8412,22 @@ sys_write (int fd, const void * buffer, unsigned int count)
8388 nchars += n; 8412 nchars += n;
8389 if (n < 0) 8413 if (n < 0)
8390 { 8414 {
8415 /* When there's no buffer space in a pipe that is in the
8416 non-blocking mode, _write returns ENOSPC. We return
8417 EAGAIN instead, which should trigger the logic in
8418 send_process that enters waiting loop and calls
8419 wait_reading_process_output to allow process input to
8420 be accepted during the wait. Those calls to
8421 wait_reading_process_output allow sys_select to
8422 notice when process input becomes available, thus
8423 avoiding deadlock whereby each side of the pipe is
8424 blocked on write, waiting for the other party to read
8425 its end of the pipe. */
8426 if (errno == ENOSPC
8427 && fd < MAXDESC
8428 && ((fd_info[fd].flags & (FILE_PIPE | FILE_NDELAY))
8429 == (FILE_PIPE | FILE_NDELAY)))
8430 errno = EAGAIN;
8391 nchars = n; 8431 nchars = n;
8392 break; 8432 break;
8393 } 8433 }
diff --git a/src/window.c b/src/window.c
index 8736fe13c3b..ce651abdda9 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4796,10 +4796,10 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4796 block_input (); 4796 block_input ();
4797 window_resize_apply (r, 0); 4797 window_resize_apply (r, 0);
4798 4798
4799 w->total_lines = XFASTINT (w->new_total);
4800 w->top_line = r->top_line + r->total_lines;
4801 w->pixel_height = XFASTINT (w->new_pixel); 4799 w->pixel_height = XFASTINT (w->new_pixel);
4800 w->total_lines = w->pixel_height / FRAME_LINE_HEIGHT (f);
4802 w->pixel_top = r->pixel_top + r->pixel_height; 4801 w->pixel_top = r->pixel_top + r->pixel_height;
4802 w->top_line = r->top_line + r->total_lines;
4803 4803
4804 fset_redisplay (f); 4804 fset_redisplay (f);
4805 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4805 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
diff --git a/src/xdisp.c b/src/xdisp.c
index d02caba5c19..1c6362d0345 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1455,15 +1455,19 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1455 glyph. */ 1455 glyph. */
1456 int top_x = it.current_x; 1456 int top_x = it.current_x;
1457 int top_y = it.current_y; 1457 int top_y = it.current_y;
1458 /* Calling line_bottom_y may change it.method, it.position, etc. */
1459 enum it_method it_method = it.method;
1460 int bottom_y = (last_height = 0, line_bottom_y (&it));
1461 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); 1458 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);
1459 int bottom_y;
1460 struct it save_it;
1461 void *save_it_data = NULL;
1462 1462
1463 /* Calling line_bottom_y may change it.method, it.position, etc. */
1464 SAVE_IT (save_it, it, save_it_data);
1465 last_height = 0;
1466 bottom_y = line_bottom_y (&it);
1463 if (top_y < window_top_y) 1467 if (top_y < window_top_y)
1464 visible_p = bottom_y > window_top_y; 1468 visible_p = bottom_y > window_top_y;
1465 else if (top_y < it.last_visible_y) 1469 else if (top_y < it.last_visible_y)
1466 visible_p = true; 1470 visible_p = 1;
1467 if (bottom_y >= it.last_visible_y 1471 if (bottom_y >= it.last_visible_y
1468 && it.bidi_p && it.bidi_it.scan_dir == -1 1472 && it.bidi_p && it.bidi_it.scan_dir == -1
1469 && IT_CHARPOS (it) < charpos) 1473 && IT_CHARPOS (it) < charpos)
@@ -1476,7 +1480,6 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1476 move_it_to again with a slightly larger vertical limit, 1480 move_it_to again with a slightly larger vertical limit,
1477 and see if it actually moved vertically; if it did, we 1481 and see if it actually moved vertically; if it did, we
1478 didn't really reach CHARPOS, which is beyond window end. */ 1482 didn't really reach CHARPOS, which is beyond window end. */
1479 struct it save_it = it;
1480 /* Why 10? because we don't know how many canonical lines 1483 /* Why 10? because we don't know how many canonical lines
1481 will the height of the next line(s) be. So we guess. */ 1484 will the height of the next line(s) be. So we guess. */
1482 int ten_more_lines = 10 * default_line_pixel_height (w); 1485 int ten_more_lines = 10 * default_line_pixel_height (w);
@@ -1486,11 +1489,11 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1486 if (it.current_y > top_y) 1489 if (it.current_y > top_y)
1487 visible_p = 0; 1490 visible_p = 0;
1488 1491
1489 it = save_it;
1490 } 1492 }
1493 RESTORE_IT (&it, &save_it, save_it_data);
1491 if (visible_p) 1494 if (visible_p)
1492 { 1495 {
1493 if (it_method == GET_FROM_DISPLAY_VECTOR) 1496 if (it.method == GET_FROM_DISPLAY_VECTOR)
1494 { 1497 {
1495 /* We stopped on the last glyph of a display vector. 1498 /* We stopped on the last glyph of a display vector.
1496 Try and recompute. Hack alert! */ 1499 Try and recompute. Hack alert! */