aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2012-11-23 23:36:24 +0900
committerKenichi Handa2012-11-23 23:36:24 +0900
commit2aaec2d9be5cec44ea3b59cba476fd3e091f2fc9 (patch)
tree3711b97807201b7eeaa066003b1c3a4ce929e5bb /src
parente1d276cbf9e18f13101328f56bed1a1c0a66e63a (diff)
parente7d0e5ee247a155a268ffbf80bedbe25e15b5032 (diff)
downloademacs-2aaec2d9be5cec44ea3b59cba476fd3e091f2fc9.tar.gz
emacs-2aaec2d9be5cec44ea3b59cba476fd3e091f2fc9.zip
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog146
-rw-r--r--src/alloc.c12
-rw-r--r--src/bytecode.c4
-rw-r--r--src/cygw32.c20
-rw-r--r--src/data.c21
-rw-r--r--src/dired.c205
-rw-r--r--src/emacs.c2
-rw-r--r--src/eval.c132
-rw-r--r--src/fileio.c48
-rw-r--r--src/frame.h15
-rw-r--r--src/lisp.h6
-rw-r--r--src/lread.c3
-rw-r--r--src/makefile.w32-in10
-rw-r--r--src/msdos.c15
-rw-r--r--src/ndir.h41
-rw-r--r--src/nsterm.m25
-rw-r--r--src/sysdep.c102
-rw-r--r--src/w32.c35
-rw-r--r--src/w32.h2
-rw-r--r--src/w32fns.c6
-rw-r--r--src/w32term.c17
-rw-r--r--src/w32term.h2
-rw-r--r--src/xdisp.c175
-rw-r--r--src/xftfont.c4
-rw-r--r--src/xterm.c18
25 files changed, 472 insertions, 594 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6dcddea2e63..c230b4bef24 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -8,6 +8,140 @@
8 * font.c (font_unparse_xlfd): Exclude special characters from the 8 * font.c (font_unparse_xlfd): Exclude special characters from the
9 generating XLFD name. 9 generating XLFD name.
10 10
112012-11-23 Eli Zaretskii <eliz@gnu.org>
12
13 * makefile.w32-in (globals.h, gl-stamp): Use $(SWITCHCHAR) instead
14 of a literal "/". (Bug#12955)
15 (gl-stamp): Invoke fc.exe directly, not through cmd.
16
172012-11-23 Paul Eggert <eggert@cs.ucla.edu>
18
19 Assume POSIX 1003.1-1988 or later for dirent.h (Bug#12958).
20 * dired.c: Assume HAVE_DIRENT_H.
21 (NAMLEN): Remove, replacing with ...
22 (dirent_namelen): New function. All uses changed. Use the GNU macro
23 _D_EXACT_NAMELEN if available, as it's faster than strlen.
24 (DIRENTRY): Remove, replacing all uses with 'struct dirent'.
25 (DIRENTRY_NONEMPTY): Remove. All callers now assume it's nonzero.
26 * makefile.w32-in (DIR_H): Remove. All uses replaced with
27 $(NT_INC)/dirent.h.
28 ($(BLD)/w32.$(O)): Do not depend on $(SRC)/ndir.h.
29 * ndir.h: Rename to ../nt/inc/dirent.h.
30 * sysdep.h (closedir) [!HAVE_CLOSEDIR]: Remove.
31 Do not include <dirent.h>; no longer needed.
32 * w32.c: Include <dirent.h> rather than "ndir.h".
33
342012-11-23 Chong Yidong <cyd@gnu.org>
35
36 * xftfont.c (xftfont_open): Remove duplicate assignment.
37
382012-11-22 Dmitry Antipov <dmantipov@yandex.ru>
39
40 * alloc.c (Fgarbage_collect): Unblock input after clearing
41 gc_in_progress to avoid note_mouse_highlight glitch with GC.
42 * frame.h (FRAME_MOUSE_UPDATE): New macro.
43 * msdos.c (IT_frame_up_to_date): Use it here...
44 * w32term.c (w32_frame_up_to_date): ...here...
45 * xterm.c (XTframe_up_to_date): ...and here...
46 * nsterm.m (ns_frame_up_to_date): ...but not here.
47 * lisp.h (Mouse_HLInfo): Remove mouse_face_deferred_gc member.
48 Adjust users.
49 * xdisp.c (message2_nolog, message3_nolog, note_mouse_highlight):
50 Do not check whether GC is in progress.
51
522012-11-22 Dmitry Antipov <dmantipov@yandex.ru>
53
54 * xdisp.c (window_buffer_changed): New function.
55 (update_menu_bar, update_tool_bar): Use it to
56 simplify large 'if' statements.
57 (redisplay_internal): Generalize commonly used
58 'tail' and 'frame' local variables.
59
602012-11-22 Eli Zaretskii <eliz@gnu.org>
61
62 * w32.c (getcwd): Fix the 2nd argument type, to prevent conflicts
63 with Windows system header.
64
652012-11-21 Paul Eggert <eggert@cs.ucla.edu>
66
67 Assume POSIX 1003.1-1988 or later for unistd.h (Bug#12945).
68 * alloc.c: Assume unistd.h exists.
69 * fileio.c (Fexpand_file_name) [DOS_NT]: Use getcwd, not getwd.
70 * sysdep.c (get_current_dir_name): Assume getcwd exists.
71 (getwd) [USG]: Remove; no longer needed.
72 (sys_subshell) [DOS_NT]: Use getcwd, not getwd.
73 * w32.c (getcwd): Rename from getwd, and switch to getcwd's API.
74 * w32.h (getcwd): Remove decl.
75
762012-11-21 Stefan Monnier <monnier@iro.umontreal.ca>
77
78 * xdisp.c (fast_set_selected_frame): Rename from update_tool_bar_unwind.
79 Make it set selected_window as well.
80 (update_tool_bar): Use it.
81
822012-11-21 Ken Brown <kbrown@cornell.edu>
83
84 * emacs.c (main): Set the G_SLICE environment variable for all
85 Cygwin builds, not just GTK builds. See
86 https://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00368.html.
87
882012-11-21 Eli Zaretskii <eliz@gnu.org>
89
90 * w32.c (FILE_DEVICE_FILE_SYSTEM, METHOD_BUFFERED)
91 (FILE_ANY_ACCESS, CTL_CODE, FSCTL_GET_REPARSE_POINT) [_MSC_VER]:
92 Define for the MSVC compiler.
93
94 * w32term.h (EnumSystemLocalesW) [_MSC_VER]: Add a missing semi-colon.
95
96 * fileio.c (Fsubstitute_in_file_name, Ffile_name_directory)
97 (Fexpand_file_name) [DOS_NT]: Pass encoded file name to
98 dostounix_filename. Prevents crashes down the road, because
99 dostounix_filename assumes it gets a unibyte string. Reported by
100 Michel de Ruiter <michel@sentient.nl>, see
101 http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00017.html
102
1032012-11-20 Stefan Monnier <monnier@iro.umontreal.ca>
104
105 Conflate Qnil and Qunbound for `symbol-function'.
106 * alloc.c (Fmake_symbol): Initialize `function' to Qnil.
107 * lread.c (init_obarray): Set `function' fields to Qnil.
108 * eval.c (Fcommandp): Ignore Qunbound.
109 (Fautoload, eval_sub, Fapply, Ffuncall, Fmacroexpand):
110 * data.c (Ffset, Ffboundp, indirect_function, Findirect_function):
111 Test NILP rather than Qunbound.
112 (Ffmakunbound): Set to Qnil.
113 (Fsymbol_function): Never signal an error.
114 (Finteractive_form): Ignore Qunbound.
115
1162012-11-20 Paul Eggert <eggert@cs.ucla.edu>
117
118 * eval.c (interactive_p): Remove no-longer-used decl.
119
1202012-11-20 Dmitry Antipov <dmantipov@yandex.ru>
121
122 * xdisp.c (buffer_shared): Adjust comment.
123 (buffer_shared_and_changed): New function.
124 (prepare_menu_bars, redisplay_internal): Use it to
125 decide whether all windows or frames should be updated.
126 (window_outdated): New function.
127 (text_outside_line_unchanged_p, redisplay_window): Use it.
128 (redisplay_internal): Likewise. Fix indentation.
129
1302012-11-20 Stefan Monnier <monnier@iro.umontreal.ca>
131
132 * eval.c (Finteractive_p, Fcalled_interactively_p, interactive_p): Remove.
133 (syms_of_eval): Remove corresponding defsubr.
134 * bytecode.c (exec_byte_code): `interactive-p' is now a Lisp function.
135
1362012-11-19 Daniel Colascione <dancol@dancol.org>
137
138 * w32fns.c (Fx_file_dialog):
139 (Fx_file_dialog): Accomodate rename of cygwin_convert_path* to
140 cygwin_convert_file_name*.
141
142 * cygw32.c (Fcygwin_convert_path_to_windows, syms_of_cygw32):
143 Rename cygwin_convert_path* to cygwin_convert_file_name*.
144
112012-11-18 Paul Eggert <eggert@cs.ucla.edu> 1452012-11-18 Paul Eggert <eggert@cs.ucla.edu>
12 146
13 * nsterm.m (ns_select): Send SIGIO only to self, not to process group. 147 * nsterm.m (ns_select): Send SIGIO only to self, not to process group.
@@ -18,10 +152,10 @@
18 windows.h gets included before w32term.h uses some of its 152 windows.h gets included before w32term.h uses some of its
19 features, see below. 153 features, see below.
20 154
21 * w32term.h (LOCALE_ENUMPROCA, LOCALE_ENUMPROCW) [_MSC_VER]: New 155 * w32term.h (LOCALE_ENUMPROCA, LOCALE_ENUMPROCW) [_MSC_VER]:
22 typedefs. 156 New typedefs.
23 (EnumSystemLocalesA, EnumSystemLocalesW) [_MSC_VER]: New 157 (EnumSystemLocalesA, EnumSystemLocalesW) [_MSC_VER]:
24 prototypes. 158 New prototypes.
25 (EnumSystemLocales) [_MSC_VER]: Define if undefined. (Bug#12878) 159 (EnumSystemLocales) [_MSC_VER]: Define if undefined. (Bug#12878)
26 160
272012-11-18 Jan Djärv <jan.h.d@swipnet.se> 1612012-11-18 Jan Djärv <jan.h.d@swipnet.se>
@@ -313,8 +447,8 @@
313 * xdisp.c (try_scrolling): Fix correction of aggressive-scroll 447 * xdisp.c (try_scrolling): Fix correction of aggressive-scroll
314 amount when the scroll margins are too large. When scrolling 448 amount when the scroll margins are too large. When scrolling
315 backwards in the buffer, give up if cannot reach point or the 449 backwards in the buffer, give up if cannot reach point or the
316 scroll margin within a reasonable number of screen lines. Fixes 450 scroll margin within a reasonable number of screen lines.
317 point position in window under scroll-up/down-aggressively when 451 Fixes point position in window under scroll-up/down-aggressively when
318 point is positioned many lines beyond the window top/bottom. 452 point is positioned many lines beyond the window top/bottom.
319 (Bug#12811) 453 (Bug#12811)
320 454
diff --git a/src/alloc.c b/src/alloc.c
index a66a752f5dc..28c9b51dab4 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -63,10 +63,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
63#endif 63#endif
64 64
65#include <unistd.h> 65#include <unistd.h>
66#ifndef HAVE_UNISTD_H
67extern void *sbrk ();
68#endif
69
70#include <fcntl.h> 66#include <fcntl.h>
71 67
72#ifdef USE_GTK 68#ifdef USE_GTK
@@ -3212,7 +3208,7 @@ static struct Lisp_Symbol *symbol_free_list;
3212 3208
3213DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0, 3209DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0,
3214 doc: /* Return a newly allocated uninterned symbol whose name is NAME. 3210 doc: /* Return a newly allocated uninterned symbol whose name is NAME.
3215Its value and function definition are void, and its property list is nil. */) 3211Its value is void, and its function definition and property list are nil. */)
3216 (Lisp_Object name) 3212 (Lisp_Object name)
3217{ 3213{
3218 register Lisp_Object val; 3214 register Lisp_Object val;
@@ -3249,7 +3245,7 @@ Its value and function definition are void, and its property list is nil. */)
3249 set_symbol_plist (val, Qnil); 3245 set_symbol_plist (val, Qnil);
3250 p->redirect = SYMBOL_PLAINVAL; 3246 p->redirect = SYMBOL_PLAINVAL;
3251 SET_SYMBOL_VAL (p, Qunbound); 3247 SET_SYMBOL_VAL (p, Qunbound);
3252 set_symbol_function (val, Qunbound); 3248 set_symbol_function (val, Qnil);
3253 set_symbol_next (val, NULL); 3249 set_symbol_next (val, NULL);
3254 p->gcmarkbit = 0; 3250 p->gcmarkbit = 0;
3255 p->interned = SYMBOL_UNINTERNED; 3251 p->interned = SYMBOL_UNINTERNED;
@@ -5335,12 +5331,12 @@ See Info node `(elisp)Garbage Collection'. */)
5335 dump_zombies (); 5331 dump_zombies ();
5336#endif 5332#endif
5337 5333
5338 unblock_input ();
5339
5340 check_cons_list (); 5334 check_cons_list ();
5341 5335
5342 gc_in_progress = 0; 5336 gc_in_progress = 0;
5343 5337
5338 unblock_input ();
5339
5344 consing_since_gc = 0; 5340 consing_since_gc = 0;
5345 if (gc_cons_threshold < GC_DEFAULT_THRESHOLD / 10) 5341 if (gc_cons_threshold < GC_DEFAULT_THRESHOLD / 10)
5346 gc_cons_threshold = GC_DEFAULT_THRESHOLD / 10; 5342 gc_cons_threshold = GC_DEFAULT_THRESHOLD / 10;
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,
1579 NEXT; 1579 NEXT;
1580 1580
1581 CASE (Binteractive_p): /* Obsolete since 24.1. */ 1581 CASE (Binteractive_p): /* Obsolete since 24.1. */
1582 PUSH (Finteractive_p ()); 1582 BEFORE_POTENTIAL_GC ();
1583 PUSH (call0 (intern ("interactive-p")));
1584 AFTER_POTENTIAL_GC ();
1583 NEXT; 1585 NEXT;
1584 1586
1585 CASE (Bforward_char): 1587 CASE (Bforward_char):
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)
106 return unbind_to (count, DECODE_FILE (converted)); 106 return unbind_to (count, DECODE_FILE (converted));
107} 107}
108 108
109DEFUN ("cygwin-convert-path-to-windows", 109DEFUN ("cygwin-convert-file-name-to-windows",
110 Fcygwin_convert_path_to_windows, Scygwin_convert_path_to_windows, 110 Fcygwin_convert_file_name_to_windows,
111 Scygwin_convert_file_name_to_windows,
111 1, 2, 0, 112 1, 2, 0,
112 doc: /* Convert PATH to a Windows path. If ABSOLUTE-P if 113 doc: /* Convert PATH to a Windows path. If ABSOLUTE-P is
113 non-nil, return an absolute path.*/) 114non-nil, return an absolute path.*/)
114 (Lisp_Object path, Lisp_Object absolute_p) 115 (Lisp_Object path, Lisp_Object absolute_p)
115{ 116{
116 return from_unicode ( 117 return from_unicode (
117 conv_filename_to_w32_unicode (path, EQ (absolute_p, Qnil) ? 0 : 1)); 118 conv_filename_to_w32_unicode (path, EQ (absolute_p, Qnil) ? 0 : 1));
118} 119}
119 120
120DEFUN ("cygwin-convert-path-from-windows", 121DEFUN ("cygwin-convert-file-name-from-windows",
121 Fcygwin_convert_path_from_windows, Scygwin_convert_path_from_windows, 122 Fcygwin_convert_file_name_from_windows,
123 Scygwin_convert_file_name_from_windows,
122 1, 2, 0, 124 1, 2, 0,
123 doc: /* Convert a Windows path to a Cygwin path. If ABSOLUTE-P 125 doc: /* Convert a Windows path to a Cygwin path. If ABSOLUTE-P
124 if non-nil, return an absolute path.*/) 126is non-nil, return an absolute path.*/)
125 (Lisp_Object path, Lisp_Object absolute_p) 127 (Lisp_Object path, Lisp_Object absolute_p)
126{ 128{
127 return conv_filename_from_w32_unicode (to_unicode (path, &path), 129 return conv_filename_from_w32_unicode (to_unicode (path, &path),
@@ -131,6 +133,6 @@ DEFUN ("cygwin-convert-path-from-windows",
131void 133void
132syms_of_cygw32 (void) 134syms_of_cygw32 (void)
133{ 135{
134 defsubr (&Scygwin_convert_path_from_windows); 136 defsubr (&Scygwin_convert_file_name_from_windows);
135 defsubr (&Scygwin_convert_path_to_windows); 137 defsubr (&Scygwin_convert_file_name_to_windows);
136} 138}
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,
543 return (EQ (valcontents, Qunbound) ? Qnil : Qt); 543 return (EQ (valcontents, Qunbound) ? Qnil : Qt);
544} 544}
545 545
546/* FIXME: Make it an alias for function-symbol! */
546DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, 547DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
547 doc: /* Return t if SYMBOL's function definition is not void. */) 548 doc: /* Return t if SYMBOL's function definition is not void. */)
548 (register Lisp_Object symbol) 549 (register Lisp_Object symbol)
549{ 550{
550 CHECK_SYMBOL (symbol); 551 CHECK_SYMBOL (symbol);
551 return EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt; 552 return NILP (XSYMBOL (symbol)->function) ? Qnil : Qt;
552} 553}
553 554
554DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0, 555DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
@@ -564,14 +565,14 @@ Return SYMBOL. */)
564} 565}
565 566
566DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, 567DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0,
567 doc: /* Make SYMBOL's function definition be void. 568 doc: /* Make SYMBOL's function definition be nil.
568Return SYMBOL. */) 569Return SYMBOL. */)
569 (register Lisp_Object symbol) 570 (register Lisp_Object symbol)
570{ 571{
571 CHECK_SYMBOL (symbol); 572 CHECK_SYMBOL (symbol);
572 if (NILP (symbol) || EQ (symbol, Qt)) 573 if (NILP (symbol) || EQ (symbol, Qt))
573 xsignal1 (Qsetting_constant, symbol); 574 xsignal1 (Qsetting_constant, symbol);
574 set_symbol_function (symbol, Qunbound); 575 set_symbol_function (symbol, Qnil);
575 return symbol; 576 return symbol;
576} 577}
577 578
@@ -580,9 +581,7 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
580 (register Lisp_Object symbol) 581 (register Lisp_Object symbol)
581{ 582{
582 CHECK_SYMBOL (symbol); 583 CHECK_SYMBOL (symbol);
583 if (!EQ (XSYMBOL (symbol)->function, Qunbound))
584 return XSYMBOL (symbol)->function; 584 return XSYMBOL (symbol)->function;
585 xsignal1 (Qvoid_function, symbol);
586} 585}
587 586
588DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, 587DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
@@ -613,7 +612,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
613 612
614 function = XSYMBOL (symbol)->function; 613 function = XSYMBOL (symbol)->function;
615 614
616 if (!NILP (Vautoload_queue) && !EQ (function, Qunbound)) 615 if (!NILP (Vautoload_queue) && !NILP (function))
617 Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue); 616 Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue);
618 617
619 if (AUTOLOADP (function)) 618 if (AUTOLOADP (function))
@@ -714,7 +713,7 @@ Value, if non-nil, is a list \(interactive SPEC). */)
714{ 713{
715 Lisp_Object fun = indirect_function (cmd); /* Check cycles. */ 714 Lisp_Object fun = indirect_function (cmd); /* Check cycles. */
716 715
717 if (NILP (fun) || EQ (fun, Qunbound)) 716 if (NILP (fun))
718 return Qnil; 717 return Qnil;
719 718
720 /* Use an `interactive-form' property if present, analogous to the 719 /* Use an `interactive-form' property if present, analogous to the
@@ -2008,10 +2007,10 @@ indirect_function (register Lisp_Object object)
2008 2007
2009 for (;;) 2008 for (;;)
2010 { 2009 {
2011 if (!SYMBOLP (hare) || EQ (hare, Qunbound)) 2010 if (!SYMBOLP (hare) || NILP (hare))
2012 break; 2011 break;
2013 hare = XSYMBOL (hare)->function; 2012 hare = XSYMBOL (hare)->function;
2014 if (!SYMBOLP (hare) || EQ (hare, Qunbound)) 2013 if (!SYMBOLP (hare) || NILP (hare))
2015 break; 2014 break;
2016 hare = XSYMBOL (hare)->function; 2015 hare = XSYMBOL (hare)->function;
2017 2016
@@ -2038,10 +2037,10 @@ function chain of symbols. */)
2038 2037
2039 /* Optimize for no indirection. */ 2038 /* Optimize for no indirection. */
2040 result = object; 2039 result = object;
2041 if (SYMBOLP (result) && !EQ (result, Qunbound) 2040 if (SYMBOLP (result) && !NILP (result)
2042 && (result = XSYMBOL (result)->function, SYMBOLP (result))) 2041 && (result = XSYMBOL (result)->function, SYMBOLP (result)))
2043 result = indirect_function (result); 2042 result = indirect_function (result);
2044 if (!EQ (result, Qunbound)) 2043 if (!NILP (result))
2045 return result; 2044 return result;
2046 2045
2047 if (NILP (noerror)) 2046 if (NILP (noerror))
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 <http://www.gnu.org/licenses/>. */
31#include <errno.h> 31#include <errno.h>
32#include <unistd.h> 32#include <unistd.h>
33 33
34/* The d_nameln member of a struct dirent includes the '\0' character
35 on some systems, but not on others. What's worse, you can't tell
36 at compile-time which one it will be, since it really depends on
37 the sort of system providing the filesystem you're reading from,
38 not the system you are running on. Paul Eggert
39 <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
40 SunOS 4.1.2 host, reading a directory that is remote-mounted from a
41 Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
42
43 Since applying strlen to the name always works, we'll just do that. */
44#define NAMLEN(p) strlen (p->d_name)
45
46#ifdef HAVE_DIRENT_H
47
48#include <dirent.h> 34#include <dirent.h>
49#define DIRENTRY struct dirent
50
51#else /* not HAVE_DIRENT_H */
52
53#include <sys/dir.h>
54#include <sys/stat.h>
55
56#define DIRENTRY struct direct
57
58extern DIR *opendir (char *);
59extern struct direct *readdir (DIR *);
60
61#endif /* HAVE_DIRENT_H */
62
63#include <filemode.h> 35#include <filemode.h>
64#include <stat-time.h> 36#include <stat-time.h>
65 37
66#ifdef MSDOS
67#define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
68#else
69#define DIRENTRY_NONEMPTY(p) ((p)->d_ino)
70#endif
71
72#include "lisp.h" 38#include "lisp.h"
73#include "systime.h" 39#include "systime.h"
74#include "character.h" 40#include "character.h"
@@ -88,6 +54,17 @@ static Lisp_Object Qfile_attributes_lessp;
88 54
89static ptrdiff_t scmp (const char *, const char *, ptrdiff_t); 55static ptrdiff_t scmp (const char *, const char *, ptrdiff_t);
90 56
57/* Return the number of bytes in DP's name. */
58static ptrdiff_t
59dirent_namelen (struct dirent *dp)
60{
61#ifdef _D_EXACT_NAMLEN
62 return _D_EXACT_NAMLEN (dp);
63#else
64 return strlen (dp->d_name);
65#endif
66}
67
91#ifdef WINDOWSNT 68#ifdef WINDOWSNT
92Lisp_Object 69Lisp_Object
93directory_files_internal_w32_unwind (Lisp_Object arg) 70directory_files_internal_w32_unwind (Lisp_Object arg)
@@ -124,7 +101,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
124 bool needsep = 0; 101 bool needsep = 0;
125 ptrdiff_t count = SPECPDL_INDEX (); 102 ptrdiff_t count = SPECPDL_INDEX ();
126 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 103 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
127 DIRENTRY *dp; 104 struct dirent *dp;
128#ifdef WINDOWSNT 105#ifdef WINDOWSNT
129 Lisp_Object w32_save = Qnil; 106 Lisp_Object w32_save = Qnil;
130#endif 107#endif
@@ -209,6 +186,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
209 /* Loop reading blocks until EOF or error. */ 186 /* Loop reading blocks until EOF or error. */
210 for (;;) 187 for (;;)
211 { 188 {
189 ptrdiff_t len;
190 bool wanted = 0;
191 Lisp_Object name, finalname;
192 struct gcpro gcpro1, gcpro2;
193
212 errno = 0; 194 errno = 0;
213 dp = readdir (d); 195 dp = readdir (d);
214 196
@@ -225,89 +207,81 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
225 if (dp == NULL) 207 if (dp == NULL)
226 break; 208 break;
227 209
228 if (DIRENTRY_NONEMPTY (dp)) 210 len = dirent_namelen (dp);
211 name = finalname = make_unibyte_string (dp->d_name, len);
212 GCPRO2 (finalname, name);
213
214 /* Note: DECODE_FILE can GC; it should protect its argument,
215 though. */
216 name = DECODE_FILE (name);
217 len = SBYTES (name);
218
219 /* Now that we have unwind_protect in place, we might as well
220 allow matching to be interrupted. */
221 immediate_quit = 1;
222 QUIT;
223
224 if (NILP (match)
225 || (0 <= re_search (bufp, SSDATA (name), len, 0, len, 0)))
226 wanted = 1;
227
228 immediate_quit = 0;
229
230 if (wanted)
229 { 231 {
230 ptrdiff_t len; 232 if (!NILP (full))
231 bool wanted = 0; 233 {
232 Lisp_Object name, finalname; 234 Lisp_Object fullname;
233 struct gcpro gcpro1, gcpro2; 235 ptrdiff_t nbytes = len + directory_nbytes + needsep;
236 ptrdiff_t nchars;
234 237
235 len = NAMLEN (dp); 238 fullname = make_uninit_multibyte_string (nbytes, nbytes);
236 name = finalname = make_unibyte_string (dp->d_name, len); 239 memcpy (SDATA (fullname), SDATA (directory),
237 GCPRO2 (finalname, name); 240 directory_nbytes);
238 241
239 /* Note: DECODE_FILE can GC; it should protect its argument, 242 if (needsep)
240 though. */ 243 SSET (fullname, directory_nbytes, DIRECTORY_SEP);
241 name = DECODE_FILE (name);
242 len = SBYTES (name);
243 244
244 /* Now that we have unwind_protect in place, we might as well 245 memcpy (SDATA (fullname) + directory_nbytes + needsep,
245 allow matching to be interrupted. */ 246 SDATA (name), len);
246 immediate_quit = 1;
247 QUIT;
248 247
249 if (NILP (match) 248 nchars = chars_in_text (SDATA (fullname), nbytes);
250 || (0 <= re_search (bufp, SSDATA (name), len, 0, len, 0)))
251 wanted = 1;
252 249
253 immediate_quit = 0; 250 /* Some bug somewhere. */
251 if (nchars > nbytes)
252 emacs_abort ();
254 253
255 if (wanted) 254 STRING_SET_CHARS (fullname, nchars);
256 { 255 if (nchars == nbytes)
257 if (!NILP (full)) 256 STRING_SET_UNIBYTE (fullname);
258 { 257
259 Lisp_Object fullname; 258 finalname = fullname;
260 ptrdiff_t nbytes = len + directory_nbytes + needsep;
261 ptrdiff_t nchars;
262
263 fullname = make_uninit_multibyte_string (nbytes, nbytes);
264 memcpy (SDATA (fullname), SDATA (directory),
265 directory_nbytes);
266
267 if (needsep)
268 SSET (fullname, directory_nbytes, DIRECTORY_SEP);
269
270 memcpy (SDATA (fullname) + directory_nbytes + needsep,
271 SDATA (name), len);
272
273 nchars = chars_in_text (SDATA (fullname), nbytes);
274
275 /* Some bug somewhere. */
276 if (nchars > nbytes)
277 emacs_abort ();
278
279 STRING_SET_CHARS (fullname, nchars);
280 if (nchars == nbytes)
281 STRING_SET_UNIBYTE (fullname);
282
283 finalname = fullname;
284 }
285 else
286 finalname = name;
287
288 if (attrs)
289 {
290 /* Construct an expanded filename for the directory entry.
291 Use the decoded names for input to Ffile_attributes. */
292 Lisp_Object decoded_fullname, fileattrs;
293 struct gcpro gcpro1, gcpro2;
294
295 decoded_fullname = fileattrs = Qnil;
296 GCPRO2 (decoded_fullname, fileattrs);
297
298 /* Both Fexpand_file_name and Ffile_attributes can GC. */
299 decoded_fullname = Fexpand_file_name (name, directory);
300 fileattrs = Ffile_attributes (decoded_fullname, id_format);
301
302 list = Fcons (Fcons (finalname, fileattrs), list);
303 UNGCPRO;
304 }
305 else
306 list = Fcons (finalname, list);
307 } 259 }
260 else
261 finalname = name;
308 262
309 UNGCPRO; 263 if (attrs)
264 {
265 /* Construct an expanded filename for the directory entry.
266 Use the decoded names for input to Ffile_attributes. */
267 Lisp_Object decoded_fullname, fileattrs;
268 struct gcpro gcpro1, gcpro2;
269
270 decoded_fullname = fileattrs = Qnil;
271 GCPRO2 (decoded_fullname, fileattrs);
272
273 /* Both Fexpand_file_name and Ffile_attributes can GC. */
274 decoded_fullname = Fexpand_file_name (name, directory);
275 fileattrs = Ffile_attributes (decoded_fullname, id_format);
276
277 list = Fcons (Fcons (finalname, fileattrs), list);
278 UNGCPRO;
279 }
280 else
281 list = Fcons (finalname, list);
310 } 282 }
283
284 UNGCPRO;
311 } 285 }
312 286
313 block_input (); 287 block_input ();
@@ -442,7 +416,8 @@ These are all file names in directory DIRECTORY which begin with FILE. */)
442 return file_name_completion (file, directory, 1, Qnil); 416 return file_name_completion (file, directory, 1, Qnil);
443} 417}
444 418
445static int file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr); 419static int file_name_completion_stat (Lisp_Object dirname, struct dirent *dp,
420 struct stat *st_addr);
446static Lisp_Object Qdefault_directory; 421static Lisp_Object Qdefault_directory;
447 422
448static Lisp_Object 423static Lisp_Object
@@ -499,7 +474,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
499 /* (att3b compiler bug requires do a null comparison this way) */ 474 /* (att3b compiler bug requires do a null comparison this way) */
500 while (1) 475 while (1)
501 { 476 {
502 DIRENTRY *dp; 477 struct dirent *dp;
503 ptrdiff_t len; 478 ptrdiff_t len;
504 bool canexclude = 0; 479 bool canexclude = 0;
505 480
@@ -517,11 +492,10 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
517 492
518 if (!dp) break; 493 if (!dp) break;
519 494
520 len = NAMLEN (dp); 495 len = dirent_namelen (dp);
521 496
522 QUIT; 497 QUIT;
523 if (! DIRENTRY_NONEMPTY (dp) 498 if (len < SCHARS (encoded_file)
524 || len < SCHARS (encoded_file)
525 || 0 <= scmp (dp->d_name, SSDATA (encoded_file), 499 || 0 <= scmp (dp->d_name, SSDATA (encoded_file),
526 SCHARS (encoded_file))) 500 SCHARS (encoded_file)))
527 continue; 501 continue;
@@ -806,9 +780,10 @@ scmp (const char *s1, const char *s2, ptrdiff_t len)
806} 780}
807 781
808static int 782static int
809file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr) 783file_name_completion_stat (Lisp_Object dirname, struct dirent *dp,
784 struct stat *st_addr)
810{ 785{
811 ptrdiff_t len = NAMLEN (dp); 786 ptrdiff_t len = dirent_namelen (dp);
812 ptrdiff_t pos = SCHARS (dirname); 787 ptrdiff_t pos = SCHARS (dirname);
813 int value; 788 int value;
814 USE_SAFE_ALLOCA; 789 USE_SAFE_ALLOCA;
diff --git a/src/emacs.c b/src/emacs.c
index d69dbfda7bf..b2b193e3a4f 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -715,7 +715,7 @@ main (int argc, char **argv)
715 stack_base = &dummy; 715 stack_base = &dummy;
716#endif 716#endif
717 717
718#if defined (USE_GTK) && defined (G_SLICE_ALWAYS_MALLOC) 718#ifdef G_SLICE_ALWAYS_MALLOC
719 /* This is used by the Cygwin build. */ 719 /* This is used by the Cygwin build. */
720 setenv ("G_SLICE", "always-malloc", 1); 720 setenv ("G_SLICE", "always-malloc", 1);
721#endif 721#endif
diff --git a/src/eval.c b/src/eval.c
index f8a76646352..34b20f6fc8e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -114,7 +114,6 @@ Lisp_Object Vsignaling_function;
114Lisp_Object inhibit_lisp_code; 114Lisp_Object inhibit_lisp_code;
115 115
116static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); 116static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
117static bool interactive_p (void);
118static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); 117static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
119 118
120/* Functions to set Lisp_Object slots of struct specbinding. */ 119/* Functions to set Lisp_Object slots of struct specbinding. */
@@ -489,102 +488,6 @@ usage: (function ARG) */)
489} 488}
490 489
491 490
492DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0,
493 doc: /* Return t if the containing function was run directly by user input.
494This means that the function was called with `call-interactively'
495\(which includes being called as the binding of a key)
496and input is currently coming from the keyboard (not a keyboard macro),
497and Emacs is not running in batch mode (`noninteractive' is nil).
498
499The only known proper use of `interactive-p' is in deciding whether to
500display a helpful message, or how to display it. If you're thinking
501of using it for any other purpose, it is quite likely that you're
502making a mistake. Think: what do you want to do when the command is
503called from a keyboard macro?
504
505To test whether your function was called with `call-interactively',
506either (i) add an extra optional argument and give it an `interactive'
507spec that specifies non-nil unconditionally (such as \"p\"); or (ii)
508use `called-interactively-p'. */)
509 (void)
510{
511 return (INTERACTIVE && interactive_p ()) ? Qt : Qnil;
512}
513
514
515DEFUN ("called-interactively-p", Fcalled_interactively_p, Scalled_interactively_p, 0, 1, 0,
516 doc: /* Return t if the containing function was called by `call-interactively'.
517If KIND is `interactive', then only return t if the call was made
518interactively by the user, i.e. not in `noninteractive' mode nor
519when `executing-kbd-macro'.
520If KIND is `any', on the other hand, it will return t for any kind of
521interactive call, including being called as the binding of a key, or
522from a keyboard macro, or in `noninteractive' mode.
523
524The only known proper use of `interactive' for KIND is in deciding
525whether to display a helpful message, or how to display it. If you're
526thinking of using it for any other purpose, it is quite likely that
527you're making a mistake. Think: what do you want to do when the
528command is called from a keyboard macro?
529
530Instead of using this function, it is sometimes cleaner to give your
531function an extra optional argument whose `interactive' spec specifies
532non-nil unconditionally (\"p\" is a good way to do this), or via
533\(not (or executing-kbd-macro noninteractive)). */)
534 (Lisp_Object kind)
535{
536 return (((INTERACTIVE || !EQ (kind, intern ("interactive")))
537 && interactive_p ())
538 ? Qt : Qnil);
539}
540
541
542/* Return true if function in which this appears was called using
543 call-interactively and is not a built-in. */
544
545static bool
546interactive_p (void)
547{
548 struct backtrace *btp;
549 Lisp_Object fun;
550
551 btp = backtrace_list;
552
553 /* If this isn't a byte-compiled function, there may be a frame at
554 the top for Finteractive_p. If so, skip it. */
555 fun = Findirect_function (btp->function, Qnil);
556 if (SUBRP (fun) && (XSUBR (fun) == &Sinteractive_p
557 || XSUBR (fun) == &Scalled_interactively_p))
558 btp = btp->next;
559
560 /* If we're running an Emacs 18-style byte-compiled function, there
561 may be a frame for Fbytecode at the top level. In any version of
562 Emacs there can be Fbytecode frames for subexpressions evaluated
563 inside catch and condition-case. Skip past them.
564
565 If this isn't a byte-compiled function, then we may now be
566 looking at several frames for special forms. Skip past them. */
567 while (btp
568 && (EQ (btp->function, Qbytecode)
569 || btp->nargs == UNEVALLED))
570 btp = btp->next;
571
572 /* `btp' now points at the frame of the innermost function that isn't
573 a special form, ignoring frames for Finteractive_p and/or
574 Fbytecode at the top. If this frame is for a built-in function
575 (such as load or eval-region) return false. */
576 fun = Findirect_function (btp->function, Qnil);
577 if (SUBRP (fun))
578 return 0;
579
580 /* `btp' points to the frame of a Lisp function that called interactive-p.
581 Return t if that function was called interactively. */
582 if (btp && btp->next && EQ (btp->next->function, Qcall_interactively))
583 return 1;
584 return 0;
585}
586
587
588DEFUN ("defvaralias", Fdefvaralias, Sdefvaralias, 2, 3, 0, 491DEFUN ("defvaralias", Fdefvaralias, Sdefvaralias, 2, 3, 0,
589 doc: /* Make NEW-ALIAS a variable alias for symbol BASE-VARIABLE. 492 doc: /* Make NEW-ALIAS a variable alias for symbol BASE-VARIABLE.
590Aliased variables always have the same value; setting one sets the other. 493Aliased variables always have the same value; setting one sets the other.
@@ -696,8 +599,9 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
696 if (EQ ((--pdl)->symbol, sym) && !pdl->func 599 if (EQ ((--pdl)->symbol, sym) && !pdl->func
697 && EQ (pdl->old_value, Qunbound)) 600 && EQ (pdl->old_value, Qunbound))
698 { 601 {
699 message_with_string ("Warning: defvar ignored because %s is let-bound", 602 message_with_string
700 SYMBOL_NAME (sym), 1); 603 ("Warning: defvar ignored because %s is let-bound",
604 SYMBOL_NAME (sym), 1);
701 break; 605 break;
702 } 606 }
703 } 607 }
@@ -717,8 +621,8 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
717 /* A simple (defvar foo) with lexical scoping does "nothing" except 621 /* A simple (defvar foo) with lexical scoping does "nothing" except
718 declare that var to be dynamically scoped *locally* (i.e. within 622 declare that var to be dynamically scoped *locally* (i.e. within
719 the current file or let-block). */ 623 the current file or let-block). */
720 Vinternal_interpreter_environment = 624 Vinternal_interpreter_environment
721 Fcons (sym, Vinternal_interpreter_environment); 625 = Fcons (sym, Vinternal_interpreter_environment);
722 else 626 else
723 { 627 {
724 /* Simple (defvar <var>) should not count as a definition at all. 628 /* Simple (defvar <var>) should not count as a definition at all.
@@ -971,7 +875,7 @@ definitions to shadow the loaded ones for use in file byte-compilation. */)
971 if (NILP (tem)) 875 if (NILP (tem))
972 { 876 {
973 def = XSYMBOL (sym)->function; 877 def = XSYMBOL (sym)->function;
974 if (!EQ (def, Qunbound)) 878 if (!NILP (def))
975 continue; 879 continue;
976 } 880 }
977 break; 881 break;
@@ -986,7 +890,7 @@ definitions to shadow the loaded ones for use in file byte-compilation. */)
986 GCPRO1 (form); 890 GCPRO1 (form);
987 def = Fautoload_do_load (def, sym, Qmacro); 891 def = Fautoload_do_load (def, sym, Qmacro);
988 UNGCPRO; 892 UNGCPRO;
989 if (EQ (def, Qunbound) || !CONSP (def)) 893 if (!CONSP (def))
990 /* Not defined or definition not suitable. */ 894 /* Not defined or definition not suitable. */
991 break; 895 break;
992 if (!EQ (XCAR (def), Qmacro)) 896 if (!EQ (XCAR (def), Qmacro))
@@ -1811,12 +1715,12 @@ then strings and vectors are not accepted. */)
1811 1715
1812 fun = function; 1716 fun = function;
1813 1717
1814 fun = indirect_function (fun); /* Check cycles. */ 1718 fun = indirect_function (fun); /* Check cycles. */
1815 if (NILP (fun) || EQ (fun, Qunbound)) 1719 if (NILP (fun))
1816 return Qnil; 1720 return Qnil;
1817 1721
1818 /* Check an `interactive-form' property if present, analogous to the 1722 /* Check an `interactive-form' property if present, analogous to the
1819 function-documentation property. */ 1723 function-documentation property. */
1820 fun = function; 1724 fun = function;
1821 while (SYMBOLP (fun)) 1725 while (SYMBOLP (fun))
1822 { 1726 {
@@ -1876,7 +1780,7 @@ this does nothing and returns nil. */)
1876 CHECK_STRING (file); 1780 CHECK_STRING (file);
1877 1781
1878 /* If function is defined and not as an autoload, don't override. */ 1782 /* If function is defined and not as an autoload, don't override. */
1879 if (!EQ (XSYMBOL (function)->function, Qunbound) 1783 if (!NILP (XSYMBOL (function)->function)
1880 && !AUTOLOADP (XSYMBOL (function)->function)) 1784 && !AUTOLOADP (XSYMBOL (function)->function))
1881 return Qnil; 1785 return Qnil;
1882 1786
@@ -2055,7 +1959,7 @@ eval_sub (Lisp_Object form)
2055 1959
2056 /* Optimize for no indirection. */ 1960 /* Optimize for no indirection. */
2057 fun = original_fun; 1961 fun = original_fun;
2058 if (SYMBOLP (fun) && !EQ (fun, Qunbound) 1962 if (SYMBOLP (fun) && !NILP (fun)
2059 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) 1963 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2060 fun = indirect_function (fun); 1964 fun = indirect_function (fun);
2061 1965
@@ -2177,7 +2081,7 @@ eval_sub (Lisp_Object form)
2177 val = apply_lambda (fun, original_args); 2081 val = apply_lambda (fun, original_args);
2178 else 2082 else
2179 { 2083 {
2180 if (EQ (fun, Qunbound)) 2084 if (NILP (fun))
2181 xsignal1 (Qvoid_function, original_fun); 2085 xsignal1 (Qvoid_function, original_fun);
2182 if (!CONSP (fun)) 2086 if (!CONSP (fun))
2183 xsignal1 (Qinvalid_function, original_fun); 2087 xsignal1 (Qinvalid_function, original_fun);
@@ -2251,10 +2155,10 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2251 numargs += nargs - 2; 2155 numargs += nargs - 2;
2252 2156
2253 /* Optimize for no indirection. */ 2157 /* Optimize for no indirection. */
2254 if (SYMBOLP (fun) && !EQ (fun, Qunbound) 2158 if (SYMBOLP (fun) && !NILP (fun)
2255 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) 2159 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2256 fun = indirect_function (fun); 2160 fun = indirect_function (fun);
2257 if (EQ (fun, Qunbound)) 2161 if (NILP (fun))
2258 { 2162 {
2259 /* Let funcall get the error. */ 2163 /* Let funcall get the error. */
2260 fun = args[0]; 2164 fun = args[0];
@@ -2728,7 +2632,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2728 2632
2729 /* Optimize for no indirection. */ 2633 /* Optimize for no indirection. */
2730 fun = original_fun; 2634 fun = original_fun;
2731 if (SYMBOLP (fun) && !EQ (fun, Qunbound) 2635 if (SYMBOLP (fun) && !NILP (fun)
2732 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) 2636 && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
2733 fun = indirect_function (fun); 2637 fun = indirect_function (fun);
2734 2638
@@ -2816,7 +2720,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2816 val = funcall_lambda (fun, numargs, args + 1); 2720 val = funcall_lambda (fun, numargs, args + 1);
2817 else 2721 else
2818 { 2722 {
2819 if (EQ (fun, Qunbound)) 2723 if (NILP (fun))
2820 xsignal1 (Qvoid_function, original_fun); 2724 xsignal1 (Qvoid_function, original_fun);
2821 if (!CONSP (fun)) 2725 if (!CONSP (fun))
2822 xsignal1 (Qinvalid_function, original_fun); 2726 xsignal1 (Qinvalid_function, original_fun);
@@ -3551,8 +3455,6 @@ alist of active lexical bindings. */);
3551 defsubr (&Sunwind_protect); 3455 defsubr (&Sunwind_protect);
3552 defsubr (&Scondition_case); 3456 defsubr (&Scondition_case);
3553 defsubr (&Ssignal); 3457 defsubr (&Ssignal);
3554 defsubr (&Sinteractive_p);
3555 defsubr (&Scalled_interactively_p);
3556 defsubr (&Scommandp); 3458 defsubr (&Scommandp);
3557 defsubr (&Sautoload); 3459 defsubr (&Sautoload);
3558 defsubr (&Sautoload_do_load); 3460 defsubr (&Sautoload_do_load);
diff --git a/src/fileio.c b/src/fileio.c
index 572f6d8ef83..442c66550d3 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. */)
315 register const char *beg; 315 register const char *beg;
316#else 316#else
317 register char *beg; 317 register char *beg;
318 Lisp_Object tem_fn;
318#endif 319#endif
319 register const char *p; 320 register const char *p;
320 Lisp_Object handler; 321 Lisp_Object handler;
@@ -374,10 +375,13 @@ Given a Unix syntax file name, returns a string ending in slash. */)
374 p = beg + strlen (beg); 375 p = beg + strlen (beg);
375 } 376 }
376 } 377 }
377 dostounix_filename (beg); 378 tem_fn = ENCODE_FILE (make_specified_string (beg, -1, p - beg,
378#endif /* DOS_NT */ 379 STRING_MULTIBYTE (filename)));
379 380 dostounix_filename (SSDATA (tem_fn));
381 return DECODE_FILE (tem_fn);
382#else /* DOS_NT */
380 return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename)); 383 return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename));
384#endif /* DOS_NT */
381} 385}
382 386
383DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, 387DEFUN ("file-name-nondirectory", Ffile_name_nondirectory,
@@ -951,7 +955,18 @@ filesystem tree, not (expand-file-name ".." dirname). */)
951#ifdef DOS_NT 955#ifdef DOS_NT
952 /* Make sure directories are all separated with /, but 956 /* Make sure directories are all separated with /, but
953 avoid allocation of a new string when not required. */ 957 avoid allocation of a new string when not required. */
954 dostounix_filename (nm); 958 if (multibyte)
959 {
960 Lisp_Object tem_name = make_specified_string (nm, -1, strlen (nm),
961 multibyte);
962
963 tem_name = ENCODE_FILE (tem_name);
964 dostounix_filename (SSDATA (tem_name));
965 tem_name = DECODE_FILE (tem_name);
966 memcpy (nm, SSDATA (tem_name), SBYTES (tem_name) + 1);
967 }
968 else
969 dostounix_filename (nm);
955#ifdef WINDOWSNT 970#ifdef WINDOWSNT
956 if (IS_DIRECTORY_SEP (nm[1])) 971 if (IS_DIRECTORY_SEP (nm[1]))
957 { 972 {
@@ -1133,7 +1148,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1133 newdir = "/"; 1148 newdir = "/";
1134 } 1149 }
1135 else 1150 else
1136 getwd (adir); 1151 getcwd (adir, MAXPATHLEN + 1);
1137 newdir = adir; 1152 newdir = adir;
1138 } 1153 }
1139 1154
@@ -1305,10 +1320,13 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1305 target[0] = '/'; 1320 target[0] = '/';
1306 target[1] = ':'; 1321 target[1] = ':';
1307 } 1322 }
1308 dostounix_filename (target);
1309#endif /* DOS_NT */
1310
1311 result = make_specified_string (target, -1, o - target, multibyte); 1323 result = make_specified_string (target, -1, o - target, multibyte);
1324 result = ENCODE_FILE (result);
1325 dostounix_filename (SSDATA (result));
1326 result = DECODE_FILE (result);
1327#else /* !DOS_NT */
1328 result = make_specified_string (target, -1, o - target, multibyte);
1329#endif /* !DOS_NT */
1312 } 1330 }
1313 1331
1314 /* Again look to see if the file name has special constructs in it 1332 /* Again look to see if the file name has special constructs in it
@@ -1587,8 +1605,18 @@ those `/' is discarded. */)
1587 memcpy (nm, SDATA (filename), SBYTES (filename) + 1); 1605 memcpy (nm, SDATA (filename), SBYTES (filename) + 1);
1588 1606
1589#ifdef DOS_NT 1607#ifdef DOS_NT
1590 dostounix_filename (nm); 1608 {
1591 substituted = (strcmp (nm, SDATA (filename)) != 0); 1609 Lisp_Object encoded_filename = ENCODE_FILE (filename);
1610 Lisp_Object tem_fn;
1611
1612 dostounix_filename (SDATA (encoded_filename));
1613 tem_fn = DECODE_FILE (encoded_filename);
1614 nm = alloca (SBYTES (tem_fn) + 1);
1615 memcpy (nm, SDATA (tem_fn), SBYTES (tem_fn) + 1);
1616 substituted = (memcmp (nm, SDATA (filename), SBYTES (filename)) != 0);
1617 if (substituted)
1618 filename = tem_fn;
1619 }
1592#endif 1620#endif
1593 endp = nm + SBYTES (filename); 1621 endp = nm + SBYTES (filename);
1594 1622
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;
933 && (frame_var = XCAR (list_var), 1)); \ 933 && (frame_var = XCAR (list_var), 1)); \
934 list_var = XCDR (list_var)) 934 list_var = XCDR (list_var))
935 935
936/* Reflect mouse movement when a complete frame update is performed. */
937
938#define FRAME_MOUSE_UPDATE(frame) \
939 do { \
940 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (frame); \
941 if (frame == hlinfo->mouse_face_mouse_frame) \
942 { \
943 block_input (); \
944 if (hlinfo->mouse_face_mouse_frame) \
945 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
946 hlinfo->mouse_face_mouse_x, \
947 hlinfo->mouse_face_mouse_y); \
948 unblock_input (); \
949 } \
950 } while (0)
936 951
937extern Lisp_Object Qframep, Qframe_live_p; 952extern Lisp_Object Qframep, Qframe_live_p;
938extern Lisp_Object Qtty, Qtty_type; 953extern Lisp_Object Qtty, Qtty_type;
diff --git a/src/lisp.h b/src/lisp.h
index 67ae28a488f..419176d06c8 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1104,7 +1104,7 @@ struct Lisp_Symbol
1104 union Lisp_Fwd *fwd; 1104 union Lisp_Fwd *fwd;
1105 } val; 1105 } val;
1106 1106
1107 /* Function value of the symbol or Qunbound if not fboundp. */ 1107 /* Function value of the symbol or Qnil if not fboundp. */
1108 Lisp_Object function; 1108 Lisp_Object function;
1109 1109
1110 /* The symbol's property list. */ 1110 /* The symbol's property list. */
@@ -1649,10 +1649,6 @@ typedef struct {
1649 int mouse_face_face_id; 1649 int mouse_face_face_id;
1650 Lisp_Object mouse_face_overlay; 1650 Lisp_Object mouse_face_overlay;
1651 1651
1652 /* 1 if a mouse motion event came and we didn't handle it right away because
1653 gc was in progress. */
1654 int mouse_face_deferred_gc;
1655
1656 /* FRAME and X, Y position of mouse when last checked for 1652 /* FRAME and X, Y position of mouse when last checked for
1657 highlighting. X and Y can be negative or out of range for the frame. */ 1653 highlighting. X and Y can be negative or out of range for the frame. */
1658 struct frame *mouse_face_mouse_frame; 1654 struct frame *mouse_face_mouse_frame;
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)
3957 /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil, 3957 /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil,
3958 so those two need to be fixed manually. */ 3958 so those two need to be fixed manually. */
3959 SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound); 3959 SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound);
3960 set_symbol_function (Qunbound, Qunbound); 3960 set_symbol_function (Qunbound, Qnil);
3961 set_symbol_plist (Qunbound, Qnil); 3961 set_symbol_plist (Qunbound, Qnil);
3962 SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil); 3962 SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil);
3963 XSYMBOL (Qnil)->constant = 1; 3963 XSYMBOL (Qnil)->constant = 1;
3964 XSYMBOL (Qnil)->declared_special = 1; 3964 XSYMBOL (Qnil)->declared_special = 1;
3965 set_symbol_plist (Qnil, Qnil); 3965 set_symbol_plist (Qnil, Qnil);
3966 set_symbol_function (Qnil, Qnil);
3966 3967
3967 Qt = intern_c_string ("t"); 3968 Qt = intern_c_string ("t");
3968 SET_SYMBOL_VAL (XSYMBOL (Qt), Qt); 3969 SET_SYMBOL_VAL (XSYMBOL (Qt), Qt);
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 9778e955677..a296f6eb393 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -229,12 +229,12 @@ SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
229obj = $(GLOBAL_SOURCES:.c=.o) 229obj = $(GLOBAL_SOURCES:.c=.o)
230 230
231globals.h: gl-stamp 231globals.h: gl-stamp
232 @cmd /c rem true 232 @cmd $(SWITCHCHAR)c rem true
233 233
234gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES) 234gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES)
235 - $(DEL) gl-tmp 235 - $(DEL) gl-tmp
236 "$(THISDIR)/../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp 236 "$(THISDIR)/../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
237 cmd /c "fc /b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h" 237 fc.exe $(SWITCHCHAR)b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h
238 - $(DEL) gl-tmp 238 - $(DEL) gl-tmp
239 echo timestamp > $@ 239 echo timestamp > $@
240 240
@@ -413,8 +413,6 @@ CONF_POST_H = $(SRC)/conf_post.h \
413 $(MS_W32_H) 413 $(MS_W32_H)
414CONFIG_H = $(SRC)/config.h \ 414CONFIG_H = $(SRC)/config.h \
415 $(CONF_POST_H) 415 $(CONF_POST_H)
416DIR_H = $(NT_INC)/sys/dir.h \
417 $(SRC)/ndir.h
418W32GUI_H = $(SRC)/w32gui.h \ 416W32GUI_H = $(SRC)/w32gui.h \
419 $(SYSTIME_H) 417 $(SYSTIME_H)
420DISPEXTERN_H = $(SRC)/dispextern.h \ 418DISPEXTERN_H = $(SRC)/dispextern.h \
@@ -714,6 +712,7 @@ $(BLD)/dired.$(O) : \
714 $(SRC)/blockinput.h \ 712 $(SRC)/blockinput.h \
715 $(SRC)/commands.h \ 713 $(SRC)/commands.h \
716 $(SRC)/regex.h \ 714 $(SRC)/regex.h \
715 $(NT_INC)/dirent.h \
717 $(NT_INC)/pwd.h \ 716 $(NT_INC)/pwd.h \
718 $(NT_INC)/sys/stat.h \ 717 $(NT_INC)/sys/stat.h \
719 $(NT_INC)/unistd.h \ 718 $(NT_INC)/unistd.h \
@@ -722,7 +721,6 @@ $(BLD)/dired.$(O) : \
722 $(CHARSET_H) \ 721 $(CHARSET_H) \
723 $(CODING_H) \ 722 $(CODING_H) \
724 $(CONFIG_H) \ 723 $(CONFIG_H) \
725 $(DIR_H) \
726 $(FILEMODE_H) \ 724 $(FILEMODE_H) \
727 $(GRP_H) \ 725 $(GRP_H) \
728 $(LISP_H) \ 726 $(LISP_H) \
@@ -1175,11 +1173,11 @@ $(BLD)/minibuf.$(O) : \
1175 1173
1176$(BLD)/w32.$(O) : \ 1174$(BLD)/w32.$(O) : \
1177 $(SRC)/w32.c \ 1175 $(SRC)/w32.c \
1178 $(SRC)/ndir.h \
1179 $(SRC)/w32.h \ 1176 $(SRC)/w32.h \
1180 $(SRC)/w32common.h \ 1177 $(SRC)/w32common.h \
1181 $(SRC)/w32heap.h \ 1178 $(SRC)/w32heap.h \
1182 $(SRC)/w32select.h \ 1179 $(SRC)/w32select.h \
1180 $(NT_INC)/dirent.h \
1183 $(NT_INC)/pwd.h \ 1181 $(NT_INC)/pwd.h \
1184 $(NT_INC)/sys/file.h \ 1182 $(NT_INC)/sys/file.h \
1185 $(NT_INC)/sys/time.h \ 1183 $(NT_INC)/sys/time.h \
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)
1275 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 1275 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
1276 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; 1276 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
1277 hlinfo->mouse_face_window = Qnil; 1277 hlinfo->mouse_face_window = Qnil;
1278 hlinfo->mouse_face_deferred_gc = 0;
1279 hlinfo->mouse_face_mouse_frame = NULL; 1278 hlinfo->mouse_face_mouse_frame = NULL;
1280 } 1279 }
1281 1280
@@ -1295,21 +1294,10 @@ IT_update_end (struct frame *f)
1295static void 1294static void
1296IT_frame_up_to_date (struct frame *f) 1295IT_frame_up_to_date (struct frame *f)
1297{ 1296{
1298 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
1299 Lisp_Object new_cursor, frame_desired_cursor; 1297 Lisp_Object new_cursor, frame_desired_cursor;
1300 struct window *sw; 1298 struct window *sw;
1301 1299
1302 if (hlinfo->mouse_face_deferred_gc 1300 FRAME_MOUSE_UPDATE (f);
1303 || (f && f == hlinfo->mouse_face_mouse_frame))
1304 {
1305 block_input ();
1306 if (hlinfo->mouse_face_mouse_frame)
1307 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1308 hlinfo->mouse_face_mouse_x,
1309 hlinfo->mouse_face_mouse_y);
1310 hlinfo->mouse_face_deferred_gc = 0;
1311 unblock_input ();
1312 }
1313 1301
1314 /* Set the cursor type to whatever they wanted. In a minibuffer 1302 /* Set the cursor type to whatever they wanted. In a minibuffer
1315 window, we want the cursor to appear only if we are reading input 1303 window, we want the cursor to appear only if we are reading input
@@ -1849,7 +1837,6 @@ internal_terminal_init (void)
1849 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1]; 1837 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1];
1850 } 1838 }
1851 the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL; 1839 the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL;
1852 the_only_display_info.mouse_highlight.mouse_face_deferred_gc = 0;
1853 the_only_display_info.mouse_highlight.mouse_face_beg_row = 1840 the_only_display_info.mouse_highlight.mouse_face_beg_row =
1854 the_only_display_info.mouse_highlight.mouse_face_beg_col = -1; 1841 the_only_display_info.mouse_highlight.mouse_face_beg_col = -1;
1855 the_only_display_info.mouse_highlight.mouse_face_end_row = 1842 the_only_display_info.mouse_highlight.mouse_face_end_row =
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 @@
1/*
2 <dir.h> -- definitions for 4.2BSD-compatible directory access
3
4 last edit: 09-Jul-1983 D A Gwyn
5
6 * The code here is forced by the interface, and is not subject to
7 * copyright, constituting the only possible expression of the
8 * algorithm in this format.
9 */
10
11#define DIRBLKSIZ 512 /* size of directory block */
12#ifdef WINDOWSNT
13#define MAXNAMLEN 255
14#else /* not WINDOWSNT */
15#define MAXNAMLEN 15 /* maximum filename length */
16#endif /* not WINDOWSNT */
17 /* NOTE: MAXNAMLEN must be one less than a multiple of 4 */
18
19struct direct /* data from readdir() */
20 {
21 long d_ino; /* inode number of entry */
22 unsigned short d_reclen; /* length of this record */
23 unsigned short d_namlen; /* length of string in d_name */
24 char d_name[MAXNAMLEN+1]; /* name of file */
25 };
26
27typedef struct
28 {
29 int dd_fd; /* file descriptor */
30 int dd_loc; /* offset in block */
31 int dd_size; /* amount of valid data */
32 char dd_buf[DIRBLKSIZ]; /* directory block */
33 } DIR; /* stream data from opendir() */
34
35extern DIR *opendir (char *);
36extern struct direct *readdir (DIR *);
37extern void seekdir (DIR *, long);
38extern void closedir (DIR *);
39
40#define rewinddir( dirp ) seekdir( dirp, 0L )
41
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)
1186 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 1186 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
1187 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; 1187 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
1188 hlinfo->mouse_face_window = Qnil; 1188 hlinfo->mouse_face_window = Qnil;
1189 hlinfo->mouse_face_deferred_gc = 0;
1190 hlinfo->mouse_face_mouse_frame = 0; 1189 hlinfo->mouse_face_mouse_frame = 0;
1191 } 1190 }
1192 1191
@@ -1887,8 +1886,7 @@ static void
1887ns_frame_up_to_date (struct frame *f) 1886ns_frame_up_to_date (struct frame *f)
1888/* -------------------------------------------------------------------------- 1887/* --------------------------------------------------------------------------
1889 External (hook): Fix up mouse highlighting right after a full update. 1888 External (hook): Fix up mouse highlighting right after a full update.
1890 Some highlighting was deferred if GC was happening during 1889 Can't use FRAME_MOUSE_UPDATE due to ns_frame_begin and ns_frame_end calls.
1891 note_mouse_highlight (), while other highlighting was deferred for update.
1892 -------------------------------------------------------------------------- */ 1890 -------------------------------------------------------------------------- */
1893{ 1891{
1894 NSTRACE (ns_frame_up_to_date); 1892 NSTRACE (ns_frame_up_to_date);
@@ -1896,19 +1894,17 @@ ns_frame_up_to_date (struct frame *f)
1896 if (FRAME_NS_P (f)) 1894 if (FRAME_NS_P (f))
1897 { 1895 {
1898 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 1896 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
1899 if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame) 1897 if (f == hlinfo->mouse_face_mouse_frame)
1900 /*&& hlinfo->mouse_face_mouse_frame*/) 1898 {
1901 { 1899 block_input ();
1902 block_input ();
1903 ns_update_begin(f); 1900 ns_update_begin(f);
1904 if (hlinfo->mouse_face_mouse_frame) 1901 if (hlinfo->mouse_face_mouse_frame)
1905 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, 1902 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1906 hlinfo->mouse_face_mouse_x, 1903 hlinfo->mouse_face_mouse_x,
1907 hlinfo->mouse_face_mouse_y); 1904 hlinfo->mouse_face_mouse_y);
1908 hlinfo->mouse_face_deferred_gc = 0;
1909 ns_update_end(f); 1905 ns_update_end(f);
1910 unblock_input (); 1906 unblock_input ();
1911 } 1907 }
1912 } 1908 }
1913} 1909}
1914 1910
@@ -3869,7 +3865,6 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo)
3869 dpyinfo->root_window = 42; /* a placeholder.. */ 3865 dpyinfo->root_window = 42; /* a placeholder.. */
3870 3866
3871 hlinfo->mouse_face_mouse_frame = NULL; 3867 hlinfo->mouse_face_mouse_frame = NULL;
3872 hlinfo->mouse_face_deferred_gc = 0;
3873 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 3868 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
3874 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; 3869 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
3875 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; 3870 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
diff --git a/src/sysdep.c b/src/sysdep.c
index 7c5c144fa8c..bc4dc91509f 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -101,7 +101,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
101#define _P_WAIT 0 101#define _P_WAIT 0
102int _cdecl _spawnlp (int, const char *, const char *, ...); 102int _cdecl _spawnlp (int, const char *, const char *, ...);
103int _cdecl _getpid (void); 103int _cdecl _getpid (void);
104extern char *getwd (char *);
105#endif 104#endif
106 105
107#include "syssignal.h" 106#include "syssignal.h"
@@ -134,12 +133,12 @@ char*
134get_current_dir_name (void) 133get_current_dir_name (void)
135{ 134{
136 char *buf; 135 char *buf;
137 char *pwd; 136 char *pwd = getenv ("PWD");
138 struct stat dotstat, pwdstat; 137 struct stat dotstat, pwdstat;
139 /* If PWD is accurate, use it instead of calling getwd. PWD is 138 /* If PWD is accurate, use it instead of calling getcwd. PWD is
140 sometimes a nicer name, and using it may avoid a fatal error if a 139 sometimes a nicer name, and using it may avoid a fatal error if a
141 parent directory is searchable but not readable. */ 140 parent directory is searchable but not readable. */
142 if ((pwd = getenv ("PWD")) != 0 141 if (pwd
143 && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1]))) 142 && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1])))
144 && stat (pwd, &pwdstat) == 0 143 && stat (pwd, &pwdstat) == 0
145 && stat (".", &dotstat) == 0 144 && stat (".", &dotstat) == 0
@@ -155,7 +154,6 @@ get_current_dir_name (void)
155 return NULL; 154 return NULL;
156 strcpy (buf, pwd); 155 strcpy (buf, pwd);
157 } 156 }
158#ifdef HAVE_GETCWD
159 else 157 else
160 { 158 {
161 size_t buf_size = 1024; 159 size_t buf_size = 1024;
@@ -179,22 +177,6 @@ get_current_dir_name (void)
179 return NULL; 177 return NULL;
180 } 178 }
181 } 179 }
182#else
183 else
184 {
185 /* We need MAXPATHLEN here. */
186 buf = malloc (MAXPATHLEN + 1);
187 if (!buf)
188 return NULL;
189 if (getwd (buf) == NULL)
190 {
191 int tmp_errno = errno;
192 free (buf);
193 errno = tmp_errno;
194 return NULL;
195 }
196 }
197#endif
198 return buf; 180 return buf;
199} 181}
200#endif 182#endif
@@ -521,7 +503,7 @@ sys_subshell (void)
521 const char *sh = 0; 503 const char *sh = 0;
522 504
523#ifdef DOS_NT /* MW, Aug 1993 */ 505#ifdef DOS_NT /* MW, Aug 1993 */
524 getwd (oldwd); 506 getcwd (oldwd, sizeof oldwd);
525 if (sh == 0) 507 if (sh == 0)
526 sh = (char *) egetenv ("SUSPEND"); /* KFS, 1994-12-14 */ 508 sh = (char *) egetenv ("SUSPEND"); /* KFS, 1994-12-14 */
527#endif 509#endif
@@ -2238,82 +2220,6 @@ emacs_readlink (char const *filename, char initial_buf[READLINK_BUFSIZE])
2238 &emacs_norealloc_allocator, careadlinkatcwd); 2220 &emacs_norealloc_allocator, careadlinkatcwd);
2239} 2221}
2240 2222
2241#ifdef USG
2242/*
2243 * All of the following are for USG.
2244 *
2245 * On USG systems the system calls are INTERRUPTIBLE by signals
2246 * that the user program has elected to catch. Thus the system call
2247 * must be retried in these cases. To handle this without massive
2248 * changes in the source code, we remap the standard system call names
2249 * to names for our own functions in sysdep.c that do the system call
2250 * with retries. Actually, for portability reasons, it is good
2251 * programming practice, as this example shows, to limit all actual
2252 * system calls to a single occurrence in the source. Sure, this
2253 * adds an extra level of function call overhead but it is almost
2254 * always negligible. Fred Fish, Unisoft Systems Inc.
2255 */
2256
2257/*
2258 * Warning, this function may not duplicate 4.2 action properly
2259 * under error conditions.
2260 */
2261
2262#if !defined (HAVE_GETWD) || defined (BROKEN_GETWD)
2263
2264#ifndef MAXPATHLEN
2265/* In 4.1, param.h fails to define this. */
2266#define MAXPATHLEN 1024
2267#endif
2268
2269char *
2270getwd (char *pathname)
2271{
2272 char *npath, *spath;
2273 extern char *getcwd (char *, size_t);
2274
2275 block_input (); /* getcwd uses malloc */
2276 spath = npath = getcwd ((char *) 0, MAXPATHLEN);
2277 if (spath == 0)
2278 {
2279 unblock_input ();
2280 return spath;
2281 }
2282 /* On Altos 3068, getcwd can return @hostname/dir, so discard
2283 up to first slash. Should be harmless on other systems. */
2284 while (*npath && *npath != '/')
2285 npath++;
2286 strcpy (pathname, npath);
2287 free (spath); /* getcwd uses malloc */
2288 unblock_input ();
2289 return pathname;
2290}
2291
2292#endif /* !defined (HAVE_GETWD) || defined (BROKEN_GETWD) */
2293#endif /* USG */
2294
2295/* Directory routines for systems that don't have them. */
2296
2297#ifdef HAVE_DIRENT_H
2298
2299#include <dirent.h>
2300
2301#if !defined (HAVE_CLOSEDIR)
2302
2303int
2304closedir (DIR *dirp /* stream from opendir */)
2305{
2306 int rtnval;
2307
2308 rtnval = emacs_close (dirp->dd_fd);
2309 xfree (dirp);
2310
2311 return rtnval;
2312}
2313#endif /* not HAVE_CLOSEDIR */
2314#endif /* HAVE_DIRENT_H */
2315
2316
2317/* Return a struct timeval that is roughly equivalent to T. 2223/* Return a struct timeval that is roughly equivalent to T.
2318 Use the least timeval not less than T. 2224 Use the least timeval not less than T.
2319 Return an extremal value if the result would overflow. */ 2225 Return an extremal value if the result would overflow. */
diff --git a/src/w32.c b/src/w32.c
index 94cf472a4ae..c8e16dfaa94 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -119,9 +119,10 @@ typedef struct _PROCESS_MEMORY_COUNTERS_EX {
119#include <aclapi.h> 119#include <aclapi.h>
120 120
121#ifdef _MSC_VER 121#ifdef _MSC_VER
122/* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER, except 122/* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER and the
123 on ntifs.h, which cannot be included because it triggers conflicts 123 associated macros, except on ntifs.h, which cannot be included
124 with other Windows API headers. So we define it here by hand. */ 124 because it triggers conflicts with other Windows API headers. So
125 we define it here by hand. */
125 126
126typedef struct _REPARSE_DATA_BUFFER { 127typedef struct _REPARSE_DATA_BUFFER {
127 ULONG ReparseTag; 128 ULONG ReparseTag;
@@ -149,6 +150,12 @@ typedef struct _REPARSE_DATA_BUFFER {
149 } DUMMYUNIONNAME; 150 } DUMMYUNIONNAME;
150} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; 151} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
151 152
153#define FILE_DEVICE_FILE_SYSTEM 9
154#define METHOD_BUFFERED 0
155#define FILE_ANY_ACCESS 0x00000000
156#define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m))
157#define FSCTL_GET_REPARSE_POINT \
158 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
152#endif 159#endif
153 160
154/* TCP connection support. */ 161/* TCP connection support. */
@@ -172,7 +179,7 @@ typedef struct _REPARSE_DATA_BUFFER {
172#undef sendto 179#undef sendto
173 180
174#include "w32.h" 181#include "w32.h"
175#include "ndir.h" 182#include <dirent.h>
176#include "w32common.h" 183#include "w32common.h"
177#include "w32heap.h" 184#include "w32heap.h"
178#include "w32select.h" 185#include "w32select.h"
@@ -901,8 +908,18 @@ static char startup_dir[MAXPATHLEN];
901 908
902/* Get the current working directory. */ 909/* Get the current working directory. */
903char * 910char *
904getwd (char *dir) 911getcwd (char *dir, int dirsize)
905{ 912{
913 if (!dirsize)
914 {
915 errno = EINVAL;
916 return NULL;
917 }
918 if (dirsize <= strlen (startup_dir))
919 {
920 errno = ERANGE;
921 return NULL;
922 }
906#if 0 923#if 0
907 if (GetCurrentDirectory (MAXPATHLEN, dir) > 0) 924 if (GetCurrentDirectory (MAXPATHLEN, dir) > 0)
908 return dir; 925 return dir;
@@ -1818,7 +1835,7 @@ init_environment (char ** argv)
1818 memcpy (*envp, "COMSPEC=", 8); 1835 memcpy (*envp, "COMSPEC=", 8);
1819 } 1836 }
1820 1837
1821 /* Remember the initial working directory for getwd. */ 1838 /* Remember the initial working directory for getcwd. */
1822 /* FIXME: Do we need to resolve possible symlinks in startup_dir? 1839 /* FIXME: Do we need to resolve possible symlinks in startup_dir?
1823 Does it matter anywhere in Emacs? */ 1840 Does it matter anywhere in Emacs? */
1824 if (!GetCurrentDirectory (MAXPATHLEN, startup_dir)) 1841 if (!GetCurrentDirectory (MAXPATHLEN, startup_dir))
@@ -2431,7 +2448,7 @@ is_exec (const char * name)
2431 and readdir. We can't use the procedures supplied in sysdep.c, 2448 and readdir. We can't use the procedures supplied in sysdep.c,
2432 so we provide them here. */ 2449 so we provide them here. */
2433 2450
2434struct direct dir_static; /* simulated directory contents */ 2451struct dirent dir_static; /* simulated directory contents */
2435static HANDLE dir_find_handle = INVALID_HANDLE_VALUE; 2452static HANDLE dir_find_handle = INVALID_HANDLE_VALUE;
2436static int dir_is_fat; 2453static int dir_is_fat;
2437static char dir_pathname[MAXPATHLEN+1]; 2454static char dir_pathname[MAXPATHLEN+1];
@@ -2501,7 +2518,7 @@ closedir (DIR *dirp)
2501 xfree ((char *) dirp); 2518 xfree ((char *) dirp);
2502} 2519}
2503 2520
2504struct direct * 2521struct dirent *
2505readdir (DIR *dirp) 2522readdir (DIR *dirp)
2506{ 2523{
2507 int downcase = !NILP (Vw32_downcase_file_names); 2524 int downcase = !NILP (Vw32_downcase_file_names);
@@ -2555,7 +2572,7 @@ readdir (DIR *dirp)
2555 downcase = 1; /* 8+3 aliases are returned in all caps */ 2572 downcase = 1; /* 8+3 aliases are returned in all caps */
2556 } 2573 }
2557 dir_static.d_namlen = strlen (dir_static.d_name); 2574 dir_static.d_namlen = strlen (dir_static.d_name);
2558 dir_static.d_reclen = sizeof (struct direct) - MAXNAMLEN + 3 + 2575 dir_static.d_reclen = sizeof (struct dirent) - MAXNAMLEN + 3 +
2559 dir_static.d_namlen - dir_static.d_namlen % 4; 2576 dir_static.d_namlen - dir_static.d_namlen % 4;
2560 2577
2561 /* If the file name in cFileName[] includes `?' characters, it means 2578 /* If the file name in cFileName[] includes `?' characters, it means
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 **);
163extern void register_child (int, int); 163extern void register_child (int, int);
164 164
165extern void sys_sleep (int); 165extern void sys_sleep (int);
166extern char *getwd (char *);
167extern int sys_link (const char *, const char *); 166extern int sys_link (const char *, const char *);
168 167
169 168
@@ -181,4 +180,3 @@ extern ssize_t emacs_gnutls_push (gnutls_transport_ptr_t p,
181#endif /* HAVE_GNUTLS */ 180#endif /* HAVE_GNUTLS */
182 181
183#endif /* EMACS_W32_H */ 182#endif /* EMACS_W32_H */
184
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. */)
6167 filename = empty_unibyte_string; 6167 filename = empty_unibyte_string;
6168 6168
6169#ifdef CYGWIN 6169#ifdef CYGWIN
6170 dir = Fcygwin_convert_path_to_windows (dir, Qt); 6170 dir = Fcygwin_convert_file_name_to_windows (dir, Qt);
6171 if (SCHARS (filename) > 0) 6171 if (SCHARS (filename) > 0)
6172 filename = Fcygwin_convert_path_to_windows (filename, Qnil); 6172 filename = Fcygwin_convert_file_name_to_windows (filename, Qnil);
6173#endif 6173#endif
6174 6174
6175 CHECK_STRING (dir); 6175 CHECK_STRING (dir);
@@ -6270,7 +6270,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
6270#endif /* NTGUI_UNICODE */ 6270#endif /* NTGUI_UNICODE */
6271 6271
6272#ifdef CYGWIN 6272#ifdef CYGWIN
6273 filename = Fcygwin_convert_path_from_windows (filename, Qt); 6273 filename = Fcygwin_convert_file_name_from_windows (filename, Qt);
6274#endif /* CYGWIN */ 6274#endif /* CYGWIN */
6275 6275
6276 /* Strip the dummy filename off the end of the string if we 6276 /* Strip the dummy filename off the end of the string if we
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
723w32_frame_up_to_date (struct frame *f) 723w32_frame_up_to_date (struct frame *f)
724{ 724{
725 if (FRAME_W32_P (f)) 725 if (FRAME_W32_P (f))
726 { 726 FRAME_MOUSE_UPDATE (f);
727 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
728
729 if (hlinfo->mouse_face_deferred_gc
730 || f == hlinfo->mouse_face_mouse_frame)
731 {
732 block_input ();
733 if (hlinfo->mouse_face_mouse_frame)
734 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
735 hlinfo->mouse_face_mouse_x,
736 hlinfo->mouse_face_mouse_y);
737 hlinfo->mouse_face_deferred_gc = 0;
738 unblock_input ();
739 }
740 }
741} 727}
742 728
743 729
@@ -5979,7 +5965,6 @@ x_free_frame_resources (struct frame *f)
5979 hlinfo->mouse_face_end_row 5965 hlinfo->mouse_face_end_row
5980 = hlinfo->mouse_face_end_col = -1; 5966 = hlinfo->mouse_face_end_col = -1;
5981 hlinfo->mouse_face_window = Qnil; 5967 hlinfo->mouse_face_window = Qnil;
5982 hlinfo->mouse_face_deferred_gc = 0;
5983 hlinfo->mouse_face_mouse_frame = 0; 5968 hlinfo->mouse_face_mouse_frame = 0;
5984 } 5969 }
5985 5970
diff --git a/src/w32term.h b/src/w32term.h
index 83535b8faa3..ce709c1231d 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -751,7 +751,7 @@ extern int w32_system_caret_y;
751typedef BOOL (CALLBACK *LOCALE_ENUMPROCA)(LPSTR); 751typedef BOOL (CALLBACK *LOCALE_ENUMPROCA)(LPSTR);
752typedef BOOL (CALLBACK *LOCALE_ENUMPROCW)(LPWSTR); 752typedef BOOL (CALLBACK *LOCALE_ENUMPROCW)(LPWSTR);
753BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD); 753BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD);
754BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD) 754BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD);
755#ifdef UNICODE 755#ifdef UNICODE
756#define EnumSystemLocales EnumSystemLocalesW 756#define EnumSystemLocales EnumSystemLocalesW
757#else 757#else
diff --git a/src/xdisp.c b/src/xdisp.c
index 27d9fff0b7d..5d260d851ef 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -515,9 +515,8 @@ Lisp_Object Qmenu_bar_update_hook;
515 515
516static int overlay_arrow_seen; 516static int overlay_arrow_seen;
517 517
518/* Number of windows showing the buffer of the selected window (or 518/* Number of windows showing the buffer of the selected
519 another buffer with the same base buffer). keyboard.c refers to 519 window (or another buffer with the same base buffer). */
520 this. */
521 520
522int buffer_shared; 521int buffer_shared;
523 522
@@ -9643,7 +9642,7 @@ message2_nolog (const char *m, ptrdiff_t nbytes, int multibyte)
9643 do_pending_window_change (0); 9642 do_pending_window_change (0);
9644 echo_area_display (1); 9643 echo_area_display (1);
9645 do_pending_window_change (0); 9644 do_pending_window_change (0);
9646 if (FRAME_TERMINAL (f)->frame_up_to_date_hook != 0 && ! gc_in_progress) 9645 if (FRAME_TERMINAL (f)->frame_up_to_date_hook)
9647 (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f); 9646 (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f);
9648 } 9647 }
9649} 9648}
@@ -9740,7 +9739,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
9740 do_pending_window_change (0); 9739 do_pending_window_change (0);
9741 echo_area_display (1); 9740 echo_area_display (1);
9742 do_pending_window_change (0); 9741 do_pending_window_change (0);
9743 if (FRAME_TERMINAL (f)->frame_up_to_date_hook != 0 && ! gc_in_progress) 9742 if (FRAME_TERMINAL (f)->frame_up_to_date_hook)
9744 (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f); 9743 (*FRAME_TERMINAL (f)->frame_up_to_date_hook) (f);
9745 } 9744 }
9746} 9745}
@@ -10889,8 +10888,41 @@ echo_area_display (int update_frame_p)
10889 return window_height_changed_p; 10888 return window_height_changed_p;
10890} 10889}
10891 10890
10891/* Nonzero if the current buffer is shown in more than
10892 one window and was modified since last display. */
10893
10894static int
10895buffer_shared_and_changed (void)
10896{
10897 return (buffer_shared > 1 && UNCHANGED_MODIFIED < MODIFF);
10898}
10899
10900/* Nonzero if W doesn't reflect the actual state of
10901 current buffer due to its text or overlays change. */
10902
10903static int
10904window_outdated (struct window *w)
10905{
10906 eassert (XBUFFER (w->buffer) == current_buffer);
10907 return (w->last_modified < MODIFF
10908 || w->last_overlay_modified < OVERLAY_MODIFF);
10909}
10910
10911/* Nonzero if W's buffer was changed but not saved or Transient Mark mode
10912 is enabled and mark of W's buffer was changed since last W's update. */
10913
10914static int
10915window_buffer_changed (struct window *w)
10916{
10917 struct buffer *b = XBUFFER (w->buffer);
10918
10919 eassert (BUFFER_LIVE_P (b));
10920
10921 return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star)
10922 || ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (b, mark_active)))
10923 != !NILP (w->region_showing)));
10924}
10892 10925
10893
10894/*********************************************************************** 10926/***********************************************************************
10895 Mode Lines and Frame Titles 10927 Mode Lines and Frame Titles
10896 ***********************************************************************/ 10928 ***********************************************************************/
@@ -11196,7 +11228,7 @@ prepare_menu_bars (void)
11196 /* Update the menu bar item lists, if appropriate. This has to be 11228 /* Update the menu bar item lists, if appropriate. This has to be
11197 done before any actual redisplay or generation of display lines. */ 11229 done before any actual redisplay or generation of display lines. */
11198 all_windows = (update_mode_lines 11230 all_windows = (update_mode_lines
11199 || buffer_shared > 1 11231 || buffer_shared_and_changed ()
11200 || windows_or_buffers_changed); 11232 || windows_or_buffers_changed);
11201 if (all_windows) 11233 if (all_windows)
11202 { 11234 {
@@ -11310,12 +11342,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
11310 /* This used to test w->update_mode_line, but we believe 11342 /* This used to test w->update_mode_line, but we believe
11311 there is no need to recompute the menu in that case. */ 11343 there is no need to recompute the menu in that case. */
11312 || update_mode_lines 11344 || update_mode_lines
11313 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) 11345 || window_buffer_changed (w))
11314 < BUF_MODIFF (XBUFFER (w->buffer)))
11315 != w->last_had_star)
11316 || ((!NILP (Vtransient_mark_mode)
11317 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
11318 != !NILP (w->region_showing)))
11319 { 11346 {
11320 struct buffer *prev = current_buffer; 11347 struct buffer *prev = current_buffer;
11321 ptrdiff_t count = SPECPDL_INDEX (); 11348 ptrdiff_t count = SPECPDL_INDEX ();
@@ -11467,11 +11494,18 @@ FRAME_PTR last_mouse_frame;
11467 11494
11468int last_tool_bar_item; 11495int last_tool_bar_item;
11469 11496
11470 11497/* Select `frame' temporarily without running all the code in
11498 do_switch_frame.
11499 FIXME: Maybe do_switch_frame should be trimmed down similarly
11500 when `norecord' is set. */
11471static Lisp_Object 11501static Lisp_Object
11472update_tool_bar_unwind (Lisp_Object frame) 11502fast_set_selected_frame (Lisp_Object frame)
11473{ 11503{
11474 selected_frame = frame; 11504 if (!EQ (selected_frame, frame))
11505 {
11506 selected_frame = frame;
11507 selected_window = XFRAME (frame)->selected_window;
11508 }
11475 return Qnil; 11509 return Qnil;
11476} 11510}
11477 11511
@@ -11508,12 +11542,7 @@ update_tool_bar (struct frame *f, int save_match_data)
11508 if (windows_or_buffers_changed 11542 if (windows_or_buffers_changed
11509 || w->update_mode_line 11543 || w->update_mode_line
11510 || update_mode_lines 11544 || update_mode_lines
11511 || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) 11545 || window_buffer_changed (w))
11512 < BUF_MODIFF (XBUFFER (w->buffer)))
11513 != w->last_had_star)
11514 || ((!NILP (Vtransient_mark_mode)
11515 && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
11516 != !NILP (w->region_showing)))
11517 { 11546 {
11518 struct buffer *prev = current_buffer; 11547 struct buffer *prev = current_buffer;
11519 ptrdiff_t count = SPECPDL_INDEX (); 11548 ptrdiff_t count = SPECPDL_INDEX ();
@@ -11543,9 +11572,13 @@ update_tool_bar (struct frame *f, int save_match_data)
11543 before calling tool_bar_items, because the calculation of 11572 before calling tool_bar_items, because the calculation of
11544 the tool-bar keymap uses the selected frame (see 11573 the tool-bar keymap uses the selected frame (see
11545 `tool-bar-make-keymap' in tool-bar.el). */ 11574 `tool-bar-make-keymap' in tool-bar.el). */
11546 record_unwind_protect (update_tool_bar_unwind, selected_frame); 11575 eassert (EQ (selected_window,
11576 /* Since we only explicitly preserve selected_frame,
11577 check that selected_window would be redundant. */
11578 XFRAME (selected_frame)->selected_window));
11579 record_unwind_protect (fast_set_selected_frame, selected_frame);
11547 XSETFRAME (frame, f); 11580 XSETFRAME (frame, f);
11548 selected_frame = frame; 11581 fast_set_selected_frame (frame);
11549 11582
11550 /* Build desired tool-bar items from keymaps. */ 11583 /* Build desired tool-bar items from keymaps. */
11551 new_tool_bar 11584 new_tool_bar
@@ -12616,8 +12649,7 @@ text_outside_line_unchanged_p (struct window *w,
12616 int unchanged_p = 1; 12649 int unchanged_p = 1;
12617 12650
12618 /* If text or overlays have changed, see where. */ 12651 /* If text or overlays have changed, see where. */
12619 if (w->last_modified < MODIFF 12652 if (window_outdated (w))
12620 || w->last_overlay_modified < OVERLAY_MODIFF)
12621 { 12653 {
12622 /* Gap in the line? */ 12654 /* Gap in the line? */
12623 if (GPT < start || Z - GPT < end) 12655 if (GPT < start || Z - GPT < end)
@@ -12961,7 +12993,7 @@ redisplay_internal (void)
12961 ptrdiff_t count, count1; 12993 ptrdiff_t count, count1;
12962 struct frame *sf; 12994 struct frame *sf;
12963 int polling_stopped_here = 0; 12995 int polling_stopped_here = 0;
12964 Lisp_Object old_frame = selected_frame; 12996 Lisp_Object tail, frame, old_frame = selected_frame;
12965 struct backtrace backtrace; 12997 struct backtrace backtrace;
12966 12998
12967 /* Non-zero means redisplay has to consider all windows on all 12999 /* Non-zero means redisplay has to consider all windows on all
@@ -13013,15 +13045,8 @@ redisplay_internal (void)
13013 backtrace.debug_on_exit = 0; 13045 backtrace.debug_on_exit = 0;
13014 backtrace_list = &backtrace; 13046 backtrace_list = &backtrace;
13015 13047
13016 { 13048 FOR_EACH_FRAME (tail, frame)
13017 Lisp_Object tail, frame; 13049 XFRAME (frame)->already_hscrolled_p = 0;
13018
13019 FOR_EACH_FRAME (tail, frame)
13020 {
13021 struct frame *f = XFRAME (frame);
13022 f->already_hscrolled_p = 0;
13023 }
13024 }
13025 13050
13026 retry: 13051 retry:
13027 /* Remember the currently selected window. */ 13052 /* Remember the currently selected window. */
@@ -13071,25 +13096,20 @@ redisplay_internal (void)
13071 FRAME_TTY (sf)->previous_frame = sf; 13096 FRAME_TTY (sf)->previous_frame = sf;
13072 } 13097 }
13073 13098
13074 /* Set the visible flags for all frames. Do this before checking 13099 /* Set the visible flags for all frames. Do this before checking for
13075 for resized or garbaged frames; they want to know if their frames 13100 resized or garbaged frames; they want to know if their frames are
13076 are visible. See the comment in frame.h for 13101 visible. See the comment in frame.h for FRAME_SAMPLE_VISIBILITY. */
13077 FRAME_SAMPLE_VISIBILITY. */ 13102 number_of_visible_frames = 0;
13078 {
13079 Lisp_Object tail, frame;
13080 13103
13081 number_of_visible_frames = 0; 13104 FOR_EACH_FRAME (tail, frame)
13082 13105 {
13083 FOR_EACH_FRAME (tail, frame) 13106 struct frame *f = XFRAME (frame);
13084 {
13085 struct frame *f = XFRAME (frame);
13086 13107
13087 FRAME_SAMPLE_VISIBILITY (f); 13108 FRAME_SAMPLE_VISIBILITY (f);
13088 if (FRAME_VISIBLE_P (f)) 13109 if (FRAME_VISIBLE_P (f))
13089 ++number_of_visible_frames; 13110 ++number_of_visible_frames;
13090 clear_desired_matrices (f); 13111 clear_desired_matrices (f);
13091 } 13112 }
13092 }
13093 13113
13094 /* Notice any pending interrupt request to change frame size. */ 13114 /* Notice any pending interrupt request to change frame size. */
13095 do_pending_window_change (1); 13115 do_pending_window_change (1);
@@ -13116,7 +13136,7 @@ redisplay_internal (void)
13116 if ((SAVE_MODIFF < MODIFF) != w->last_had_star) 13136 if ((SAVE_MODIFF < MODIFF) != w->last_had_star)
13117 { 13137 {
13118 w->update_mode_line = 1; 13138 w->update_mode_line = 1;
13119 if (buffer_shared > 1) 13139 if (buffer_shared_and_changed ())
13120 update_mode_lines++; 13140 update_mode_lines++;
13121 } 13141 }
13122 13142
@@ -13128,9 +13148,7 @@ redisplay_internal (void)
13128 if (!NILP (w->column_number_displayed) 13148 if (!NILP (w->column_number_displayed)
13129 /* This alternative quickly identifies a common case 13149 /* This alternative quickly identifies a common case
13130 where no change is needed. */ 13150 where no change is needed. */
13131 && !(PT == w->last_point 13151 && !(PT == w->last_point && !window_outdated (w))
13132 && w->last_modified >= MODIFF
13133 && w->last_overlay_modified >= OVERLAY_MODIFF)
13134 && (XFASTINT (w->column_number_displayed) != current_column ())) 13152 && (XFASTINT (w->column_number_displayed) != current_column ()))
13135 w->update_mode_line = 1; 13153 w->update_mode_line = 1;
13136 13154
@@ -13141,7 +13159,8 @@ redisplay_internal (void)
13141 /* The variable buffer_shared is set in redisplay_window and 13159 /* The variable buffer_shared is set in redisplay_window and
13142 indicates that we redisplay a buffer in different windows. See 13160 indicates that we redisplay a buffer in different windows. See
13143 there. */ 13161 there. */
13144 consider_all_windows_p = (update_mode_lines || buffer_shared > 1 13162 consider_all_windows_p = (update_mode_lines
13163 || buffer_shared_and_changed ()
13145 || cursor_type_changed); 13164 || cursor_type_changed);
13146 13165
13147 /* If specs for an arrow have changed, do thorough redisplay 13166 /* If specs for an arrow have changed, do thorough redisplay
@@ -13191,18 +13210,16 @@ redisplay_internal (void)
13191 } 13210 }
13192 } 13211 }
13193 else if (EQ (selected_window, minibuf_window) 13212 else if (EQ (selected_window, minibuf_window)
13194 && (current_buffer->clip_changed 13213 && (current_buffer->clip_changed || window_outdated (w))
13195 || w->last_modified < MODIFF
13196 || w->last_overlay_modified < OVERLAY_MODIFF)
13197 && resize_mini_window (w, 0)) 13214 && resize_mini_window (w, 0))
13198 { 13215 {
13199 /* Resized active mini-window to fit the size of what it is 13216 /* Resized active mini-window to fit the size of what it is
13200 showing if its contents might have changed. */ 13217 showing if its contents might have changed. */
13201 must_finish = 1; 13218 must_finish = 1;
13202/* FIXME: this causes all frames to be updated, which seems unnecessary 13219 /* FIXME: this causes all frames to be updated, which seems unnecessary
13203 since only the current frame needs to be considered. This function needs 13220 since only the current frame needs to be considered. This function
13204 to be rewritten with two variables, consider_all_windows and 13221 needs to be rewritten with two variables, consider_all_windows and
13205 consider_all_frames. */ 13222 consider_all_frames. */
13206 consider_all_windows_p = 1; 13223 consider_all_windows_p = 1;
13207 ++windows_or_buffers_changed; 13224 ++windows_or_buffers_changed;
13208 ++update_mode_lines; 13225 ++update_mode_lines;
@@ -13257,9 +13274,7 @@ redisplay_internal (void)
13257 || FETCH_BYTE (BYTEPOS (tlbufpos)) == '\n')) 13274 || FETCH_BYTE (BYTEPOS (tlbufpos)) == '\n'))
13258 /* Former continuation line has disappeared by becoming empty. */ 13275 /* Former continuation line has disappeared by becoming empty. */
13259 goto cancel; 13276 goto cancel;
13260 else if (w->last_modified < MODIFF 13277 else if (window_outdated (w) || MINI_WINDOW_P (w))
13261 || w->last_overlay_modified < OVERLAY_MODIFF
13262 || MINI_WINDOW_P (w))
13263 { 13278 {
13264 /* We have to handle the case of continuation around a 13279 /* We have to handle the case of continuation around a
13265 wide-column character (see the comment in indent.c around 13280 wide-column character (see the comment in indent.c around
@@ -13433,7 +13448,7 @@ redisplay_internal (void)
13433 } 13448 }
13434 13449
13435 CHARPOS (this_line_start_pos) = 0; 13450 CHARPOS (this_line_start_pos) = 0;
13436 consider_all_windows_p |= buffer_shared > 1; 13451 consider_all_windows_p |= buffer_shared_and_changed ();
13437 ++clear_face_cache_count; 13452 ++clear_face_cache_count;
13438#ifdef HAVE_WINDOW_SYSTEM 13453#ifdef HAVE_WINDOW_SYSTEM
13439 ++clear_image_cache_count; 13454 ++clear_image_cache_count;
@@ -13445,8 +13460,6 @@ redisplay_internal (void)
13445 13460
13446 if (consider_all_windows_p) 13461 if (consider_all_windows_p)
13447 { 13462 {
13448 Lisp_Object tail, frame;
13449
13450 FOR_EACH_FRAME (tail, frame) 13463 FOR_EACH_FRAME (tail, frame)
13451 XFRAME (frame)->updated_p = 0; 13464 XFRAME (frame)->updated_p = 0;
13452 13465
@@ -13656,7 +13669,6 @@ redisplay_internal (void)
13656 frames here explicitly. */ 13669 frames here explicitly. */
13657 if (!pending) 13670 if (!pending)
13658 { 13671 {
13659 Lisp_Object tail, frame;
13660 int new_count = 0; 13672 int new_count = 0;
13661 13673
13662 FOR_EACH_FRAME (tail, frame) 13674 FOR_EACH_FRAME (tail, frame)
@@ -15510,8 +15522,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15510 = (!NILP (w->window_end_valid) 15522 = (!NILP (w->window_end_valid)
15511 && !current_buffer->clip_changed 15523 && !current_buffer->clip_changed
15512 && !current_buffer->prevent_redisplay_optimizations_p 15524 && !current_buffer->prevent_redisplay_optimizations_p
15513 && w->last_modified >= MODIFF 15525 && !window_outdated (w));
15514 && w->last_overlay_modified >= OVERLAY_MODIFF);
15515 15526
15516 /* Run the window-bottom-change-functions 15527 /* Run the window-bottom-change-functions
15517 if it is possible that the text on the screen has changed 15528 if it is possible that the text on the screen has changed
@@ -15533,8 +15544,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15533 buffer_unchanged_p 15544 buffer_unchanged_p
15534 = (!NILP (w->window_end_valid) 15545 = (!NILP (w->window_end_valid)
15535 && !current_buffer->clip_changed 15546 && !current_buffer->clip_changed
15536 && w->last_modified >= MODIFF 15547 && !window_outdated (w));
15537 && w->last_overlay_modified >= OVERLAY_MODIFF);
15538 15548
15539 /* When windows_or_buffers_changed is non-zero, we can't rely on 15549 /* When windows_or_buffers_changed is non-zero, we can't rely on
15540 the window end being valid, so set it to nil there. */ 15550 the window end being valid, so set it to nil there. */
@@ -15559,9 +15569,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15559 if (!NILP (w->column_number_displayed) 15569 if (!NILP (w->column_number_displayed)
15560 /* This alternative quickly identifies a common case 15570 /* This alternative quickly identifies a common case
15561 where no change is needed. */ 15571 where no change is needed. */
15562 && !(PT == w->last_point 15572 && !(PT == w->last_point && !window_outdated (w))
15563 && w->last_modified >= MODIFF
15564 && w->last_overlay_modified >= OVERLAY_MODIFF)
15565 && (XFASTINT (w->column_number_displayed) != current_column ())) 15573 && (XFASTINT (w->column_number_displayed) != current_column ()))
15566 update_mode_line = 1; 15574 update_mode_line = 1;
15567 15575
@@ -15803,8 +15811,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15803 && (CHARPOS (startp) < ZV 15811 && (CHARPOS (startp) < ZV
15804 /* Avoid starting at end of buffer. */ 15812 /* Avoid starting at end of buffer. */
15805 || CHARPOS (startp) == BEGV 15813 || CHARPOS (startp) == BEGV
15806 || (w->last_modified >= MODIFF 15814 || !window_outdated (w)))
15807 && w->last_overlay_modified >= OVERLAY_MODIFF)))
15808 { 15815 {
15809 int d1, d2, d3, d4, d5, d6; 15816 int d1, d2, d3, d4, d5, d6;
15810 15817
@@ -27678,12 +27685,6 @@ note_mouse_highlight (struct frame *f, int x, int y)
27678 if (hlinfo->mouse_face_defer) 27685 if (hlinfo->mouse_face_defer)
27679 return; 27686 return;
27680 27687
27681 if (gc_in_progress)
27682 {
27683 hlinfo->mouse_face_deferred_gc = 1;
27684 return;
27685 }
27686
27687 /* Which window is that in? */ 27688 /* Which window is that in? */
27688 window = window_from_coordinates (f, x, y, &part, 1); 27689 window = window_from_coordinates (f, x, y, &part, 1);
27689 27690
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)
369 ASET (font_object, FONT_FORMAT_INDEX, 369 ASET (font_object, FONT_FORMAT_INDEX,
370 ftfont_font_format (xftfont->pattern, filename)); 370 ftfont_font_format (xftfont->pattern, filename));
371 font = XFONT_OBJECT (font_object); 371 font = XFONT_OBJECT (font_object);
372 font->pixel_size = pixel_size; 372 font->pixel_size = size;
373 font->driver = &xftfont_driver; 373 font->driver = &xftfont_driver;
374 font->encoding_charset = font->repertory_charset = -1; 374 font->encoding_charset = font->repertory_charset = -1;
375 375
@@ -387,8 +387,6 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
387 xftfont_info->matrix.xy = 0x10000L * matrix->xy; 387 xftfont_info->matrix.xy = 0x10000L * matrix->xy;
388 xftfont_info->matrix.yx = 0x10000L * matrix->yx; 388 xftfont_info->matrix.yx = 0x10000L * matrix->yx;
389 } 389 }
390 font->pixel_size = size;
391 font->driver = &xftfont_driver;
392 if (INTEGERP (AREF (entity, FONT_SPACING_INDEX))) 390 if (INTEGERP (AREF (entity, FONT_SPACING_INDEX)))
393 spacing = XINT (AREF (entity, FONT_SPACING_INDEX)); 391 spacing = XINT (AREF (entity, FONT_SPACING_INDEX));
394 else 392 else
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
669XTframe_up_to_date (struct frame *f) 669XTframe_up_to_date (struct frame *f)
670{ 670{
671 if (FRAME_X_P (f)) 671 if (FRAME_X_P (f))
672 { 672 FRAME_MOUSE_UPDATE (f);
673 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
674
675 if (hlinfo->mouse_face_deferred_gc
676 || f == hlinfo->mouse_face_mouse_frame)
677 {
678 block_input ();
679 if (hlinfo->mouse_face_mouse_frame)
680 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
681 hlinfo->mouse_face_mouse_x,
682 hlinfo->mouse_face_mouse_y);
683 hlinfo->mouse_face_deferred_gc = 0;
684 unblock_input ();
685 }
686 }
687} 673}
688 674
689 675
@@ -9502,7 +9488,6 @@ x_free_frame_resources (struct frame *f)
9502 hlinfo->mouse_face_end_row 9488 hlinfo->mouse_face_end_row
9503 = hlinfo->mouse_face_end_col = -1; 9489 = hlinfo->mouse_face_end_col = -1;
9504 hlinfo->mouse_face_window = Qnil; 9490 hlinfo->mouse_face_window = Qnil;
9505 hlinfo->mouse_face_deferred_gc = 0;
9506 hlinfo->mouse_face_mouse_frame = 0; 9491 hlinfo->mouse_face_mouse_frame = 0;
9507 } 9492 }
9508 9493
@@ -10153,7 +10138,6 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10153 dpyinfo->bitmaps_last = 0; 10138 dpyinfo->bitmaps_last = 0;
10154 dpyinfo->scratch_cursor_gc = 0; 10139 dpyinfo->scratch_cursor_gc = 0;
10155 hlinfo->mouse_face_mouse_frame = 0; 10140 hlinfo->mouse_face_mouse_frame = 0;
10156 hlinfo->mouse_face_deferred_gc = 0;
10157 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 10141 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
10158 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; 10142 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
10159 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID; 10143 hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;