From 273ac8d1ef96529d010975b59caa99489cbc51b4 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 18 Nov 2012 18:43:36 +0200 Subject: Prevent crashes on MS-Windows when w32-downcase-file-names is non-nil. src/fileio.c (Fsubstitute_in_file_name, Ffile_name_directory) (Fexpand_file_name) [DOS_NT]: Pass encoded file name to dostounix_filename. Prevents crashes down the road, because dostounix_filename assumes it gets a unibyte string. Reported by Michel de Ruiter , see http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00017.html --- src/ChangeLog | 9 +++++++++ src/fileio.c | 46 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 46 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c12eff19ddd..c4f1ee60d84 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-11-18 Eli Zaretskii + + * fileio.c (Fsubstitute_in_file_name, Ffile_name_directory) + (Fexpand_file_name) [DOS_NT]: Pass encoded file name to + dostounix_filename. Prevents crashes down the road, because + dostounix_filename assumes it gets a unibyte string. Reported by + Michel de Ruiter , see + http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00017.html + 2012-11-17 Eli Zaretskii * w32select.c: Include w32common.h before w32term.h, so that diff --git a/src/fileio.c b/src/fileio.c index d47d7dd9e0b..a04eb8ecea1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -315,6 +315,7 @@ Given a Unix syntax file name, returns a string ending in slash. */) register const char *beg; #else register char *beg; + Lisp_Object tem_fn; #endif register const char *p; Lisp_Object handler; @@ -374,10 +375,13 @@ Given a Unix syntax file name, returns a string ending in slash. */) p = beg + strlen (beg); } } - dostounix_filename (beg); -#endif /* DOS_NT */ - + tem_fn = ENCODE_FILE (make_specified_string (beg, -1, p - beg, + STRING_MULTIBYTE (filename))); + dostounix_filename (SSDATA (tem_fn)); + return DECODE_FILE (tem_fn); +#else /* DOS_NT */ return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename)); +#endif /* DOS_NT */ } DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, @@ -951,7 +955,18 @@ filesystem tree, not (expand-file-name ".." dirname). */) #ifdef DOS_NT /* Make sure directories are all separated with /, but avoid allocation of a new string when not required. */ - dostounix_filename (nm); + if (multibyte) + { + Lisp_Object tem_name = make_specified_string (nm, -1, strlen (nm), + multibyte); + + tem_name = ENCODE_FILE (tem_name); + dostounix_filename (SSDATA (tem_name)); + tem_name = DECODE_FILE (tem_name); + memcpy (nm, SSDATA (tem_name), SBYTES (tem_name) + 1); + } + else + dostounix_filename (nm); #ifdef WINDOWSNT if (IS_DIRECTORY_SEP (nm[1])) { @@ -1305,10 +1320,13 @@ filesystem tree, not (expand-file-name ".." dirname). */) target[0] = '/'; target[1] = ':'; } - dostounix_filename (target); -#endif /* DOS_NT */ - result = make_specified_string (target, -1, o - target, multibyte); + result = ENCODE_FILE (result); + dostounix_filename (SSDATA (result)); + result = DECODE_FILE (result); +#else /* !DOS_NT */ + result = make_specified_string (target, -1, o - target, multibyte); +#endif /* !DOS_NT */ } /* Again look to see if the file name has special constructs in it @@ -1587,8 +1605,18 @@ those `/' is discarded. */) memcpy (nm, SDATA (filename), SBYTES (filename) + 1); #ifdef DOS_NT - dostounix_filename (nm); - substituted = (strcmp (nm, SDATA (filename)) != 0); + { + Lisp_Object encoded_filename = ENCODE_FILE (filename); + Lisp_Object tem_fn; + + dostounix_filename (SDATA (encoded_filename)); + tem_fn = DECODE_FILE (encoded_filename); + nm = alloca (SBYTES (tem_fn) + 1); + memcpy (nm, SDATA (tem_fn), SBYTES (tem_fn) + 1); + substituted = (memcmp (nm, SDATA (filename), SBYTES (filename)) != 0); + if (substituted) + filename = tem_fn; + } #endif endp = nm + SBYTES (filename); -- cgit v1.2.1 From 6e9f7997b36d21004794fa2b8a550729cbabd81a Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Sun, 18 Nov 2012 17:39:37 -0800 Subject: Rename cygwin_convert_path* to cygwin_convert_file_name* --- src/ChangeLog | 9 +++++++++ src/cygw32.c | 20 +++++++++++--------- src/w32fns.c | 6 +++--- 3 files changed, 23 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2a0c0e6822d..89c4e273715 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-11-19 Daniel Colascione + + * w32fns.c (Fx_file_dialog): + (Fx_file_dialog): Accomodate rename of cygwin_convert_path* to + cygwin_convert_file_name*. + + * cygw32.c (Fcygwin_convert_path_to_windows, syms_of_cygw32): + Rename cygwin_convert_path* to cygwin_convert_file_name*. + 2012-11-18 Paul Eggert * nsterm.m (ns_select): Send SIGIO only to self, not to process group. diff --git a/src/cygw32.c b/src/cygw32.c index 54f2076a891..d9777d5e22e 100644 --- a/src/cygw32.c +++ b/src/cygw32.c @@ -106,22 +106,24 @@ conv_filename_from_w32_unicode (const wchar_t* in, int absolute_p) return unbind_to (count, DECODE_FILE (converted)); } -DEFUN ("cygwin-convert-path-to-windows", - Fcygwin_convert_path_to_windows, Scygwin_convert_path_to_windows, +DEFUN ("cygwin-convert-file-name-to-windows", + Fcygwin_convert_file_name_to_windows, + Scygwin_convert_file_name_to_windows, 1, 2, 0, - doc: /* Convert PATH to a Windows path. If ABSOLUTE-P if - non-nil, return an absolute path.*/) + doc: /* Convert PATH to a Windows path. If ABSOLUTE-P is +non-nil, return an absolute path.*/) (Lisp_Object path, Lisp_Object absolute_p) { return from_unicode ( conv_filename_to_w32_unicode (path, EQ (absolute_p, Qnil) ? 0 : 1)); } -DEFUN ("cygwin-convert-path-from-windows", - Fcygwin_convert_path_from_windows, Scygwin_convert_path_from_windows, +DEFUN ("cygwin-convert-file-name-from-windows", + Fcygwin_convert_file_name_from_windows, + Scygwin_convert_file_name_from_windows, 1, 2, 0, doc: /* Convert a Windows path to a Cygwin path. If ABSOLUTE-P - if non-nil, return an absolute path.*/) +is non-nil, return an absolute path.*/) (Lisp_Object path, Lisp_Object absolute_p) { return conv_filename_from_w32_unicode (to_unicode (path, &path), @@ -131,6 +133,6 @@ DEFUN ("cygwin-convert-path-from-windows", void syms_of_cygw32 (void) { - defsubr (&Scygwin_convert_path_from_windows); - defsubr (&Scygwin_convert_path_to_windows); + defsubr (&Scygwin_convert_file_name_from_windows); + defsubr (&Scygwin_convert_file_name_to_windows); } diff --git a/src/w32fns.c b/src/w32fns.c index ed5625e802c..90f5b1695ea 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6167,9 +6167,9 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) filename = empty_unibyte_string; #ifdef CYGWIN - dir = Fcygwin_convert_path_to_windows (dir, Qt); + dir = Fcygwin_convert_file_name_to_windows (dir, Qt); if (SCHARS (filename) > 0) - filename = Fcygwin_convert_path_to_windows (filename, Qnil); + filename = Fcygwin_convert_file_name_to_windows (filename, Qnil); #endif CHECK_STRING (dir); @@ -6270,7 +6270,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) #endif /* NTGUI_UNICODE */ #ifdef CYGWIN - filename = Fcygwin_convert_path_from_windows (filename, Qt); + filename = Fcygwin_convert_file_name_from_windows (filename, Qt); #endif /* CYGWIN */ /* Strip the dummy filename off the end of the string if we -- cgit v1.2.1 From 88c4a13c3b573e0fa844c88ab89765ef308c267e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 19 Nov 2012 19:34:21 +0200 Subject: More fixes for bug #12878 with MS-Windows MSVC build. src/xdisp.c (start_hourglass) [HAVE_NTGUI]: Don't mix declaration of w32_note_current_window with code. (Backport from trunk.) src/w32.c (FILE_DEVICE_FILE_SYSTEM, METHOD_BUFFERED) (FILE_ANY_ACCESS, CTL_CODE, FSCTL_GET_REPARSE_POINT) [_MSC_VER]: Define for the MSVC compiler. src/w32term.h (EnumSystemLocalesW) [_MSC_VER]: Add a missing semi-colon. nt/inc/stdint.h (PTRDIFF_MIN) [!__GNUC__]: Define for MSVC. --- src/ChangeLog | 12 ++++++++++++ src/w32.c | 13 ++++++++++--- src/w32term.h | 2 +- src/xdisp.c | 6 ++++-- 4 files changed, 27 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c4f1ee60d84..da5a9607903 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2012-11-19 Eli Zaretskii + + * xdisp.c (start_hourglass) [HAVE_NTGUI]: Don't mix declaration of + w32_note_current_window with code. (Backport from trunk.) + + * w32.c (FILE_DEVICE_FILE_SYSTEM, METHOD_BUFFERED) + (FILE_ANY_ACCESS, CTL_CODE, FSCTL_GET_REPARSE_POINT) [_MSC_VER]: + Define for the MSVC compiler. + + * w32term.h (EnumSystemLocalesW) [_MSC_VER]: Add a missing + semi-colon. + 2012-11-18 Eli Zaretskii * fileio.c (Fsubstitute_in_file_name, Ffile_name_directory) diff --git a/src/w32.c b/src/w32.c index 5ac1bc3eb7c..1c3331516d4 100644 --- a/src/w32.c +++ b/src/w32.c @@ -119,9 +119,10 @@ typedef struct _PROCESS_MEMORY_COUNTERS_EX { #include #ifdef _MSC_VER -/* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER, except - on ntifs.h, which cannot be included because it triggers conflicts - with other Windows API headers. So we define it here by hand. */ +/* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER and the + associated macros, except on ntifs.h, which cannot be included + because it triggers conflicts with other Windows API headers. So + we define it here by hand. */ typedef struct _REPARSE_DATA_BUFFER { ULONG ReparseTag; @@ -149,6 +150,12 @@ typedef struct _REPARSE_DATA_BUFFER { } DUMMYUNIONNAME; } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; +#define FILE_DEVICE_FILE_SYSTEM 9 +#define METHOD_BUFFERED 0 +#define FILE_ANY_ACCESS 0x00000000 +#define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m)) +#define FSCTL_GET_REPARSE_POINT \ + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS) #endif /* TCP connection support. */ diff --git a/src/w32term.h b/src/w32term.h index 6e30d374c82..9b5a4a0189a 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -758,7 +758,7 @@ extern int w32_system_caret_y; typedef BOOL (CALLBACK *LOCALE_ENUMPROCA)(LPSTR); typedef BOOL (CALLBACK *LOCALE_ENUMPROCW)(LPWSTR); BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD); -BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD) +BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD); #ifdef UNICODE #define EnumSystemLocales EnumSystemLocalesW #else diff --git a/src/xdisp.c b/src/xdisp.c index 290c3a07fe9..85fe9a00f60 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -29433,8 +29433,10 @@ start_hourglass (void) delay = make_emacs_time (DEFAULT_HOURGLASS_DELAY, 0); #ifdef HAVE_NTGUI - extern void w32_note_current_window (void); - w32_note_current_window (); + { + extern void w32_note_current_window (void); + w32_note_current_window (); + } #endif /* HAVE_NTGUI */ hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, -- cgit v1.2.1 From 23ba2705e22b89154ef7cbb0595419732080b94c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 19 Nov 2012 23:24:09 -0500 Subject: Make called-interactively-p work for edebug or advised code. * lisp/subr.el (called-interactively-p-functions): New var. (internal--called-interactively-p--get-frame): New macro. (called-interactively-p, interactive-p): Rewrite in Lisp. * lisp/emacs-lisp/nadvice.el (advice--called-interactively-skip): New fun. (called-interactively-p-functions): Use it. * lisp/emacs-lisp/edebug.el (edebug--called-interactively-skip): New fun. (called-interactively-p-functions): Use it. * lisp/allout.el (allout-called-interactively-p): Don't assume called-interactively-p is a subr. * src/eval.c (Finteractive_p, Fcalled_interactively_p, interactive_p): Remove. (syms_of_eval): Remove corresponding defsubr. * src/bytecode.c (exec_byte_code): `interactive-p' is now a Lisp function. * test/automated/advice-tests.el (advice-tests--data): Remove. (advice-tests): Move the tests directly here instead. Add called-interactively-p tests. --- src/ChangeLog | 18 ++++++---- src/bytecode.c | 4 ++- src/eval.c | 107 +++------------------------------------------------------ 3 files changed, 20 insertions(+), 109 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 89c4e273715..9e83129e585 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-11-20 Stefan Monnier + + * eval.c (Finteractive_p, Fcalled_interactively_p, interactive_p): Remove. + (syms_of_eval): Remove corresponding defsubr. + * bytecode.c (exec_byte_code): `interactive-p' is now a Lisp function. + 2012-11-19 Daniel Colascione * w32fns.c (Fx_file_dialog): @@ -17,10 +23,10 @@ windows.h gets included before w32term.h uses some of its features, see below. - * w32term.h (LOCALE_ENUMPROCA, LOCALE_ENUMPROCW) [_MSC_VER]: New - typedefs. - (EnumSystemLocalesA, EnumSystemLocalesW) [_MSC_VER]: New - prototypes. + * w32term.h (LOCALE_ENUMPROCA, LOCALE_ENUMPROCW) [_MSC_VER]: + New typedefs. + (EnumSystemLocalesA, EnumSystemLocalesW) [_MSC_VER]: + New prototypes. (EnumSystemLocales) [_MSC_VER]: Define if undefined. (Bug#12878) 2012-11-18 Jan Djärv @@ -312,8 +318,8 @@ * xdisp.c (try_scrolling): Fix correction of aggressive-scroll amount when the scroll margins are too large. When scrolling backwards in the buffer, give up if cannot reach point or the - scroll margin within a reasonable number of screen lines. Fixes - point position in window under scroll-up/down-aggressively when + scroll margin within a reasonable number of screen lines. + Fixes point position in window under scroll-up/down-aggressively when point is positioned many lines beyond the window top/bottom. (Bug#12811) diff --git a/src/bytecode.c b/src/bytecode.c index 648813aed86..3267c7c8c76 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1579,7 +1579,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, NEXT; CASE (Binteractive_p): /* Obsolete since 24.1. */ - PUSH (Finteractive_p ()); + BEFORE_POTENTIAL_GC (); + PUSH (call0 (intern ("interactive-p"))); + AFTER_POTENTIAL_GC (); NEXT; CASE (Bforward_char): diff --git a/src/eval.c b/src/eval.c index f8a76646352..459fb762c6e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -489,102 +489,6 @@ usage: (function ARG) */) } -DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0, - doc: /* Return t if the containing function was run directly by user input. -This means that the function was called with `call-interactively' -\(which includes being called as the binding of a key) -and input is currently coming from the keyboard (not a keyboard macro), -and Emacs is not running in batch mode (`noninteractive' is nil). - -The only known proper use of `interactive-p' is in deciding whether to -display a helpful message, or how to display it. If you're thinking -of using it for any other purpose, it is quite likely that you're -making a mistake. Think: what do you want to do when the command is -called from a keyboard macro? - -To test whether your function was called with `call-interactively', -either (i) add an extra optional argument and give it an `interactive' -spec that specifies non-nil unconditionally (such as \"p\"); or (ii) -use `called-interactively-p'. */) - (void) -{ - return (INTERACTIVE && interactive_p ()) ? Qt : Qnil; -} - - -DEFUN ("called-interactively-p", Fcalled_interactively_p, Scalled_interactively_p, 0, 1, 0, - doc: /* Return t if the containing function was called by `call-interactively'. -If KIND is `interactive', then only return t if the call was made -interactively by the user, i.e. not in `noninteractive' mode nor -when `executing-kbd-macro'. -If KIND is `any', on the other hand, it will return t for any kind of -interactive call, including being called as the binding of a key, or -from a keyboard macro, or in `noninteractive' mode. - -The only known proper use of `interactive' for KIND is in deciding -whether to display a helpful message, or how to display it. If you're -thinking of using it for any other purpose, it is quite likely that -you're making a mistake. Think: what do you want to do when the -command is called from a keyboard macro? - -Instead of using this function, it is sometimes cleaner to give your -function an extra optional argument whose `interactive' spec specifies -non-nil unconditionally (\"p\" is a good way to do this), or via -\(not (or executing-kbd-macro noninteractive)). */) - (Lisp_Object kind) -{ - return (((INTERACTIVE || !EQ (kind, intern ("interactive"))) - && interactive_p ()) - ? Qt : Qnil); -} - - -/* Return true if function in which this appears was called using - call-interactively and is not a built-in. */ - -static bool -interactive_p (void) -{ - struct backtrace *btp; - Lisp_Object fun; - - btp = backtrace_list; - - /* If this isn't a byte-compiled function, there may be a frame at - the top for Finteractive_p. If so, skip it. */ - fun = Findirect_function (btp->function, Qnil); - if (SUBRP (fun) && (XSUBR (fun) == &Sinteractive_p - || XSUBR (fun) == &Scalled_interactively_p)) - btp = btp->next; - - /* If we're running an Emacs 18-style byte-compiled function, there - may be a frame for Fbytecode at the top level. In any version of - Emacs there can be Fbytecode frames for subexpressions evaluated - inside catch and condition-case. Skip past them. - - If this isn't a byte-compiled function, then we may now be - looking at several frames for special forms. Skip past them. */ - while (btp - && (EQ (btp->function, Qbytecode) - || btp->nargs == UNEVALLED)) - btp = btp->next; - - /* `btp' now points at the frame of the innermost function that isn't - a special form, ignoring frames for Finteractive_p and/or - Fbytecode at the top. If this frame is for a built-in function - (such as load or eval-region) return false. */ - fun = Findirect_function (btp->function, Qnil); - if (SUBRP (fun)) - return 0; - - /* `btp' points to the frame of a Lisp function that called interactive-p. - Return t if that function was called interactively. */ - if (btp && btp->next && EQ (btp->next->function, Qcall_interactively)) - return 1; - return 0; -} - - DEFUN ("defvaralias", Fdefvaralias, Sdefvaralias, 2, 3, 0, doc: /* Make NEW-ALIAS a variable alias for symbol BASE-VARIABLE. Aliased variables always have the same value; setting one sets the other. @@ -696,8 +600,9 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) if (EQ ((--pdl)->symbol, sym) && !pdl->func && EQ (pdl->old_value, Qunbound)) { - message_with_string ("Warning: defvar ignored because %s is let-bound", - SYMBOL_NAME (sym), 1); + message_with_string + ("Warning: defvar ignored because %s is let-bound", + SYMBOL_NAME (sym), 1); break; } } @@ -717,8 +622,8 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) /* A simple (defvar foo) with lexical scoping does "nothing" except declare that var to be dynamically scoped *locally* (i.e. within the current file or let-block). */ - Vinternal_interpreter_environment = - Fcons (sym, Vinternal_interpreter_environment); + Vinternal_interpreter_environment + = Fcons (sym, Vinternal_interpreter_environment); else { /* Simple (defvar ) should not count as a definition at all. @@ -3551,8 +3456,6 @@ alist of active lexical bindings. */); defsubr (&Sunwind_protect); defsubr (&Scondition_case); defsubr (&Ssignal); - defsubr (&Sinteractive_p); - defsubr (&Scalled_interactively_p); defsubr (&Scommandp); defsubr (&Sautoload); defsubr (&Sautoload_do_load); -- cgit v1.2.1 From 952580c5fd273ff9d8f095ab8edb6b116d07eb56 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 20 Nov 2012 11:53:04 +0400 Subject: * xdisp.c (buffer_shared): Adjust comment. (buffer_shared_and_changed): New function. (prepare_menu_bars, redisplay_internal): Use it to decide whether all windows or frames should be updated. --- src/ChangeLog | 7 +++++++ src/xdisp.c | 23 +++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9e83129e585..c749b12cae8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-11-20 Dmitry Antipov + + * xdisp.c (buffer_shared): Adjust comment. + (buffer_shared_and_changed): New function. + (prepare_menu_bars, redisplay_internal): Use it to + decide whether all windows or frames should be updated. + 2012-11-20 Stefan Monnier * eval.c (Finteractive_p, Fcalled_interactively_p, interactive_p): Remove. diff --git a/src/xdisp.c b/src/xdisp.c index 27d9fff0b7d..618f4dfc585 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -515,9 +515,8 @@ Lisp_Object Qmenu_bar_update_hook; static int overlay_arrow_seen; -/* Number of windows showing the buffer of the selected window (or - another buffer with the same base buffer). keyboard.c refers to - this. */ +/* Number of windows showing the buffer of the selected + window (or another buffer with the same base buffer). */ int buffer_shared; @@ -10889,8 +10888,15 @@ echo_area_display (int update_frame_p) return window_height_changed_p; } +/* True if the current buffer is shown in more than + one window and was modified since last display. */ + +static int +buffer_shared_and_changed (void) +{ + return (buffer_shared > 1 && UNCHANGED_MODIFIED < MODIFF); +} - /*********************************************************************** Mode Lines and Frame Titles ***********************************************************************/ @@ -11196,7 +11202,7 @@ prepare_menu_bars (void) /* Update the menu bar item lists, if appropriate. This has to be done before any actual redisplay or generation of display lines. */ all_windows = (update_mode_lines - || buffer_shared > 1 + || buffer_shared_and_changed () || windows_or_buffers_changed); if (all_windows) { @@ -13116,7 +13122,7 @@ redisplay_internal (void) if ((SAVE_MODIFF < MODIFF) != w->last_had_star) { w->update_mode_line = 1; - if (buffer_shared > 1) + if (buffer_shared_and_changed ()) update_mode_lines++; } @@ -13141,7 +13147,8 @@ redisplay_internal (void) /* The variable buffer_shared is set in redisplay_window and indicates that we redisplay a buffer in different windows. See there. */ - consider_all_windows_p = (update_mode_lines || buffer_shared > 1 + consider_all_windows_p = (update_mode_lines + || buffer_shared_and_changed () || cursor_type_changed); /* If specs for an arrow have changed, do thorough redisplay @@ -13433,7 +13440,7 @@ redisplay_internal (void) } CHARPOS (this_line_start_pos) = 0; - consider_all_windows_p |= buffer_shared > 1; + consider_all_windows_p |= buffer_shared_and_changed (); ++clear_face_cache_count; #ifdef HAVE_WINDOW_SYSTEM ++clear_image_cache_count; -- cgit v1.2.1 From b83fdfa997d54f8b41f23de23103ceda36eca02c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 20 Nov 2012 00:32:19 -0800 Subject: * eval.c (interactive_p): Remove no-longer-used decl. --- src/ChangeLog | 4 ++++ src/eval.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c749b12cae8..c69452a1f1b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-11-20 Paul Eggert + + * eval.c (interactive_p): Remove no-longer-used decl. + 2012-11-20 Dmitry Antipov * xdisp.c (buffer_shared): Adjust comment. diff --git a/src/eval.c b/src/eval.c index 459fb762c6e..053b1a7f097 100644 --- a/src/eval.c +++ b/src/eval.c @@ -114,7 +114,6 @@ Lisp_Object Vsignaling_function; Lisp_Object inhibit_lisp_code; static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); -static bool interactive_p (void); static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); /* Functions to set Lisp_Object slots of struct specbinding. */ -- cgit v1.2.1 From ea6de9b1f867a49a1ad062ca54e461cd3b1e003f Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 20 Nov 2012 15:41:57 +0400 Subject: Tiny adjustment around the previous redisplay change. * xdisp.c (window_outdated): New function. (text_outside_line_unchanged_p, redisplay_window): Use it. (redisplay_internal): Likewise. Fix indentation. --- src/ChangeLog | 3 +++ src/xdisp.c | 49 ++++++++++++++++++++++++------------------------- 2 files changed, 27 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c69452a1f1b..9a2cec8a7fc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,9 @@ (buffer_shared_and_changed): New function. (prepare_menu_bars, redisplay_internal): Use it to decide whether all windows or frames should be updated. + (window_outdated): New function. + (text_outside_line_unchanged_p, redisplay_window): Use it. + (redisplay_internal): Likewise. Fix indentation. 2012-11-20 Stefan Monnier diff --git a/src/xdisp.c b/src/xdisp.c index 618f4dfc585..4d359593c75 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10888,7 +10888,7 @@ echo_area_display (int update_frame_p) return window_height_changed_p; } -/* True if the current buffer is shown in more than +/* Nonzero if the current buffer is shown in more than one window and was modified since last display. */ static int @@ -10897,6 +10897,17 @@ buffer_shared_and_changed (void) return (buffer_shared > 1 && UNCHANGED_MODIFIED < MODIFF); } +/* Nonzero if W doesn't reflect the actual state of + current buffer due to its text or overlays change. */ + +static int +window_outdated (struct window *w) +{ + eassert (XBUFFER (w->buffer) == current_buffer); + return (w->last_modified < MODIFF + || w->last_overlay_modified < OVERLAY_MODIFF); +} + /*********************************************************************** Mode Lines and Frame Titles ***********************************************************************/ @@ -12622,8 +12633,7 @@ text_outside_line_unchanged_p (struct window *w, int unchanged_p = 1; /* If text or overlays have changed, see where. */ - if (w->last_modified < MODIFF - || w->last_overlay_modified < OVERLAY_MODIFF) + if (window_outdated (w)) { /* Gap in the line? */ if (GPT < start || Z - GPT < end) @@ -13134,9 +13144,7 @@ redisplay_internal (void) if (!NILP (w->column_number_displayed) /* This alternative quickly identifies a common case where no change is needed. */ - && !(PT == w->last_point - && w->last_modified >= MODIFF - && w->last_overlay_modified >= OVERLAY_MODIFF) + && !(PT == w->last_point && !window_outdated (w)) && (XFASTINT (w->column_number_displayed) != current_column ())) w->update_mode_line = 1; @@ -13198,18 +13206,16 @@ redisplay_internal (void) } } else if (EQ (selected_window, minibuf_window) - && (current_buffer->clip_changed - || w->last_modified < MODIFF - || w->last_overlay_modified < OVERLAY_MODIFF) + && (current_buffer->clip_changed || window_outdated (w)) && resize_mini_window (w, 0)) { /* Resized active mini-window to fit the size of what it is showing if its contents might have changed. */ must_finish = 1; -/* FIXME: this causes all frames to be updated, which seems unnecessary - since only the current frame needs to be considered. This function needs - to be rewritten with two variables, consider_all_windows and - consider_all_frames. */ + /* FIXME: this causes all frames to be updated, which seems unnecessary + since only the current frame needs to be considered. This function + needs to be rewritten with two variables, consider_all_windows and + consider_all_frames. */ consider_all_windows_p = 1; ++windows_or_buffers_changed; ++update_mode_lines; @@ -13264,9 +13270,7 @@ redisplay_internal (void) || FETCH_BYTE (BYTEPOS (tlbufpos)) == '\n')) /* Former continuation line has disappeared by becoming empty. */ goto cancel; - else if (w->last_modified < MODIFF - || w->last_overlay_modified < OVERLAY_MODIFF - || MINI_WINDOW_P (w)) + else if (window_outdated (w) || MINI_WINDOW_P (w)) { /* We have to handle the case of continuation around a wide-column character (see the comment in indent.c around @@ -15517,8 +15521,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) = (!NILP (w->window_end_valid) && !current_buffer->clip_changed && !current_buffer->prevent_redisplay_optimizations_p - && w->last_modified >= MODIFF - && w->last_overlay_modified >= OVERLAY_MODIFF); + && !window_outdated (w)); /* Run the window-bottom-change-functions if it is possible that the text on the screen has changed @@ -15540,8 +15543,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) buffer_unchanged_p = (!NILP (w->window_end_valid) && !current_buffer->clip_changed - && w->last_modified >= MODIFF - && w->last_overlay_modified >= OVERLAY_MODIFF); + && !window_outdated (w)); /* When windows_or_buffers_changed is non-zero, we can't rely on the window end being valid, so set it to nil there. */ @@ -15566,9 +15568,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) if (!NILP (w->column_number_displayed) /* This alternative quickly identifies a common case where no change is needed. */ - && !(PT == w->last_point - && w->last_modified >= MODIFF - && w->last_overlay_modified >= OVERLAY_MODIFF) + && !(PT == w->last_point && !window_outdated (w)) && (XFASTINT (w->column_number_displayed) != current_column ())) update_mode_line = 1; @@ -15810,8 +15810,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) && (CHARPOS (startp) < ZV /* Avoid starting at end of buffer. */ || CHARPOS (startp) == BEGV - || (w->last_modified >= MODIFF - && w->last_overlay_modified >= OVERLAY_MODIFF))) + || !window_outdated (w))) { int d1, d2, d3, d4, d5, d6; -- cgit v1.2.1 From 4ffea4478002db1df699a563477ec06000628e77 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Tue, 20 Nov 2012 08:26:40 -0500 Subject: Fix non-GTK builds on Cygwin * src/emacs.c (main): Set the G_SLICE environment variable for all Cygwin builds, not just GTK builds. See https://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00368.html. --- src/ChangeLog | 6 ++++++ src/emacs.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index da5a9607903..3836e32fdbc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-11-20 Ken Brown + + * emacs.c (main): Set the G_SLICE environment variable for all + Cygwin builds, not just GTK builds. See + https://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00368.html. + 2012-11-19 Eli Zaretskii * xdisp.c (start_hourglass) [HAVE_NTGUI]: Don't mix declaration of diff --git a/src/emacs.c b/src/emacs.c index 98e3f11f0cb..f533c3ae983 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -702,7 +702,7 @@ main (int argc, char **argv) stack_base = &dummy; #endif -#if defined (USE_GTK) && defined (G_SLICE_ALWAYS_MALLOC) +#ifdef G_SLICE_ALWAYS_MALLOC /* This is used by the Cygwin build. */ setenv ("G_SLICE", "always-malloc", 1); #endif -- cgit v1.2.1 From a16ac13f6299d2610284a6b3fb4231c3279d2e9c Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Tue, 20 Nov 2012 11:28:53 -0800 Subject: Backport: Rename cygwin_convert_path* to cygwin_convert_file_name* --- src/ChangeLog | 9 +++++++++ src/cygw32.c | 20 +++++++++++--------- src/w32fns.c | 6 +++--- 3 files changed, 23 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3836e32fdbc..f7cb0fe850f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-11-20 Daniel Colascione + + * w32fns.c (Fx_file_dialog): + (Fx_file_dialog): Accomodate rename of cygwin_convert_path* to + cygwin_convert_file_name*. + + * cygw32.c (Fcygwin_convert_path_to_windows, syms_of_cygw32): + Rename cygwin_convert_path* to cygwin_convert_file_name*. + 2012-11-20 Ken Brown * emacs.c (main): Set the G_SLICE environment variable for all diff --git a/src/cygw32.c b/src/cygw32.c index 54f2076a891..d9777d5e22e 100644 --- a/src/cygw32.c +++ b/src/cygw32.c @@ -106,22 +106,24 @@ conv_filename_from_w32_unicode (const wchar_t* in, int absolute_p) return unbind_to (count, DECODE_FILE (converted)); } -DEFUN ("cygwin-convert-path-to-windows", - Fcygwin_convert_path_to_windows, Scygwin_convert_path_to_windows, +DEFUN ("cygwin-convert-file-name-to-windows", + Fcygwin_convert_file_name_to_windows, + Scygwin_convert_file_name_to_windows, 1, 2, 0, - doc: /* Convert PATH to a Windows path. If ABSOLUTE-P if - non-nil, return an absolute path.*/) + doc: /* Convert PATH to a Windows path. If ABSOLUTE-P is +non-nil, return an absolute path.*/) (Lisp_Object path, Lisp_Object absolute_p) { return from_unicode ( conv_filename_to_w32_unicode (path, EQ (absolute_p, Qnil) ? 0 : 1)); } -DEFUN ("cygwin-convert-path-from-windows", - Fcygwin_convert_path_from_windows, Scygwin_convert_path_from_windows, +DEFUN ("cygwin-convert-file-name-from-windows", + Fcygwin_convert_file_name_from_windows, + Scygwin_convert_file_name_from_windows, 1, 2, 0, doc: /* Convert a Windows path to a Cygwin path. If ABSOLUTE-P - if non-nil, return an absolute path.*/) +is non-nil, return an absolute path.*/) (Lisp_Object path, Lisp_Object absolute_p) { return conv_filename_from_w32_unicode (to_unicode (path, &path), @@ -131,6 +133,6 @@ DEFUN ("cygwin-convert-path-from-windows", void syms_of_cygw32 (void) { - defsubr (&Scygwin_convert_path_from_windows); - defsubr (&Scygwin_convert_path_to_windows); + defsubr (&Scygwin_convert_file_name_from_windows); + defsubr (&Scygwin_convert_file_name_to_windows); } diff --git a/src/w32fns.c b/src/w32fns.c index aa120d59ce5..d598d66b3a5 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -6151,9 +6151,9 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) filename = empty_unibyte_string; #ifdef CYGWIN - dir = Fcygwin_convert_path_to_windows (dir, Qt); + dir = Fcygwin_convert_file_name_to_windows (dir, Qt); if (SCHARS (filename) > 0) - filename = Fcygwin_convert_path_to_windows (filename, Qnil); + filename = Fcygwin_convert_file_name_to_windows (filename, Qnil); #endif CHECK_STRING (dir); @@ -6254,7 +6254,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) #endif /* NTGUI_UNICODE */ #ifdef CYGWIN - filename = Fcygwin_convert_path_from_windows (filename, Qt); + filename = Fcygwin_convert_file_name_from_windows (filename, Qt); #endif /* CYGWIN */ /* Strip the dummy filename off the end of the string if we -- cgit v1.2.1 From eadf1faa3cb5eea8c25a5166a9a97ebd63525c56 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 20 Nov 2012 15:06:17 -0500 Subject: Conflate Qnil and Qunbound for `symbol-function'. * src/alloc.c (Fmake_symbol): Initialize `function' to Qnil. * src/lread.c (init_obarray): Set `function' fields to Qnil. * src/eval.c (Fcommandp): Ignore Qunbound. (Fautoload, eval_sub, Fapply, Ffuncall, Fmacroexpand): * src/data.c (Ffset, Ffboundp, indirect_function, Findirect_function): Test NILP rather than Qunbound. (Ffmakunbound): Set to Qnil. (Fsymbol_function): Never signal an error. (Finteractive_form): Ignore Qunbound. --- src/ChangeLog | 13 +++++++++++++ src/alloc.c | 4 ++-- src/data.c | 21 ++++++++++----------- src/eval.c | 24 ++++++++++++------------ src/lisp.h | 2 +- src/lread.c | 3 ++- 6 files changed, 40 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9a2cec8a7fc..332656fcf00 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2012-11-20 Stefan Monnier + + Conflate Qnil and Qunbound for `symbol-function'. + * alloc.c (Fmake_symbol): Initialize `function' to Qnil. + * lread.c (init_obarray): Set `function' fields to Qnil. + * eval.c (Fcommandp): Ignore Qunbound. + (Fautoload, eval_sub, Fapply, Ffuncall, Fmacroexpand): + * data.c (Ffset, Ffboundp, indirect_function, Findirect_function): + Test NILP rather than Qunbound. + (Ffmakunbound): Set to Qnil. + (Fsymbol_function): Never signal an error. + (Finteractive_form): Ignore Qunbound. + 2012-11-20 Paul Eggert * eval.c (interactive_p): Remove no-longer-used decl. diff --git a/src/alloc.c b/src/alloc.c index a66a752f5dc..22e3db3cc77 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3212,7 +3212,7 @@ static struct Lisp_Symbol *symbol_free_list; DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, doc: /* Return a newly allocated uninterned symbol whose name is NAME. -Its value and function definition are void, and its property list is nil. */) +Its value is void, and its function definition and property list are nil. */) (Lisp_Object name) { register Lisp_Object val; @@ -3249,7 +3249,7 @@ Its value and function definition are void, and its property list is nil. */) set_symbol_plist (val, Qnil); p->redirect = SYMBOL_PLAINVAL; SET_SYMBOL_VAL (p, Qunbound); - set_symbol_function (val, Qunbound); + set_symbol_function (val, Qnil); set_symbol_next (val, NULL); p->gcmarkbit = 0; p->interned = SYMBOL_UNINTERNED; diff --git a/src/data.c b/src/data.c index 09899400b68..5fc6afaaa03 100644 --- a/src/data.c +++ b/src/data.c @@ -543,12 +543,13 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, return (EQ (valcontents, Qunbound) ? Qnil : Qt); } +/* FIXME: Make it an alias for function-symbol! */ DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, doc: /* Return t if SYMBOL's function definition is not void. */) (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); - return EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt; + return NILP (XSYMBOL (symbol)->function) ? Qnil : Qt; } DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, @@ -564,14 +565,14 @@ Return SYMBOL. */) } DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, - doc: /* Make SYMBOL's function definition be void. + doc: /* Make SYMBOL's function definition be nil. Return SYMBOL. */) (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); if (NILP (symbol) || EQ (symbol, Qt)) xsignal1 (Qsetting_constant, symbol); - set_symbol_function (symbol, Qunbound); + set_symbol_function (symbol, Qnil); return symbol; } @@ -580,9 +581,7 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0, (register Lisp_Object symbol) { CHECK_SYMBOL (symbol); - if (!EQ (XSYMBOL (symbol)->function, Qunbound)) return XSYMBOL (symbol)->function; - xsignal1 (Qvoid_function, symbol); } DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, @@ -613,7 +612,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0, function = XSYMBOL (symbol)->function; - if (!NILP (Vautoload_queue) && !EQ (function, Qunbound)) + if (!NILP (Vautoload_queue) && !NILP (function)) Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); if (AUTOLOADP (function)) @@ -714,7 +713,7 @@ Value, if non-nil, is a list \(interactive SPEC). */) { Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ - if (NILP (fun) || EQ (fun, Qunbound)) + if (NILP (fun)) return Qnil; /* Use an `interactive-form' property if present, analogous to the @@ -2008,10 +2007,10 @@ indirect_function (register Lisp_Object object) for (;;) { - if (!SYMBOLP (hare) || EQ (hare, Qunbound)) + if (!SYMBOLP (hare) || NILP (hare)) break; hare = XSYMBOL (hare)->function; - if (!SYMBOLP (hare) || EQ (hare, Qunbound)) + if (!SYMBOLP (hare) || NILP (hare)) break; hare = XSYMBOL (hare)->function; @@ -2038,10 +2037,10 @@ function chain of symbols. */) /* Optimize for no indirection. */ result = object; - if (SYMBOLP (result) && !EQ (result, Qunbound) + if (SYMBOLP (result) && !NILP (result) && (result = XSYMBOL (result)->function, SYMBOLP (result))) result = indirect_function (result); - if (!EQ (result, Qunbound)) + if (!NILP (result)) return result; if (NILP (noerror)) diff --git a/src/eval.c b/src/eval.c index 053b1a7f097..34b20f6fc8e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -875,7 +875,7 @@ definitions to shadow the loaded ones for use in file byte-compilation. */) if (NILP (tem)) { def = XSYMBOL (sym)->function; - if (!EQ (def, Qunbound)) + if (!NILP (def)) continue; } break; @@ -890,7 +890,7 @@ definitions to shadow the loaded ones for use in file byte-compilation. */) GCPRO1 (form); def = Fautoload_do_load (def, sym, Qmacro); UNGCPRO; - if (EQ (def, Qunbound) || !CONSP (def)) + if (!CONSP (def)) /* Not defined or definition not suitable. */ break; if (!EQ (XCAR (def), Qmacro)) @@ -1715,12 +1715,12 @@ then strings and vectors are not accepted. */) fun = function; - fun = indirect_function (fun); /* Check cycles. */ - if (NILP (fun) || EQ (fun, Qunbound)) + fun = indirect_function (fun); /* Check cycles. */ + if (NILP (fun)) return Qnil; /* Check an `interactive-form' property if present, analogous to the - function-documentation property. */ + function-documentation property. */ fun = function; while (SYMBOLP (fun)) { @@ -1780,7 +1780,7 @@ this does nothing and returns nil. */) CHECK_STRING (file); /* If function is defined and not as an autoload, don't override. */ - if (!EQ (XSYMBOL (function)->function, Qunbound) + if (!NILP (XSYMBOL (function)->function) && !AUTOLOADP (XSYMBOL (function)->function)) return Qnil; @@ -1959,7 +1959,7 @@ eval_sub (Lisp_Object form) /* Optimize for no indirection. */ fun = original_fun; - if (SYMBOLP (fun) && !EQ (fun, Qunbound) + if (SYMBOLP (fun) && !NILP (fun) && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) fun = indirect_function (fun); @@ -2081,7 +2081,7 @@ eval_sub (Lisp_Object form) val = apply_lambda (fun, original_args); else { - if (EQ (fun, Qunbound)) + if (NILP (fun)) xsignal1 (Qvoid_function, original_fun); if (!CONSP (fun)) xsignal1 (Qinvalid_function, original_fun); @@ -2155,10 +2155,10 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) numargs += nargs - 2; /* Optimize for no indirection. */ - if (SYMBOLP (fun) && !EQ (fun, Qunbound) + if (SYMBOLP (fun) && !NILP (fun) && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) fun = indirect_function (fun); - if (EQ (fun, Qunbound)) + if (NILP (fun)) { /* Let funcall get the error. */ fun = args[0]; @@ -2632,7 +2632,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) /* Optimize for no indirection. */ fun = original_fun; - if (SYMBOLP (fun) && !EQ (fun, Qunbound) + if (SYMBOLP (fun) && !NILP (fun) && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) fun = indirect_function (fun); @@ -2720,7 +2720,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) val = funcall_lambda (fun, numargs, args + 1); else { - if (EQ (fun, Qunbound)) + if (NILP (fun)) xsignal1 (Qvoid_function, original_fun); if (!CONSP (fun)) xsignal1 (Qinvalid_function, original_fun); diff --git a/src/lisp.h b/src/lisp.h index 67ae28a488f..4817c6eb990 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1104,7 +1104,7 @@ struct Lisp_Symbol union Lisp_Fwd *fwd; } val; - /* Function value of the symbol or Qunbound if not fboundp. */ + /* Function value of the symbol or Qnil if not fboundp. */ Lisp_Object function; /* The symbol's property list. */ diff --git a/src/lread.c b/src/lread.c index 5859a2f85a9..6d0ff9f780e 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3957,12 +3957,13 @@ init_obarray (void) /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil, so those two need to be fixed manually. */ SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound); - set_symbol_function (Qunbound, Qunbound); + set_symbol_function (Qunbound, Qnil); set_symbol_plist (Qunbound, Qnil); SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil); XSYMBOL (Qnil)->constant = 1; XSYMBOL (Qnil)->declared_special = 1; set_symbol_plist (Qnil, Qnil); + set_symbol_function (Qnil, Qnil); Qt = intern_c_string ("t"); SET_SYMBOL_VAL (XSYMBOL (Qt), Qt); -- cgit v1.2.1 From 954bba56c62e4e0637a933cf21626a55b873e144 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 21 Nov 2012 11:34:35 -0500 Subject: * src/xdisp.c (fast_set_selected_frame): Rename from update_tool_bar_unwind. Make it set selected_window as well. (update_tool_bar): Use it. --- src/ChangeLog | 6 ++++++ src/xdisp.c | 21 ++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index c16a4dc87ce..b1a76bfdae0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-11-21 Stefan Monnier + + * xdisp.c (fast_set_selected_frame): Rename from update_tool_bar_unwind. + Make it set selected_window as well. + (update_tool_bar): Use it. + 2012-11-21 Ken Brown * emacs.c (main): Set the G_SLICE environment variable for all diff --git a/src/xdisp.c b/src/xdisp.c index 4d359593c75..f0da28fcedd 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11484,11 +11484,18 @@ FRAME_PTR last_mouse_frame; int last_tool_bar_item; - +/* Select `frame' temporarily without running all the code in + do_switch_frame. + FIXME: Maybe do_switch_frame should be trimmed down similarly + when `norecord' is set. */ static Lisp_Object -update_tool_bar_unwind (Lisp_Object frame) +fast_set_selected_frame (Lisp_Object frame) { - selected_frame = frame; + if (!EQ (selected_frame, frame)) + { + selected_frame = frame; + selected_window = XFRAME (frame)->selected_window; + } return Qnil; } @@ -11560,9 +11567,13 @@ update_tool_bar (struct frame *f, int save_match_data) before calling tool_bar_items, because the calculation of the tool-bar keymap uses the selected frame (see `tool-bar-make-keymap' in tool-bar.el). */ - record_unwind_protect (update_tool_bar_unwind, selected_frame); + eassert (EQ (selected_window, + /* Since we only explicitly preserve selected_frame, + check that selected_window would be redundant. */ + XFRAME (selected_frame)->selected_window)); + record_unwind_protect (fast_set_selected_frame, selected_frame); XSETFRAME (frame, f); - selected_frame = frame; + fast_set_selected_frame (frame); /* Build desired tool-bar items from keymaps. */ new_tool_bar -- cgit v1.2.1 From 9239d970523919dfcf7437f728f4976b3a9467f3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 21 Nov 2012 13:06:52 -0800 Subject: Assume POSIX 1003.1-1988 or later for unistd.h. * admin/CPP-DEFINES (BROKEN_GETWD, HAVE_GETCWD, HAVE_GETWD, HAVE_SIZE_T) (HAVE_UNISTD_H): Remove. * configure.ac: Do not check for getcwd or getwd. * lib-src/emacsclient.c (getcwd): Remove decl. (get_current_dir_name): Assume getcwd exists. * lib-src/etags.c (HAVE_GETCWD): Remove. (getcwd): Remove decl. (NO_LONG_OPTIONS): Remove this. All uses removed. Emacs always has GNU getopt. (etags_getcwd): Assume getcwd exists. * lib-src/movemail.c (F_OK, X_OK, W_OK, R_OK): Remove. * nt/config.nt (HAVE_GETCWD): Remove. * src/alloc.c: Assume unistd.h exists. * src/fileio.c (Fexpand_file_name) [DOS_NT]: Use getcwd, not getwd. * src/sysdep.c (get_current_dir_name): Assume getcwd exists. (getwd) [USG]: Remove; no longer needed. (sys_subshell) [DOS_NT]: Use getcwd, not getwd. * src/w32.c (getcwd): Rename from getwd, and switch to getcwd's API. * src/w32.h (getcwd): Remove decl. Fixes: debbugs:12945 --- src/ChangeLog | 11 ++++++++ src/alloc.c | 4 --- src/fileio.c | 2 +- src/sysdep.c | 80 +++-------------------------------------------------------- src/w32.c | 14 +++++++++-- src/w32.h | 2 -- 6 files changed, 28 insertions(+), 85 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index b1a76bfdae0..9e9ae468044 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2012-11-21 Paul Eggert + + Assume POSIX 1003.1-1988 or later for unistd.h (Bug#12945). + * alloc.c: Assume unistd.h exists. + * fileio.c (Fexpand_file_name) [DOS_NT]: Use getcwd, not getwd. + * sysdep.c (get_current_dir_name): Assume getcwd exists. + (getwd) [USG]: Remove; no longer needed. + (sys_subshell) [DOS_NT]: Use getcwd, not getwd. + * w32.c (getcwd): Rename from getwd, and switch to getcwd's API. + * w32.h (getcwd): Remove decl. + 2012-11-21 Stefan Monnier * xdisp.c (fast_set_selected_frame): Rename from update_tool_bar_unwind. diff --git a/src/alloc.c b/src/alloc.c index 22e3db3cc77..46b2dde93a3 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -63,10 +63,6 @@ along with GNU Emacs. If not, see . */ #endif #include -#ifndef HAVE_UNISTD_H -extern void *sbrk (); -#endif - #include #ifdef USE_GTK diff --git a/src/fileio.c b/src/fileio.c index e1a7cf55e28..442c66550d3 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1148,7 +1148,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) newdir = "/"; } else - getwd (adir); + getcwd (adir, MAXPATHLEN + 1); newdir = adir; } diff --git a/src/sysdep.c b/src/sysdep.c index 7c5c144fa8c..3dd19685540 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -101,7 +101,6 @@ along with GNU Emacs. If not, see . */ #define _P_WAIT 0 int _cdecl _spawnlp (int, const char *, const char *, ...); int _cdecl _getpid (void); -extern char *getwd (char *); #endif #include "syssignal.h" @@ -134,12 +133,12 @@ char* get_current_dir_name (void) { char *buf; - char *pwd; + char *pwd = getenv ("PWD"); struct stat dotstat, pwdstat; - /* If PWD is accurate, use it instead of calling getwd. PWD is + /* If PWD is accurate, use it instead of calling getcwd. PWD is sometimes a nicer name, and using it may avoid a fatal error if a parent directory is searchable but not readable. */ - if ((pwd = getenv ("PWD")) != 0 + if (pwd && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1]))) && stat (pwd, &pwdstat) == 0 && stat (".", &dotstat) == 0 @@ -155,7 +154,6 @@ get_current_dir_name (void) return NULL; strcpy (buf, pwd); } -#ifdef HAVE_GETCWD else { size_t buf_size = 1024; @@ -179,22 +177,6 @@ get_current_dir_name (void) return NULL; } } -#else - else - { - /* We need MAXPATHLEN here. */ - buf = malloc (MAXPATHLEN + 1); - if (!buf) - return NULL; - if (getwd (buf) == NULL) - { - int tmp_errno = errno; - free (buf); - errno = tmp_errno; - return NULL; - } - } -#endif return buf; } #endif @@ -521,7 +503,7 @@ sys_subshell (void) const char *sh = 0; #ifdef DOS_NT /* MW, Aug 1993 */ - getwd (oldwd); + getcwd (oldwd, sizeof oldwd); if (sh == 0) sh = (char *) egetenv ("SUSPEND"); /* KFS, 1994-12-14 */ #endif @@ -2238,60 +2220,6 @@ emacs_readlink (char const *filename, char initial_buf[READLINK_BUFSIZE]) &emacs_norealloc_allocator, careadlinkatcwd); } -#ifdef USG -/* - * All of the following are for USG. - * - * On USG systems the system calls are INTERRUPTIBLE by signals - * that the user program has elected to catch. Thus the system call - * must be retried in these cases. To handle this without massive - * changes in the source code, we remap the standard system call names - * to names for our own functions in sysdep.c that do the system call - * with retries. Actually, for portability reasons, it is good - * programming practice, as this example shows, to limit all actual - * system calls to a single occurrence in the source. Sure, this - * adds an extra level of function call overhead but it is almost - * always negligible. Fred Fish, Unisoft Systems Inc. - */ - -/* - * Warning, this function may not duplicate 4.2 action properly - * under error conditions. - */ - -#if !defined (HAVE_GETWD) || defined (BROKEN_GETWD) - -#ifndef MAXPATHLEN -/* In 4.1, param.h fails to define this. */ -#define MAXPATHLEN 1024 -#endif - -char * -getwd (char *pathname) -{ - char *npath, *spath; - extern char *getcwd (char *, size_t); - - block_input (); /* getcwd uses malloc */ - spath = npath = getcwd ((char *) 0, MAXPATHLEN); - if (spath == 0) - { - unblock_input (); - return spath; - } - /* On Altos 3068, getcwd can return @hostname/dir, so discard - up to first slash. Should be harmless on other systems. */ - while (*npath && *npath != '/') - npath++; - strcpy (pathname, npath); - free (spath); /* getcwd uses malloc */ - unblock_input (); - return pathname; -} - -#endif /* !defined (HAVE_GETWD) || defined (BROKEN_GETWD) */ -#endif /* USG */ - /* Directory routines for systems that don't have them. */ #ifdef HAVE_DIRENT_H diff --git a/src/w32.c b/src/w32.c index b51022c6001..da778eb8541 100644 --- a/src/w32.c +++ b/src/w32.c @@ -908,8 +908,18 @@ static char startup_dir[MAXPATHLEN]; /* Get the current working directory. */ char * -getwd (char *dir) +getcwd (char *dir, size_t dirsize) { + if (!dirsize) + { + errno = EINVAL; + return NULL; + } + if (dirsize <= strlen (startup_dir)) + { + errno = ERANGE; + return NULL; + } #if 0 if (GetCurrentDirectory (MAXPATHLEN, dir) > 0) return dir; @@ -1825,7 +1835,7 @@ init_environment (char ** argv) memcpy (*envp, "COMSPEC=", 8); } - /* Remember the initial working directory for getwd. */ + /* Remember the initial working directory for getcwd. */ /* FIXME: Do we need to resolve possible symlinks in startup_dir? Does it matter anywhere in Emacs? */ if (!GetCurrentDirectory (MAXPATHLEN, startup_dir)) diff --git a/src/w32.h b/src/w32.h index 8309a3cc23d..23eda830268 100644 --- a/src/w32.h +++ b/src/w32.h @@ -163,7 +163,6 @@ extern int sys_spawnve (int, char *, char **, char **); extern void register_child (int, int); extern void sys_sleep (int); -extern char *getwd (char *); extern int sys_link (const char *, const char *); @@ -181,4 +180,3 @@ extern ssize_t emacs_gnutls_push (gnutls_transport_ptr_t p, #endif /* HAVE_GNUTLS */ #endif /* EMACS_W32_H */ - -- cgit v1.2.1 From ec84768f9754d5943610cbbd048dc4d4a46d847f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 22 Nov 2012 05:56:38 +0200 Subject: Fix MS-Windows build following 2012-11-21T21:06:52Z!eggert@cs.ucla.edu. src/w32.c (getcwd): Fix the 2nd argument type, to prevent conflicts with Windows system header. Fixes: debbugs:12945 --- src/ChangeLog | 5 +++++ src/w32.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9e9ae468044..3587a9e295b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-11-22 Eli Zaretskii + + * w32.c (getcwd): Fix the 2nd argument type, to prevent conflicts + with Windows system header. + 2012-11-21 Paul Eggert Assume POSIX 1003.1-1988 or later for unistd.h (Bug#12945). diff --git a/src/w32.c b/src/w32.c index da778eb8541..038a442f529 100644 --- a/src/w32.c +++ b/src/w32.c @@ -908,7 +908,7 @@ static char startup_dir[MAXPATHLEN]; /* Get the current working directory. */ char * -getcwd (char *dir, size_t dirsize) +getcwd (char *dir, int dirsize) { if (!dirsize) { -- cgit v1.2.1 From 6ceeb5f14411ed388979d0bb944c06e36756f9af Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 22 Nov 2012 10:52:30 +0400 Subject: * xdisp.c (window_buffer_changed): New function. (update_menu_bar, update_tool_bar): Use it to simplify large 'if' statements. (redisplay_internal): Generalize commonly used 'tail' and 'frame' local variables. --- src/ChangeLog | 8 +++++++ src/xdisp.c | 74 ++++++++++++++++++++++++++--------------------------------- 2 files changed, 40 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 3587a9e295b..4a4572bdd63 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2012-11-22 Dmitry Antipov + + * xdisp.c (window_buffer_changed): New function. + (update_menu_bar, update_tool_bar): Use it to + simplify large 'if' statements. + (redisplay_internal): Generalize commonly used + 'tail' and 'frame' local variables. + 2012-11-22 Eli Zaretskii * w32.c (getcwd): Fix the 2nd argument type, to prevent conflicts diff --git a/src/xdisp.c b/src/xdisp.c index f0da28fcedd..e9b20d148c7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10908,6 +10908,21 @@ window_outdated (struct window *w) || w->last_overlay_modified < OVERLAY_MODIFF); } +/* Nonzero if W's buffer was changed but not saved or Transient Mark mode + is enabled and mark of W's buffer was changed since last W's update. */ + +static int +window_buffer_changed (struct window *w) +{ + struct buffer *b = XBUFFER (w->buffer); + + eassert (BUFFER_LIVE_P (b)); + + return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star) + || ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active))) + != !NILP (w->region_showing))); +} + /*********************************************************************** Mode Lines and Frame Titles ***********************************************************************/ @@ -11327,12 +11342,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run) /* This used to test w->update_mode_line, but we believe there is no need to recompute the menu in that case. */ || update_mode_lines - || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) - < BUF_MODIFF (XBUFFER (w->buffer))) - != w->last_had_star) - || ((!NILP (Vtransient_mark_mode) - && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) - != !NILP (w->region_showing))) + || window_buffer_changed (w)) { struct buffer *prev = current_buffer; ptrdiff_t count = SPECPDL_INDEX (); @@ -11532,12 +11542,7 @@ update_tool_bar (struct frame *f, int save_match_data) if (windows_or_buffers_changed || w->update_mode_line || update_mode_lines - || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) - < BUF_MODIFF (XBUFFER (w->buffer))) - != w->last_had_star) - || ((!NILP (Vtransient_mark_mode) - && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) - != !NILP (w->region_showing))) + || window_buffer_changed (w)) { struct buffer *prev = current_buffer; ptrdiff_t count = SPECPDL_INDEX (); @@ -12988,7 +12993,7 @@ redisplay_internal (void) ptrdiff_t count, count1; struct frame *sf; int polling_stopped_here = 0; - Lisp_Object old_frame = selected_frame; + Lisp_Object tail, frame, old_frame = selected_frame; struct backtrace backtrace; /* Non-zero means redisplay has to consider all windows on all @@ -13040,15 +13045,8 @@ redisplay_internal (void) backtrace.debug_on_exit = 0; backtrace_list = &backtrace; - { - Lisp_Object tail, frame; - - FOR_EACH_FRAME (tail, frame) - { - struct frame *f = XFRAME (frame); - f->already_hscrolled_p = 0; - } - } + FOR_EACH_FRAME (tail, frame) + XFRAME (frame)->already_hscrolled_p = 0; retry: /* Remember the currently selected window. */ @@ -13098,25 +13096,20 @@ redisplay_internal (void) FRAME_TTY (sf)->previous_frame = sf; } - /* Set the visible flags for all frames. Do this before checking - for resized or garbaged frames; they want to know if their frames - are visible. See the comment in frame.h for - FRAME_SAMPLE_VISIBILITY. */ - { - Lisp_Object tail, frame; - - number_of_visible_frames = 0; + /* Set the visible flags for all frames. Do this before checking for + resized or garbaged frames; they want to know if their frames are + visible. See the comment in frame.h for FRAME_SAMPLE_VISIBILITY. */ + number_of_visible_frames = 0; - FOR_EACH_FRAME (tail, frame) - { - struct frame *f = XFRAME (frame); + FOR_EACH_FRAME (tail, frame) + { + struct frame *f = XFRAME (frame); - FRAME_SAMPLE_VISIBILITY (f); - if (FRAME_VISIBLE_P (f)) - ++number_of_visible_frames; - clear_desired_matrices (f); - } - } + FRAME_SAMPLE_VISIBILITY (f); + if (FRAME_VISIBLE_P (f)) + ++number_of_visible_frames; + clear_desired_matrices (f); + } /* Notice any pending interrupt request to change frame size. */ do_pending_window_change (1); @@ -13467,8 +13460,6 @@ redisplay_internal (void) if (consider_all_windows_p) { - Lisp_Object tail, frame; - FOR_EACH_FRAME (tail, frame) XFRAME (frame)->updated_p = 0; @@ -13678,7 +13669,6 @@ redisplay_internal (void) frames here explicitly. */ if (!pending) { - Lisp_Object tail, frame; int new_count = 0; FOR_EACH_FRAME (tail, frame) -- cgit v1.2.1 From 5c74767510841c8afc35f66f5cb068fe99f29615 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 22 Nov 2012 13:32:32 +0400 Subject: * alloc.c (Fgarbage_collect): Unblock input after clearing gc_in_progress to avoid note_mouse_highlight glitch with GC. * frame.h (FRAME_MOUSE_UPDATE): New macro. * msdos.c (IT_frame_up_to_date): Use it here... * w32term.c (w32_frame_up_to_date): ...here... * xterm.c (XTframe_up_to_date): ...and here... * nsterm.m (ns_frame_up_to_date): ...but not here. * lisp.h (Mouse_HLInfo): Remove mouse_face_deferred_gc member. Adjust users. * xdisp.c (message2_nolog, message3_nolog, note_mouse_highlight): Do not check whether GC is in progress. --- src/ChangeLog | 14 ++++++++++++++ src/alloc.c | 4 ++-- src/frame.h | 15 +++++++++++++++ src/lisp.h | 4 ---- src/msdos.c | 15 +-------------- src/nsterm.m | 25 ++++++++++--------------- src/w32term.c | 17 +---------------- src/xdisp.c | 10 ++-------- src/xterm.c | 18 +----------------- 9 files changed, 46 insertions(+), 76 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4a4572bdd63..2e485f1b87b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2012-11-22 Dmitry Antipov + + * alloc.c (Fgarbage_collect): Unblock input after clearing + gc_in_progress to avoid note_mouse_highlight glitch with GC. + * frame.h (FRAME_MOUSE_UPDATE): New macro. + * msdos.c (IT_frame_up_to_date): Use it here... + * w32term.c (w32_frame_up_to_date): ...here... + * xterm.c (XTframe_up_to_date): ...and here... + * nsterm.m (ns_frame_up_to_date): ...but not here. + * lisp.h (Mouse_HLInfo): Remove mouse_face_deferred_gc member. + Adjust users. + * xdisp.c (message2_nolog, message3_nolog, note_mouse_highlight): + Do not check whether GC is in progress. + 2012-11-22 Dmitry Antipov * xdisp.c (window_buffer_changed): New function. diff --git a/src/alloc.c b/src/alloc.c index 46b2dde93a3..28c9b51dab4 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -5331,12 +5331,12 @@ See Info node `(elisp)Garbage Collection'. */) dump_zombies (); #endif - unblock_input (); - check_cons_list (); gc_in_progress = 0; + unblock_input (); + consing_since_gc = 0; if (gc_cons_threshold < GC_DEFAULT_THRESHOLD / 10) gc_cons_threshold = GC_DEFAULT_THRESHOLD / 10; diff --git a/src/frame.h b/src/frame.h index 35cbc44becc..87c4fcb0555 100644 --- a/src/frame.h +++ b/src/frame.h @@ -933,6 +933,21 @@ typedef struct frame *FRAME_PTR; && (frame_var = XCAR (list_var), 1)); \ list_var = XCDR (list_var)) +/* Reflect mouse movement when a complete frame update is performed. */ + +#define FRAME_MOUSE_UPDATE(frame) \ + do { \ + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame); \ + if (frame == hlinfo->mouse_face_mouse_frame) \ + { \ + block_input (); \ + if (hlinfo->mouse_face_mouse_frame) \ + note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \ + hlinfo->mouse_face_mouse_x, \ + hlinfo->mouse_face_mouse_y); \ + unblock_input (); \ + } \ + } while (0) extern Lisp_Object Qframep, Qframe_live_p; extern Lisp_Object Qtty, Qtty_type; diff --git a/src/lisp.h b/src/lisp.h index 4817c6eb990..419176d06c8 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1649,10 +1649,6 @@ typedef struct { int mouse_face_face_id; Lisp_Object mouse_face_overlay; - /* 1 if a mouse motion event came and we didn't handle it right away because - gc was in progress. */ - int mouse_face_deferred_gc; - /* FRAME and X, Y position of mouse when last checked for highlighting. X and Y can be negative or out of range for the frame. */ struct frame *mouse_face_mouse_frame; diff --git a/src/msdos.c b/src/msdos.c index dd05a8b2c5d..433bf1074d8 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1275,7 +1275,6 @@ IT_update_begin (struct frame *f) hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; hlinfo->mouse_face_window = Qnil; - hlinfo->mouse_face_deferred_gc = 0; hlinfo->mouse_face_mouse_frame = NULL; } @@ -1295,21 +1294,10 @@ IT_update_end (struct frame *f) static void IT_frame_up_to_date (struct frame *f) { - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); Lisp_Object new_cursor, frame_desired_cursor; struct window *sw; - if (hlinfo->mouse_face_deferred_gc - || (f && f == hlinfo->mouse_face_mouse_frame)) - { - block_input (); - if (hlinfo->mouse_face_mouse_frame) - note_mouse_highlight (hlinfo->mouse_face_mouse_frame, - hlinfo->mouse_face_mouse_x, - hlinfo->mouse_face_mouse_y); - hlinfo->mouse_face_deferred_gc = 0; - unblock_input (); - } + FRAME_MOUSE_UPDATE (f); /* Set the cursor type to whatever they wanted. In a minibuffer window, we want the cursor to appear only if we are reading input @@ -1849,7 +1837,6 @@ internal_terminal_init (void) FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1]; } the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL; - the_only_display_info.mouse_highlight.mouse_face_deferred_gc = 0; the_only_display_info.mouse_highlight.mouse_face_beg_row = the_only_display_info.mouse_highlight.mouse_face_beg_col = -1; the_only_display_info.mouse_highlight.mouse_face_end_row = diff --git a/src/nsterm.m b/src/nsterm.m index 57d32ee0528..25eb7ebc495 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1186,7 +1186,6 @@ x_free_frame_resources (struct frame *f) hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; hlinfo->mouse_face_window = Qnil; - hlinfo->mouse_face_deferred_gc = 0; hlinfo->mouse_face_mouse_frame = 0; } @@ -1887,8 +1886,7 @@ static void ns_frame_up_to_date (struct frame *f) /* -------------------------------------------------------------------------- External (hook): Fix up mouse highlighting right after a full update. - Some highlighting was deferred if GC was happening during - note_mouse_highlight (), while other highlighting was deferred for update. + Can't use FRAME_MOUSE_UPDATE due to ns_frame_begin and ns_frame_end calls. -------------------------------------------------------------------------- */ { NSTRACE (ns_frame_up_to_date); @@ -1896,19 +1894,17 @@ ns_frame_up_to_date (struct frame *f) if (FRAME_NS_P (f)) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame) - /*&& hlinfo->mouse_face_mouse_frame*/) - { - block_input (); + if (f == hlinfo->mouse_face_mouse_frame) + { + block_input (); ns_update_begin(f); - if (hlinfo->mouse_face_mouse_frame) - note_mouse_highlight (hlinfo->mouse_face_mouse_frame, - hlinfo->mouse_face_mouse_x, - hlinfo->mouse_face_mouse_y); - hlinfo->mouse_face_deferred_gc = 0; + if (hlinfo->mouse_face_mouse_frame) + note_mouse_highlight (hlinfo->mouse_face_mouse_frame, + hlinfo->mouse_face_mouse_x, + hlinfo->mouse_face_mouse_y); ns_update_end(f); - unblock_input (); - } + unblock_input (); + } } } @@ -3869,7 +3865,6 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo) dpyinfo->root_window = 42; /* a placeholder.. */ hlinfo->mouse_face_mouse_frame = NULL; - hlinfo->mouse_face_deferred_gc = 0; hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; diff --git a/src/w32term.c b/src/w32term.c index 032912c27f4..ab6afd32c75 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -723,21 +723,7 @@ static void w32_frame_up_to_date (struct frame *f) { if (FRAME_W32_P (f)) - { - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - - if (hlinfo->mouse_face_deferred_gc - || f == hlinfo->mouse_face_mouse_frame) - { - block_input (); - if (hlinfo->mouse_face_mouse_frame) - note_mouse_highlight (hlinfo->mouse_face_mouse_frame, - hlinfo->mouse_face_mouse_x, - hlinfo->mouse_face_mouse_y); - hlinfo->mouse_face_deferred_gc = 0; - unblock_input (); - } - } + FRAME_MOUSE_UPDATE (f); } @@ -5979,7 +5965,6 @@ x_free_frame_resources (struct frame *f) hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; hlinfo->mouse_face_window = Qnil; - hlinfo->mouse_face_deferred_gc = 0; hlinfo->mouse_face_mouse_frame = 0; } diff --git a/src/xdisp.c b/src/xdisp.c index e9b20d148c7..5d260d851ef 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9642,7 +9642,7 @@ message2_nolog (const char *m, ptrdiff_t nbytes, int multibyte) do_pending_window_change (0); echo_area_display (1); do_pending_window_change (0); - if (FRAME_TERMINAL (f)->frame_up_to_date_hook != 0 && ! gc_in_progress) + if (FRAME_TERMINAL (f)->frame_up_to_date_hook) (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f); } } @@ -9739,7 +9739,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte) do_pending_window_change (0); echo_area_display (1); do_pending_window_change (0); - if (FRAME_TERMINAL (f)->frame_up_to_date_hook != 0 && ! gc_in_progress) + if (FRAME_TERMINAL (f)->frame_up_to_date_hook) (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f); } } @@ -27685,12 +27685,6 @@ note_mouse_highlight (struct frame *f, int x, int y) if (hlinfo->mouse_face_defer) return; - if (gc_in_progress) - { - hlinfo->mouse_face_deferred_gc = 1; - return; - } - /* Which window is that in? */ window = window_from_coordinates (f, x, y, &part, 1); diff --git a/src/xterm.c b/src/xterm.c index 463d82b4ee2..61e942e10d2 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -669,21 +669,7 @@ static void XTframe_up_to_date (struct frame *f) { if (FRAME_X_P (f)) - { - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - - if (hlinfo->mouse_face_deferred_gc - || f == hlinfo->mouse_face_mouse_frame) - { - block_input (); - if (hlinfo->mouse_face_mouse_frame) - note_mouse_highlight (hlinfo->mouse_face_mouse_frame, - hlinfo->mouse_face_mouse_x, - hlinfo->mouse_face_mouse_y); - hlinfo->mouse_face_deferred_gc = 0; - unblock_input (); - } - } + FRAME_MOUSE_UPDATE (f); } @@ -9502,7 +9488,6 @@ x_free_frame_resources (struct frame *f) hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; hlinfo->mouse_face_window = Qnil; - hlinfo->mouse_face_deferred_gc = 0; hlinfo->mouse_face_mouse_frame = 0; } @@ -10153,7 +10138,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) dpyinfo->bitmaps_last = 0; dpyinfo->scratch_cursor_gc = 0; hlinfo->mouse_face_mouse_frame = 0; - hlinfo->mouse_face_deferred_gc = 0; hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; -- cgit v1.2.1 From 12645ae6912e7627d71ebbc7c37d9335cd0a429e Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 23 Nov 2012 14:23:28 +0800 Subject: * xftfont.c (xftfont_open): Remove duplicate assignment. --- src/ChangeLog | 4 ++++ src/xftfont.c | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 2e485f1b87b..d0f4ad6869d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2012-11-23 Chong Yidong + + * xftfont.c (xftfont_open): Remove duplicate assignment. + 2012-11-22 Dmitry Antipov * alloc.c (Fgarbage_collect): Unblock input after clearing diff --git a/src/xftfont.c b/src/xftfont.c index 372ed87705f..181a1da9b38 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -369,7 +369,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) ASET (font_object, FONT_FORMAT_INDEX, ftfont_font_format (xftfont->pattern, filename)); font = XFONT_OBJECT (font_object); - font->pixel_size = pixel_size; + font->pixel_size = size; font->driver = &xftfont_driver; font->encoding_charset = font->repertory_charset = -1; @@ -387,8 +387,6 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) xftfont_info->matrix.xy = 0x10000L * matrix->xy; xftfont_info->matrix.yx = 0x10000L * matrix->yx; } - font->pixel_size = size; - font->driver = &xftfont_driver; if (INTEGERP (AREF (entity, FONT_SPACING_INDEX))) spacing = XINT (AREF (entity, FONT_SPACING_INDEX)); else -- cgit v1.2.1 From 95ef7787fb0a5786a2e4f150649aadfa687a15f2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 22 Nov 2012 23:48:43 -0800 Subject: Assume POSIX 1003.1-1988 or later for dirent.h. * admin/CPP-DEFINES (HAVE_CLOSEDIR, HAVE_DIRENT_H): Remove. * admin/notes/copyright: Adjust to src/ndir.h -> nt/inc/dirent.h renaming. * configure.ac: Do not check for dirent.h or closdir. * nt/inc/dirent.h: Rename from ../src/ndir.h, with these changes: (struct dirent): Rename from struct direct. All uses changed. * nt/inc/sys/dir.h: Remove. * src/dired.c: Assume HAVE_DIRENT_H. (NAMLEN): Remove, replacing with ... (dirent_namelen): New function. All uses changed. Use the GNU macro _D_EXACT_NAMELEN if available, as it's faster than strlen. (DIRENTRY): Remove, replacing all uses with 'struct dirent'. (DIRENTRY_NONEMPTY): Remove. All callers now assume it's nonzero. * src/makefile.w32-in (DIR_H): Remove. All uses replaced with $(NT_INC)/dirent.h. ($(BLD)/w32.$(O)): Do not depend on $(SRC)/ndir.h. * src/ndir.h: Rename to ../nt/inc/dirent.h. * src/sysdep.h (closedir) [!HAVE_CLOSEDIR]: Remove. Do not include ; no longer needed. * src/w32.c: Include rather than "ndir.h". Fixes: debbugs:12958 --- src/ChangeLog | 17 +++++ src/dired.c | 205 +++++++++++++++++++++++----------------------------- src/makefile.w32-in | 6 +- src/ndir.h | 41 ----------- src/sysdep.c | 22 ------ src/w32.c | 8 +- 6 files changed, 113 insertions(+), 186 deletions(-) delete mode 100644 src/ndir.h (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index d0f4ad6869d..5566b623cec 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2012-11-23 Paul Eggert + + Assume POSIX 1003.1-1988 or later for dirent.h (Bug#12958). + * dired.c: Assume HAVE_DIRENT_H. + (NAMLEN): Remove, replacing with ... + (dirent_namelen): New function. All uses changed. Use the GNU macro + _D_EXACT_NAMELEN if available, as it's faster than strlen. + (DIRENTRY): Remove, replacing all uses with 'struct dirent'. + (DIRENTRY_NONEMPTY): Remove. All callers now assume it's nonzero. + * makefile.w32-in (DIR_H): Remove. All uses replaced with + $(NT_INC)/dirent.h. + ($(BLD)/w32.$(O)): Do not depend on $(SRC)/ndir.h. + * ndir.h: Rename to ../nt/inc/dirent.h. + * sysdep.h (closedir) [!HAVE_CLOSEDIR]: Remove. + Do not include ; no longer needed. + * w32.c: Include rather than "ndir.h". + 2012-11-23 Chong Yidong * xftfont.c (xftfont_open): Remove duplicate assignment. diff --git a/src/dired.c b/src/dired.c index 4986f845101..3530b74ecb4 100644 --- a/src/dired.c +++ b/src/dired.c @@ -31,44 +31,10 @@ along with GNU Emacs. If not, see . */ #include #include -/* The d_nameln member of a struct dirent includes the '\0' character - on some systems, but not on others. What's worse, you can't tell - at compile-time which one it will be, since it really depends on - the sort of system providing the filesystem you're reading from, - not the system you are running on. Paul Eggert - says this occurs when Emacs is running on a - SunOS 4.1.2 host, reading a directory that is remote-mounted from a - Solaris 2.1 host and is in a native Solaris 2.1 filesystem. - - Since applying strlen to the name always works, we'll just do that. */ -#define NAMLEN(p) strlen (p->d_name) - -#ifdef HAVE_DIRENT_H - #include -#define DIRENTRY struct dirent - -#else /* not HAVE_DIRENT_H */ - -#include -#include - -#define DIRENTRY struct direct - -extern DIR *opendir (char *); -extern struct direct *readdir (DIR *); - -#endif /* HAVE_DIRENT_H */ - #include #include -#ifdef MSDOS -#define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0) -#else -#define DIRENTRY_NONEMPTY(p) ((p)->d_ino) -#endif - #include "lisp.h" #include "systime.h" #include "character.h" @@ -88,6 +54,17 @@ static Lisp_Object Qfile_attributes_lessp; static ptrdiff_t scmp (const char *, const char *, ptrdiff_t); +/* Return the number of bytes in DP's name. */ +static ptrdiff_t +dirent_namelen (struct dirent *dp) +{ +#ifdef _D_EXACT_NAMLEN + return _D_EXACT_NAMLEN (dp); +#else + return strlen (dp->d_name); +#endif +} + #ifdef WINDOWSNT Lisp_Object directory_files_internal_w32_unwind (Lisp_Object arg) @@ -124,7 +101,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, bool needsep = 0; ptrdiff_t count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; - DIRENTRY *dp; + struct dirent *dp; #ifdef WINDOWSNT Lisp_Object w32_save = Qnil; #endif @@ -209,6 +186,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, /* Loop reading blocks until EOF or error. */ for (;;) { + ptrdiff_t len; + bool wanted = 0; + Lisp_Object name, finalname; + struct gcpro gcpro1, gcpro2; + errno = 0; dp = readdir (d); @@ -225,89 +207,81 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, if (dp == NULL) break; - if (DIRENTRY_NONEMPTY (dp)) + len = dirent_namelen (dp); + name = finalname = make_unibyte_string (dp->d_name, len); + GCPRO2 (finalname, name); + + /* Note: DECODE_FILE can GC; it should protect its argument, + though. */ + name = DECODE_FILE (name); + len = SBYTES (name); + + /* Now that we have unwind_protect in place, we might as well + allow matching to be interrupted. */ + immediate_quit = 1; + QUIT; + + if (NILP (match) + || (0 <= re_search (bufp, SSDATA (name), len, 0, len, 0))) + wanted = 1; + + immediate_quit = 0; + + if (wanted) { - ptrdiff_t len; - bool wanted = 0; - Lisp_Object name, finalname; - struct gcpro gcpro1, gcpro2; + if (!NILP (full)) + { + Lisp_Object fullname; + ptrdiff_t nbytes = len + directory_nbytes + needsep; + ptrdiff_t nchars; - len = NAMLEN (dp); - name = finalname = make_unibyte_string (dp->d_name, len); - GCPRO2 (finalname, name); + fullname = make_uninit_multibyte_string (nbytes, nbytes); + memcpy (SDATA (fullname), SDATA (directory), + directory_nbytes); - /* Note: DECODE_FILE can GC; it should protect its argument, - though. */ - name = DECODE_FILE (name); - len = SBYTES (name); + if (needsep) + SSET (fullname, directory_nbytes, DIRECTORY_SEP); - /* Now that we have unwind_protect in place, we might as well - allow matching to be interrupted. */ - immediate_quit = 1; - QUIT; + memcpy (SDATA (fullname) + directory_nbytes + needsep, + SDATA (name), len); - if (NILP (match) - || (0 <= re_search (bufp, SSDATA (name), len, 0, len, 0))) - wanted = 1; + nchars = chars_in_text (SDATA (fullname), nbytes); - immediate_quit = 0; + /* Some bug somewhere. */ + if (nchars > nbytes) + emacs_abort (); - if (wanted) - { - if (!NILP (full)) - { - Lisp_Object fullname; - ptrdiff_t nbytes = len + directory_nbytes + needsep; - ptrdiff_t nchars; - - fullname = make_uninit_multibyte_string (nbytes, nbytes); - memcpy (SDATA (fullname), SDATA (directory), - directory_nbytes); - - if (needsep) - SSET (fullname, directory_nbytes, DIRECTORY_SEP); - - memcpy (SDATA (fullname) + directory_nbytes + needsep, - SDATA (name), len); - - nchars = chars_in_text (SDATA (fullname), nbytes); - - /* Some bug somewhere. */ - if (nchars > nbytes) - emacs_abort (); - - STRING_SET_CHARS (fullname, nchars); - if (nchars == nbytes) - STRING_SET_UNIBYTE (fullname); - - finalname = fullname; - } - else - finalname = name; - - if (attrs) - { - /* Construct an expanded filename for the directory entry. - Use the decoded names for input to Ffile_attributes. */ - Lisp_Object decoded_fullname, fileattrs; - struct gcpro gcpro1, gcpro2; - - decoded_fullname = fileattrs = Qnil; - GCPRO2 (decoded_fullname, fileattrs); - - /* Both Fexpand_file_name and Ffile_attributes can GC. */ - decoded_fullname = Fexpand_file_name (name, directory); - fileattrs = Ffile_attributes (decoded_fullname, id_format); - - list = Fcons (Fcons (finalname, fileattrs), list); - UNGCPRO; - } - else - list = Fcons (finalname, list); + STRING_SET_CHARS (fullname, nchars); + if (nchars == nbytes) + STRING_SET_UNIBYTE (fullname); + + finalname = fullname; } + else + finalname = name; - UNGCPRO; + if (attrs) + { + /* Construct an expanded filename for the directory entry. + Use the decoded names for input to Ffile_attributes. */ + Lisp_Object decoded_fullname, fileattrs; + struct gcpro gcpro1, gcpro2; + + decoded_fullname = fileattrs = Qnil; + GCPRO2 (decoded_fullname, fileattrs); + + /* Both Fexpand_file_name and Ffile_attributes can GC. */ + decoded_fullname = Fexpand_file_name (name, directory); + fileattrs = Ffile_attributes (decoded_fullname, id_format); + + list = Fcons (Fcons (finalname, fileattrs), list); + UNGCPRO; + } + else + list = Fcons (finalname, list); } + + UNGCPRO; } block_input (); @@ -442,7 +416,8 @@ These are all file names in directory DIRECTORY which begin with FILE. */) return file_name_completion (file, directory, 1, Qnil); } -static int file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr); +static int file_name_completion_stat (Lisp_Object dirname, struct dirent *dp, + struct stat *st_addr); static Lisp_Object Qdefault_directory; static Lisp_Object @@ -499,7 +474,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, /* (att3b compiler bug requires do a null comparison this way) */ while (1) { - DIRENTRY *dp; + struct dirent *dp; ptrdiff_t len; bool canexclude = 0; @@ -517,11 +492,10 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, if (!dp) break; - len = NAMLEN (dp); + len = dirent_namelen (dp); QUIT; - if (! DIRENTRY_NONEMPTY (dp) - || len < SCHARS (encoded_file) + if (len < SCHARS (encoded_file) || 0 <= scmp (dp->d_name, SSDATA (encoded_file), SCHARS (encoded_file))) continue; @@ -806,9 +780,10 @@ scmp (const char *s1, const char *s2, ptrdiff_t len) } static int -file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr) +file_name_completion_stat (Lisp_Object dirname, struct dirent *dp, + struct stat *st_addr) { - ptrdiff_t len = NAMLEN (dp); + ptrdiff_t len = dirent_namelen (dp); ptrdiff_t pos = SCHARS (dirname); int value; USE_SAFE_ALLOCA; diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 9778e955677..5d0c6e72146 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -413,8 +413,6 @@ CONF_POST_H = $(SRC)/conf_post.h \ $(MS_W32_H) CONFIG_H = $(SRC)/config.h \ $(CONF_POST_H) -DIR_H = $(NT_INC)/sys/dir.h \ - $(SRC)/ndir.h W32GUI_H = $(SRC)/w32gui.h \ $(SYSTIME_H) DISPEXTERN_H = $(SRC)/dispextern.h \ @@ -714,6 +712,7 @@ $(BLD)/dired.$(O) : \ $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/regex.h \ + $(NT_INC)/dirent.h \ $(NT_INC)/pwd.h \ $(NT_INC)/sys/stat.h \ $(NT_INC)/unistd.h \ @@ -722,7 +721,6 @@ $(BLD)/dired.$(O) : \ $(CHARSET_H) \ $(CODING_H) \ $(CONFIG_H) \ - $(DIR_H) \ $(FILEMODE_H) \ $(GRP_H) \ $(LISP_H) \ @@ -1175,11 +1173,11 @@ $(BLD)/minibuf.$(O) : \ $(BLD)/w32.$(O) : \ $(SRC)/w32.c \ - $(SRC)/ndir.h \ $(SRC)/w32.h \ $(SRC)/w32common.h \ $(SRC)/w32heap.h \ $(SRC)/w32select.h \ + $(NT_INC)/dirent.h \ $(NT_INC)/pwd.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/sys/time.h \ diff --git a/src/ndir.h b/src/ndir.h deleted file mode 100644 index cd7cdbe55f5..00000000000 --- a/src/ndir.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - -- definitions for 4.2BSD-compatible directory access - - last edit: 09-Jul-1983 D A Gwyn - - * The code here is forced by the interface, and is not subject to - * copyright, constituting the only possible expression of the - * algorithm in this format. - */ - -#define DIRBLKSIZ 512 /* size of directory block */ -#ifdef WINDOWSNT -#define MAXNAMLEN 255 -#else /* not WINDOWSNT */ -#define MAXNAMLEN 15 /* maximum filename length */ -#endif /* not WINDOWSNT */ - /* NOTE: MAXNAMLEN must be one less than a multiple of 4 */ - -struct direct /* data from readdir() */ - { - long d_ino; /* inode number of entry */ - unsigned short d_reclen; /* length of this record */ - unsigned short d_namlen; /* length of string in d_name */ - char d_name[MAXNAMLEN+1]; /* name of file */ - }; - -typedef struct - { - int dd_fd; /* file descriptor */ - int dd_loc; /* offset in block */ - int dd_size; /* amount of valid data */ - char dd_buf[DIRBLKSIZ]; /* directory block */ - } DIR; /* stream data from opendir() */ - -extern DIR *opendir (char *); -extern struct direct *readdir (DIR *); -extern void seekdir (DIR *, long); -extern void closedir (DIR *); - -#define rewinddir( dirp ) seekdir( dirp, 0L ) - diff --git a/src/sysdep.c b/src/sysdep.c index 3dd19685540..bc4dc91509f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2220,28 +2220,6 @@ emacs_readlink (char const *filename, char initial_buf[READLINK_BUFSIZE]) &emacs_norealloc_allocator, careadlinkatcwd); } -/* Directory routines for systems that don't have them. */ - -#ifdef HAVE_DIRENT_H - -#include - -#if !defined (HAVE_CLOSEDIR) - -int -closedir (DIR *dirp /* stream from opendir */) -{ - int rtnval; - - rtnval = emacs_close (dirp->dd_fd); - xfree (dirp); - - return rtnval; -} -#endif /* not HAVE_CLOSEDIR */ -#endif /* HAVE_DIRENT_H */ - - /* Return a struct timeval that is roughly equivalent to T. Use the least timeval not less than T. Return an extremal value if the result would overflow. */ diff --git a/src/w32.c b/src/w32.c index 038a442f529..c8e16dfaa94 100644 --- a/src/w32.c +++ b/src/w32.c @@ -179,7 +179,7 @@ typedef struct _REPARSE_DATA_BUFFER { #undef sendto #include "w32.h" -#include "ndir.h" +#include #include "w32common.h" #include "w32heap.h" #include "w32select.h" @@ -2448,7 +2448,7 @@ is_exec (const char * name) and readdir. We can't use the procedures supplied in sysdep.c, so we provide them here. */ -struct direct dir_static; /* simulated directory contents */ +struct dirent dir_static; /* simulated directory contents */ static HANDLE dir_find_handle = INVALID_HANDLE_VALUE; static int dir_is_fat; static char dir_pathname[MAXPATHLEN+1]; @@ -2518,7 +2518,7 @@ closedir (DIR *dirp) xfree ((char *) dirp); } -struct direct * +struct dirent * readdir (DIR *dirp) { int downcase = !NILP (Vw32_downcase_file_names); @@ -2572,7 +2572,7 @@ readdir (DIR *dirp) downcase = 1; /* 8+3 aliases are returned in all caps */ } dir_static.d_namlen = strlen (dir_static.d_name); - dir_static.d_reclen = sizeof (struct direct) - MAXNAMLEN + 3 + + dir_static.d_reclen = sizeof (struct dirent) - MAXNAMLEN + 3 + dir_static.d_namlen - dir_static.d_namlen % 4; /* If the file name in cFileName[] includes `?' characters, it means -- cgit v1.2.1 From a879f0eaae49460a29c840e3e35acdb84aa9aa7e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 23 Nov 2012 10:47:34 +0200 Subject: Fix bug #12955 with building under MSYS Bash. src/makefile.w32-in (globals.h, gl-stamp): Use $(SWITCHCHAR) instead of a literal "/". (gl-stamp): Invoke fc.exe directly, not through cmd. --- src/ChangeLog | 6 ++++++ src/makefile.w32-in | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 5566b623cec..45df517eff5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-11-23 Eli Zaretskii + + * makefile.w32-in (globals.h, gl-stamp): Use $(SWITCHCHAR) instead + of a literal "/". (Bug#12955) + (gl-stamp): Invoke fc.exe directly, not through cmd. + 2012-11-23 Paul Eggert Assume POSIX 1003.1-1988 or later for dirent.h (Bug#12958). diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 5d0c6e72146..a296f6eb393 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -229,12 +229,12 @@ SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ obj = $(GLOBAL_SOURCES:.c=.o) globals.h: gl-stamp - @cmd /c rem true + @cmd $(SWITCHCHAR)c rem true gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES) - $(DEL) gl-tmp "$(THISDIR)/../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp - cmd /c "fc /b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h" + fc.exe $(SWITCHCHAR)b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h - $(DEL) gl-tmp echo timestamp > $@ -- cgit v1.2.1