diff options
| author | Glenn Morris <rgm@gnu.org> | 2014-09-14 17:20:21 -0700 |
|---|---|---|
| committer | Glenn Morris <rgm@gnu.org> | 2014-09-14 17:20:21 -0700 |
| commit | 11af46027d22daa11d0df7d5032e6925c990dad1 (patch) | |
| tree | 4d0d528afaf7449dba3cb73af0745980306c57d0 | |
| parent | 5ce52d05c93e0c006bbd145b938aa9fab7dfcb8d (diff) | |
| parent | d4dc0e1691a15efd1ea0a8793cf889e683a37933 (diff) | |
| download | emacs-11af46027d22daa11d0df7d5032e6925c990dad1.tar.gz | |
Merge from emacs-24; up to 2014-07-09T02:04:12Z!rgm@gnu.org
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | configure.ac | 2 | ||||
| -rw-r--r-- | etc/NEWS | 11 | ||||
| -rw-r--r-- | lisp/ChangeLog | 27 | ||||
| -rw-r--r-- | lisp/calendar/diary-lib.el | 20 | ||||
| -rw-r--r-- | lisp/desktop.el | 4 | ||||
| -rw-r--r-- | lisp/image.el | 4 | ||||
| -rw-r--r-- | lisp/mouse.el | 17 | ||||
| -rw-r--r-- | lisp/window.el | 2 | ||||
| -rw-r--r-- | src/ChangeLog | 37 | ||||
| -rw-r--r-- | src/nsterm.m | 17 | ||||
| -rw-r--r-- | src/sound.c | 17 | ||||
| -rw-r--r-- | src/w32.c | 56 | ||||
| -rw-r--r-- | src/window.c | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 17 |
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 @@ +2014-09-15 Eli Zaretskii <eliz@gnu.org> + + * configure.ac (HAVE_SOUND): Check for mmsystem.h header that + defines the sound stuff on MS-Windows. (Bug#18463) + 2014-09-10 Paul Eggert <eggert@cs.ucla.edu> 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], HAVE_SOUND=no if test "${with_sound}" != "no"; then # Sound support for GNU/Linux, the free BSDs, and MinGW. - AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h soundcard.h], + AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h soundcard.h mmsystem.h], have_sound_header=yes, [], [ #ifdef __MINGW32__ #define WIN32_LEAN_AND_MEAN @@ -533,9 +533,6 @@ of the buffer is visible). *** New display actions functions for `display-buffer': -**** `display-buffer-in-previous-window' displays a buffer in a window -previously showing that buffer. - **** `display-buffer-at-bottom' chooses or creates a window at the bottom of the selected frame. @@ -545,6 +542,9 @@ bottom of the selected frame. caller of `display-buffer' is ready to handle the case of not displaying the buffer in a window. +*** `display-buffer-in-previous-window' is now a member of +`display-buffer-fallback-action'. + ** Lisp evaluation *** `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.) *** `with-demoted-errors' takes an additional argument `format'. +*** Errors from timer functions are no longer silently discarded, +but are reported as messages. So you may see "Error running timer" +messages from code that was failing silently till now. Set +`debug-on-error' non-nil to get a real error and a backtrace. + ** Faces *** 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 @@ +2014-09-15 Glenn Morris <rgm@gnu.org> + + * image.el (image-multi-frame-p): Fix thinko - do not force + a delay if none was specified. (Bug#18334) + +2014-09-15 Kan-Ru Chen <kanru@kanru.info> + + * window.el (fit-window-to-buffer): Doc fix. + +2014-09-15 Ivan Shmakov <ivan@siamics.net> (tiny change) + + * desktop.el (desktop-create-buffer): Check that buffers are still live + before burying them (bug#18373). + +2014-09-15 Glenn Morris <rgm@gnu.org> + + * calendar/diary-lib.el (diary-list-entries): + Restore 24.3 display behavior. (Bug#18381) + +2014-09-15 Eli Zaretskii <eliz@gnu.org> + + * mouse.el (mouse-drag-line): On text-mode frames, count the mode + line and header line as 1 pixel. This fixes the 1-"pixel" (row) + discrepancy between window-pixel-edges and mouse events, and + avoids moving mode line up when the mouse click is on the modeline + and no drag is attempted. + 2014-09-14 Daniel Colascione <dancol@dancol.org> * 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." ;;; (diary-include-other-diary-files) ; recurse ;;; (run-hooks 'diary-list-entries-hook)) (unless list-only - (if (and diary-display-function - (listp diary-display-function)) - ;; Backwards compatibility. - (run-hooks 'diary-display-function) - (funcall (or diary-display-function - 'diary-simple-display)))) + ;; Avoid M-x diary; M-x calendar; M-x diary + ;; clobbering the calendar window. + ;; FIXME this is not the right solution. + (let ((display-buffer-fallback-action + (list (delq + 'display-buffer-in-previous-window + (copy-sequence + (car display-buffer-fallback-action)))))) + (if (and diary-display-function + (listp diary-display-function)) + ;; Backwards compatibility. + (run-hooks 'diary-display-function) + (funcall (or diary-display-function + 'diary-simple-display))))) (run-hooks 'diary-hook))))) (and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff))) (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." ;; Restore buffer list order with new buffer at end. Don't change ;; the order for old desktop files (old desktop module behavior). (unless (< desktop-file-version 206) - (mapc 'bury-buffer buffer-list) + (dolist (buf buffer-list) + (and (buffer-live-p buf) + (bury-buffer buf))) (when result (bury-buffer result))) (when result (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'." (images (plist-get metadata 'count)) (delay (plist-get metadata 'delay))) (when (and images (> images 1)) - (if (or (not (numberp delay)) (< delay 0)) - (setq delay image-default-frame-delay)) + (and delay (or (not (numberp delay)) (< delay 0)) + (setq delay image-default-frame-delay)) (cons images delay))))) (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'." ;; Check whether header-line can be dragged at all. (if (window-at-side-p window 'top) (setq draggable nil) - (setq height (/ (window-header-line-height window) 2)) + ;; window-pixel-edges includes the header and mode lines, so + ;; we need to account for that when calculating window growth. + ;; On GUI frames, assume the mouse is approximately in the + ;; middle of the header/mode line, so we need only half the + ;; height in pixels. + (setq height + (cond + ((display-graphic-p frame) + (/ (window-header-line-height window) 2)) + (t (window-header-line-height window)))) (setq window (window-in-direction 'above window t)))) ((eq line 'mode) ;; Check whether mode-line can be dragged at all. @@ -411,7 +420,11 @@ must be one of the symbols `header', `mode', or `vertical'." (eq minibuffer-window (active-minibuffer-window)))))) (setq draggable nil) - (setq height (/ (window-mode-line-height window) 2)))) + (setq height + (cond + ((display-graphic-p frame) + (/ (window-mode-line-height window) 2)) + (t (window-mode-line-height window)))))) ((eq line 'vertical) ;; Get the window to adjust for the vertical case. If the scroll ;; 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. If WINDOW is part of a horizontal combination and the value of the option `fit-window-to-buffer-horizontally' is non-nil, adjust -WINDOW's height. The new width of WINDOW is calculated from the +WINDOW's width. The new width of WINDOW is calculated from the maximum length of its buffer's lines that follow the current start position of WINDOW. The optional argument MAX-WIDTH specifies 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 @@ +2014-09-15 Eli Zaretskii <eliz@gnu.org> + + * w32.c (fcntl): Support O_NONBLOCK fcntl on the write side of pipes. + (sys_write): When a write to a non-blocking pipe returns ENOSPC, + set errno to EAGAIN instead, to allow the caller to retry the + write after some waiting. Fixes deadlocks when Emacs exchanges a + lot of data through the pipe. (Bug#18420) + + * sound.c (Fplay_sound_internal): Encode the sound file name in + the ANSI codepage. Expand it against data-directory, as per docs, + not against the current directory. No need to make a local copy + of the file name; pass the encoded file name directly to + do_play_sound. (Bug#18463) + + * w32.c (ansi_encode_filename): If w32_get_short_filename returns + NULL, and the file name is not encodable in ANSI codepage, return + the string with "?" replacement characters, which will fail the + caller. This avoids returning a random value in that case. + +2014-09-15 Martin Rudalics <rudalics@gmx.at> + + * window.c (Fresize_mini_window_internal): Set w->total_lines + from w->pixel_height (Bug#18422). + +2014-09-15 Jan Djärv <jan.h.d@swipnet.se> + + * nsterm.m (updateFrameSize:, initFrameFromEmacs:) + (toggleFullScreen:): Take frame_resize_pixelwise into account when + setting resize increments (Bug#18435). + +2014-09-15 Eli Zaretskii <eliz@gnu.org> + + * xdisp.c (pos_visible_p): Properly save and restore the iterator + state around the call to line_bottom, since it can move the + iterator to another screen line. This fixes off-by-one errors in + the reported row in some rare cases. + 2014-09-14 Jan Djärv <jan.h.d@swipnet.se> * 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) // Did resize increments change because of a font change? if (sz.width != FRAME_COLUMN_WIDTH (emacsframe) || - sz.height != FRAME_LINE_HEIGHT (emacsframe)) + sz.height != FRAME_LINE_HEIGHT (emacsframe) || + (frame_resize_pixelwise && sz.width != 1)) { - sz.width = FRAME_COLUMN_WIDTH (emacsframe); - sz.height = FRAME_LINE_HEIGHT (emacsframe); + sz.width = frame_resize_pixelwise + ? 1 : FRAME_COLUMN_WIDTH (emacsframe); + sz.height = frame_resize_pixelwise + ? 1 : FRAME_LINE_HEIGHT (emacsframe); [win setResizeIncrements: sz]; NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); @@ -6122,8 +6125,8 @@ if (cols > 0 && rows > 0) [win setDelegate: self]; [win useOptimizedDrawing: YES]; - sz.width = FRAME_COLUMN_WIDTH (f); - sz.height = FRAME_LINE_HEIGHT (f); + sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f); + sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f); [win setResizeIncrements: sz]; [[win contentView] addSubview: self]; @@ -6470,8 +6473,8 @@ if (cols > 0 && rows > 0) (FRAME_DEFAULT_FACE (f)), f); - sz.width = FRAME_COLUMN_WIDTH (f); - sz.height = FRAME_LINE_HEIGHT (f); + sz.width = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f); + sz.height = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f); if (fs_state != FULLSCREEN_BOTH) { 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/>. */ #include <limits.h> #include <windows.h> #include <mmsystem.h> + +#include "coding.h" +#include "w32.h" /* END: Windows Specific Includes */ #endif /* WINDOWSNT */ @@ -1310,8 +1313,7 @@ Internal use only, use `play-sound' instead. */) struct gcpro gcpro1, gcpro2; Lisp_Object args[2]; #else /* WINDOWSNT */ - Lisp_Object lo_file = {0}; - char * psz_file = NULL; + Lisp_Object lo_file; unsigned long ui_volume_tmp = UINT_MAX; unsigned long ui_volume = UINT_MAX; #endif /* WINDOWSNT */ @@ -1384,10 +1386,11 @@ Internal use only, use `play-sound' instead. */) #else /* WINDOWSNT */ - lo_file = Fexpand_file_name (attrs[SOUND_FILE], Qnil); - len = XSTRING (lo_file)->size; - psz_file = alloca (len + 1); - strcpy (psz_file, XSTRING (lo_file)->data); + lo_file = Fexpand_file_name (attrs[SOUND_FILE], Vdata_directory); + lo_file = ENCODE_FILE (lo_file); + /* Since UNICOWS.DLL includes only a stub for mciSendStringW, we + need to encode the file in the ANSI codepage. */ + lo_file = ansi_encode_filename (lo_file); if (INTEGERP (attrs[SOUND_VOLUME])) { ui_volume_tmp = XFASTINT (attrs[SOUND_VOLUME]); @@ -1409,7 +1412,7 @@ Internal use only, use `play-sound' instead. */) { ui_volume = ui_volume_tmp * (UINT_MAX / 100); } - do_play_sound (psz_file, ui_volume); + do_play_sound (SDATA (lo_file), ui_volume); #endif /* WINDOWSNT */ 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) dostounix_filename (shortname); encoded_filename = build_string (shortname); } + else + encoded_filename = build_unibyte_string (fname); } else encoded_filename = build_unibyte_string (fname); @@ -7720,15 +7722,15 @@ fcntl (int s, int cmd, int options) if (cmd == F_DUPFD_CLOEXEC) return sys_dup (s); - if (winsock_lib == NULL) - { - errno = ENETDOWN; - return -1; - } - check_errno (); if (fd_info[s].flags & FILE_SOCKET) { + if (winsock_lib == NULL) + { + errno = ENETDOWN; + return -1; + } + if (cmd == F_SETFL && options == O_NONBLOCK) { unsigned long nblock = 1; @@ -7745,13 +7747,36 @@ fcntl (int s, int cmd, int options) return SOCKET_ERROR; } } + else if ((fd_info[s].flags & (FILE_PIPE | FILE_WRITE)) + == (FILE_PIPE | FILE_WRITE)) + { + /* Force our writes to pipes be non-blocking. */ + if (cmd == F_SETFL && options == O_NONBLOCK) + { + HANDLE h = (HANDLE)_get_osfhandle (s); + DWORD pipe_mode = PIPE_NOWAIT; + + if (!SetNamedPipeHandleState (h, &pipe_mode, NULL, NULL)) + { + DebPrint (("SetNamedPipeHandleState: %lu\n", GetLastError ())); + return SOCKET_ERROR; + } + fd_info[s].flags |= FILE_NDELAY; + return 0; + } + else + { + errno = EINVAL; + return SOCKET_ERROR; + } + } errno = ENOTSOCK; return SOCKET_ERROR; } /* Shadow main io functions: we need to handle pipes and sockets more - intelligently, and implement non-blocking mode as well. */ + intelligently. */ int sys_close (int fd) @@ -8236,7 +8261,6 @@ sys_read (int fd, char * buffer, unsigned int count) /* From w32xfns.c */ extern HANDLE interrupt_handle; -/* For now, don't bother with a non-blocking mode */ int sys_write (int fd, const void * buffer, unsigned int count) { @@ -8388,6 +8412,22 @@ sys_write (int fd, const void * buffer, unsigned int count) nchars += n; if (n < 0) { + /* When there's no buffer space in a pipe that is in the + non-blocking mode, _write returns ENOSPC. We return + EAGAIN instead, which should trigger the logic in + send_process that enters waiting loop and calls + wait_reading_process_output to allow process input to + be accepted during the wait. Those calls to + wait_reading_process_output allow sys_select to + notice when process input becomes available, thus + avoiding deadlock whereby each side of the pipe is + blocked on write, waiting for the other party to read + its end of the pipe. */ + if (errno == ENOSPC + && fd < MAXDESC + && ((fd_info[fd].flags & (FILE_PIPE | FILE_NDELAY)) + == (FILE_PIPE | FILE_NDELAY))) + errno = EAGAIN; nchars = n; break; } 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 block_input (); window_resize_apply (r, 0); - w->total_lines = XFASTINT (w->new_total); - w->top_line = r->top_line + r->total_lines; w->pixel_height = XFASTINT (w->new_pixel); + w->total_lines = w->pixel_height / FRAME_LINE_HEIGHT (f); w->pixel_top = r->pixel_top + r->pixel_height; + w->top_line = r->top_line + r->total_lines; fset_redisplay (f); 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, glyph. */ int top_x = it.current_x; int top_y = it.current_y; - /* Calling line_bottom_y may change it.method, it.position, etc. */ - enum it_method it_method = it.method; - int bottom_y = (last_height = 0, line_bottom_y (&it)); int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); + int bottom_y; + struct it save_it; + void *save_it_data = NULL; + /* Calling line_bottom_y may change it.method, it.position, etc. */ + SAVE_IT (save_it, it, save_it_data); + last_height = 0; + bottom_y = line_bottom_y (&it); if (top_y < window_top_y) visible_p = bottom_y > window_top_y; else if (top_y < it.last_visible_y) - visible_p = true; + visible_p = 1; if (bottom_y >= it.last_visible_y && it.bidi_p && it.bidi_it.scan_dir == -1 && IT_CHARPOS (it) < charpos) @@ -1476,7 +1480,6 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, move_it_to again with a slightly larger vertical limit, and see if it actually moved vertically; if it did, we didn't really reach CHARPOS, which is beyond window end. */ - struct it save_it = it; /* Why 10? because we don't know how many canonical lines will the height of the next line(s) be. So we guess. */ 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, if (it.current_y > top_y) visible_p = 0; - it = save_it; } + RESTORE_IT (&it, &save_it, save_it_data); if (visible_p) { - if (it_method == GET_FROM_DISPLAY_VECTOR) + if (it.method == GET_FROM_DISPLAY_VECTOR) { /* We stopped on the last glyph of a display vector. Try and recompute. Hack alert! */ |
