aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-11-20 20:47:55 -0800
committerGlenn Morris2012-11-20 20:47:55 -0800
commit6ef2e5ef5278a807132b78c42de402925b20bfb3 (patch)
treee5711cdfcdf8a152416c2a96e399695285a4a3a8
parenteadf1faa3cb5eea8c25a5166a9a97ebd63525c56 (diff)
parentb6729a180f4b81ac26bd7b61f5330643b2d5e994 (diff)
downloademacs-6ef2e5ef5278a807132b78c42de402925b20bfb3.tar.gz
emacs-6ef2e5ef5278a807132b78c42de402925b20bfb3.zip
Merge from emacs-24; up to 2012-11-17T22:12:47Z!eggert@cs.ucla.edu
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac9
-rw-r--r--doc/emacs/ChangeLog6
-rw-r--r--doc/emacs/display.texi99
-rw-r--r--doc/lispref/ChangeLog17
-rw-r--r--doc/lispref/debugging.texi64
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/os.texi4
-rw-r--r--doc/lispref/tips.texi14
-rw-r--r--doc/lispref/windows.texi3
-rw-r--r--etc/NEWS2
-rw-r--r--lisp/ChangeLog43
-rw-r--r--lisp/calendar/time-date.el9
-rw-r--r--lisp/emacs-lisp/ert.el15
-rw-r--r--lisp/eshell/em-cmpl.el8
-rw-r--r--lisp/files.el2
-rw-r--r--lisp/net/tramp-sh.el16
-rw-r--r--lisp/net/tramp.el2
-rw-r--r--lisp/pcomplete.el3
-rw-r--r--lisp/ps-bdf.el19
-rw-r--r--lisp/simple.el3
-rw-r--r--lisp/window.el7
-rw-r--r--nt/ChangeLog8
-rw-r--r--nt/inc/stdint.h3
-rw-r--r--nt/nmake.defs2
-rw-r--r--src/ChangeLog21
-rw-r--r--src/emacs.c2
-rw-r--r--src/fileio.c46
-rw-r--r--src/w32.c13
-rw-r--r--src/w32term.h2
30 files changed, 326 insertions, 121 deletions
diff --git a/ChangeLog b/ChangeLog
index cd31e954721..33dafaaea4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12012-11-21 Glenn Morris <rgm@gnu.org>
2
3 * configure.ac (--enable-profiling): Doc fix.
4
12012-11-20 Paul Eggert <eggert@cs.ucla.edu> 52012-11-20 Paul Eggert <eggert@cs.ucla.edu>
2 6
3 Improve static checking of integer overflow and stack smashing. 7 Improve static checking of integer overflow and stack smashing.
diff --git a/configure.ac b/configure.ac
index 01fe72d1ee6..343a9e7cfb5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -329,10 +329,15 @@ if test "${enableval}" != "no"; then
329fi) 329fi)
330 330
331 331
332dnl The name of this option is unfortunate. It predates, and has no
333dnl relation to, the "sampling-based elisp profiler" added in 24.3.
334dnl Actually, it stops it working.
335dnl http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00393.html
332AC_ARG_ENABLE(profiling, 336AC_ARG_ENABLE(profiling,
333[AS_HELP_STRING([--enable-profiling], 337[AS_HELP_STRING([--enable-profiling],
334 [build emacs with profiling support. 338 [build emacs with low-level, gprof profiling support.
335 This might not work on all platforms])], 339 Mainly useful for debugging Emacs itself. May not work on
340 all platforms. Stops profiler.el working.])],
336[ac_enable_profiling="${enableval}"],[]) 341[ac_enable_profiling="${enableval}"],[])
337if test x$ac_enable_profiling != x ; then 342if test x$ac_enable_profiling != x ; then
338 PROFILING_CFLAGS="-DPROFILING=1 -pg" 343 PROFILING_CFLAGS="-DPROFILING=1 -pg"
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index dc5fa539cd1..af22f0628d1 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,9 @@
12012-11-21 Dani Moncayo <dmoncayo@gmail.com>
2
3 * display.texi (Auto Scrolling): Fix some inaccuracies, plus
4 clarifications (Bug#12865).
5 (Horizontal Scrolling): Clarifications.
6
12012-11-18 Dani Moncayo <dmoncayo@gmail.com> 72012-11-18 Dani Moncayo <dmoncayo@gmail.com>
2 8
3 * mark.texi (Disabled Transient Mark): Doc fixes (Bug#12746). 9 * mark.texi (Disabled Transient Mark): Doc fixes (Bug#12746).
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index b6ab4913f9c..876c46bdf1a 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -213,59 +213,62 @@ entire current defun onto the screen if possible.
213@node Auto Scrolling 213@node Auto Scrolling
214@section Automatic Scrolling 214@section Automatic Scrolling
215 215
216@cindex automatic scrolling
216 Emacs performs @dfn{automatic scrolling} when point moves out of the 217 Emacs performs @dfn{automatic scrolling} when point moves out of the
217visible portion of the text. 218visible portion of the text. Normally, automatic scrolling centers
219point vertically in the window, but there are several ways to alter
220this behavior.
218 221
219@vindex scroll-conservatively 222@vindex scroll-conservatively
220 Normally, this centers point vertically within the window. However, 223 If you set @code{scroll-conservatively} to a small number @var{n},
221if you set @code{scroll-conservatively} to a small number @var{n}, 224then moving point just a little off the screen (no more than @var{n}
222then if you move point just a little off the screen (less than @var{n} 225lines) causes Emacs to scroll just enough to bring point back on
223lines), Emacs scrolls the text just far enough to bring point back on 226screen; if doing so fails to make point visible, Emacs scrolls just
224screen. If doing so fails to make point visible, Emacs centers point 227far enough to center point in the window. If you set
225in the window. By default, @code{scroll-conservatively} is@tie{}0. 228@code{scroll-conservatively} to a large number (larger than 100),
226If you set @code{scroll-conservatively} to a large number (larger than 229automatic scrolling never centers point, no matter how far point
227100), Emacs will never center point as result of scrolling, even if 230moves; Emacs always scrolls text just enough to bring point into view,
228point moves far away from the text previously displayed in the window. 231either at the top or bottom of the window depending on the scroll
229With such a large value, Emacs will always scroll text just enough for 232direction. By default, @code{scroll-conservatively} is@tie{}0, which
230bringing point into view, so point will end up at the top or bottom of 233means to always center point in the window.
231the window, depending on the scroll direction.
232 234
233@vindex scroll-step 235@vindex scroll-step
234 An alternative way of controlling how Emacs scrolls text is by 236 Another way to control automatic scrolling is to customize the
235customizing the variable @code{scroll-step}. Its value determines how 237variable @code{scroll-step}. Its value determines the number of lines
236many lines to scroll the window when point moves off the screen. If 238by which to automatically scroll, when point moves off the screen. If
237moving by that number of lines fails to bring point back into view, 239scrolling by that number of lines fails to bring point back into view,
238point is centered instead. The default value is zero, which causes 240point is centered instead. The default value is zero, which (by
239point to always be centered after scrolling. 241default) causes point to always be centered after scrolling.
240
241 Since both @code{scroll-conservatively} and @code{scroll-step}
242control automatic scrolling in contradicting ways, you should set only
243one of them. If you customize both, the value of
244@code{scroll-conservatively} takes precedence.
245 242
246@cindex aggressive scrolling 243@cindex aggressive scrolling
247@vindex scroll-up-aggressively 244@vindex scroll-up-aggressively
248@vindex scroll-down-aggressively 245@vindex scroll-down-aggressively
249 When the window does scroll by a distance longer than 246 A third way to control automatic scrolling is to customize the
250@code{scroll-step}, you can control how aggressively it scrolls by 247variables @code{scroll-up-aggressively} and
251setting the variables @code{scroll-up-aggressively} and 248@code{scroll-down-aggressively}, which directly specify the vertical
252@code{scroll-down-aggressively}. The value of 249position of point after scrolling. The value of
253@code{scroll-up-aggressively} should be either @code{nil}, or a 250@code{scroll-up-aggressively} should be either @code{nil} (the
254fraction @var{f} between 0 and 1. A fraction specifies where on the 251default), or a floating point number @var{f} between 0 and 1. The
255screen to put point when scrolling upward, i.e.@: forward. When point 252latter means that when point goes below the bottom window edge (i.e.@:
256goes off the window end, the new start position is chosen to put point 253scrolling forward), Emacs scrolls the window so that point is @var{f}
257@var{f} parts of the window height from the bottom margin. Thus, 254parts of the window height from the bottom window edge. Thus, larger
258larger @var{f} means more aggressive scrolling: more new text is 255@var{f} means more aggressive scrolling: more new text is brought into
259brought into view. The default value, @code{nil}, is equivalent to 256view. The default value, @code{nil}, is equivalent to 0.5.
2600.5. 257
261 258 Likewise, @code{scroll-down-aggressively} is used when point goes
262 Likewise, @code{scroll-down-aggressively} is used for scrolling 259above the bottom window edge (i.e.@: scrolling backward). The value
263down, i.e.@: backward. The value specifies how far point should be 260specifies how far point should be from the top margin of the window
264placed from the top margin of the window; thus, as with 261after scrolling. Thus, as with @code{scroll-up-aggressively}, a
265@code{scroll-up-aggressively}, a larger value is more aggressive. 262larger value is more aggressive.
266 263
267 These two variables are ignored if either @code{scroll-step} or 264 Note that the variables @code{scroll-conservatively},
268@code{scroll-conservatively} are set to a non-zero value. 265@code{scroll-step}, and @code{scroll-up-aggressively} /
266@code{scroll-down-aggressively} control automatic scrolling in
267contradictory ways. Therefore, you should pick no more than one of
268these methods to customize automatic scrolling. In case you customize
269multiple variables, the order of priority is:
270@code{scroll-conservatively}, then @code{scroll-step}, and finally
271@code{scroll-up-aggressively} / @code{scroll-down-aggressively}.
269 272
270@vindex scroll-margin 273@vindex scroll-margin
271 The variable @code{scroll-margin} restricts how close point can come 274 The variable @code{scroll-margin} restricts how close point can come
@@ -295,10 +298,10 @@ the cursor is left at the edge instead.)
295 298
296@vindex hscroll-margin 299@vindex hscroll-margin
297 The variable @code{hscroll-margin} controls how close point can get 300 The variable @code{hscroll-margin} controls how close point can get
298to the window's edges before automatic scrolling occurs. It is 301to the window's left and right edges before automatic scrolling
299measured in columns. For example, if the value is 5, then moving 302occurs. It is measured in columns. For example, if the value is 5,
300point within 5 columns of an edge causes horizontal scrolling away 303then moving point within 5 columns of an edge causes horizontal
301from that edge. 304scrolling away from that edge.
302 305
303@vindex hscroll-step 306@vindex hscroll-step
304 The variable @code{hscroll-step} determines how many columns to 307 The variable @code{hscroll-step} determines how many columns to
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index a5295adc368..db896984c86 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,20 @@
12012-11-21 Glenn Morris <rgm@gnu.org>
2
3 * debugging.texi (Profiling): New section.
4 (Debugging): Mention profiling in the introduction.
5 * tips.texi (Compilation Tips): Move profiling to separate section.
6 * elisp.texi: Add Profiling to detailed menu.
7
82012-11-21 Martin Rudalics <rudalics@gmx.at>
9
10 * windows.texi (Display Action Functions): Fix recently added
11 example. Suggested by Michael Heerdegen.
12
132012-11-21 Paul Eggert <eggert@cs.ucla.edu>
14
15 Minor cleanup for times as lists of four integers.
16 * os.texi (Time Parsing): Time values can now be four integers.
17
12012-11-18 Glenn Morris <rgm@gnu.org> 182012-11-18 Glenn Morris <rgm@gnu.org>
2 19
3 * loading.texi (How Programs Do Loading): Add eager macro expansion. 20 * loading.texi (How Programs Do Loading): Add eager macro expansion.
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 11532b19781..3439a8ae152 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -32,6 +32,9 @@ program.
32@item 32@item
33You can use the ERT package to write regression tests for the program. 33You can use the ERT package to write regression tests for the program.
34@xref{Top,the ERT manual,, ERT, ERT: Emacs Lisp Regression Testing}. 34@xref{Top,the ERT manual,, ERT, ERT: Emacs Lisp Regression Testing}.
35
36@item
37You can profile the program to get hints about how to make it more efficient.
35@end itemize 38@end itemize
36 39
37 Other useful tools for debugging input and output problems are the 40 Other useful tools for debugging input and output problems are the
@@ -43,6 +46,7 @@ function (@pxref{Terminal Output}).
43* Edebug:: A source-level Emacs Lisp debugger. 46* Edebug:: A source-level Emacs Lisp debugger.
44* Syntax Errors:: How to find syntax errors. 47* Syntax Errors:: How to find syntax errors.
45* Test Coverage:: Ensuring you have tested all branches in your code. 48* Test Coverage:: Ensuring you have tested all branches in your code.
49* Profiling:: Measuring the resources that your code uses.
46@end menu 50@end menu
47 51
48@node Debugger 52@node Debugger
@@ -809,3 +813,63 @@ never return. If it ever does return, you get a run-time error.
809 Edebug also has a coverage testing feature (@pxref{Coverage 813 Edebug also has a coverage testing feature (@pxref{Coverage
810Testing}). These features partly duplicate each other, and it would 814Testing}). These features partly duplicate each other, and it would
811be cleaner to combine them. 815be cleaner to combine them.
816
817
818@node Profiling
819@section Profiling
820@cindex profiling
821@cindex measuring resource usage
822@cindex memory usage
823
824If your program is working correctly, but you want to make it run more
825quickly or efficiently, the first thing to do is @dfn{profile} your
826code so that you know how it is using resources. If you find that one
827particular function is responsible for a significant portion of the
828runtime, you can start looking for ways to optimize that piece.
829
830Emacs has built-in support for this. To begin profiling, type
831@kbd{M-x profiler-start}. You can choose to profile by processor
832usage, memory usage, or both. After doing some work, type
833@kbd{M-x profiler-report} to display a summary buffer for each
834resource that you chose to profile. The names of the report buffers
835include the times at which the reports were generated, so you can
836generate another report later on without erasing previous results.
837When you have finished profiling, type @kbd{M-x profiler-stop} (there
838is a small overhead associated with profiling).
839
840The profiler report buffer shows, on each line, a function that was
841called, followed by how much resource (processor or memory) it used in
842absolute and percentage times since profiling started. If a given
843line has a @samp{+} symbol at the left-hand side, you can expand that
844line by typing @key{RET}, in order to see the function(s) called by
845the higher-level function. Pressing @key{RET} again will collapse
846back to the original state.
847
848Press @kbd{j} or @kbd{mouse-2} to jump to the definition of a function.
849Press @kbd{d} to view a function's documentation.
850You can save a profile to a file using @kbd{C-x C-w}.
851You can compare two profiles using @kbd{=}.
852
853@c FIXME reversed calltree?
854
855@cindex @file{elp.el}
856@cindex timing programs
857The @file{elp} library offers an alternative approach. See the file
858@file{elp.el} for instructions.
859
860@cindex @file{benchmark.el}
861@cindex benchmarking
862You can check the speed of individual Emacs Lisp forms using the
863@file{benchmark} library. See the functions @code{benchmark-run} and
864@code{benchmark-run-compiled} in @file{benchmark.el}.
865
866@c Not worth putting in the printed manual.
867@ifnottex
868@cindex --enable-profiling option of configure
869For low-level profiling of Emacs itself, you can build it using the
870@option{--enable-profiling} option of @command{configure}. When Emacs
871exits, it generates a file @file{gmon.out} that you can examine using
872the @command{gprof} utility. This feature is mainly useful for
873debugging Emacs. It actually stops the Lisp-level @kbd{M-x
874profiler-@dots{}} commands described above from working.
875@end ifnottex
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index a70558bf09f..cb00b5e9889 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -617,6 +617,7 @@ Debugging Lisp Programs
617* Edebug:: A source-level Emacs Lisp debugger. 617* Edebug:: A source-level Emacs Lisp debugger.
618* Syntax Errors:: How to find syntax errors. 618* Syntax Errors:: How to find syntax errors.
619* Test Coverage:: Ensuring you have tested all branches in your code. 619* Test Coverage:: Ensuring you have tested all branches in your code.
620* Profiling:: Measuring the resources that your code uses.
620 621
621The Lisp Debugger 622The Lisp Debugger
622 623
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 2f06e207fc4..7552aaccc53 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1373,8 +1373,8 @@ on others, years as early as 1901 do work.
1373@node Time Parsing 1373@node Time Parsing
1374@section Parsing and Formatting Times 1374@section Parsing and Formatting Times
1375 1375
1376 These functions convert time values (lists of two or three integers) 1376 These functions convert time values to text in a string, and vice versa.
1377to text in a string, and vice versa. 1377Time values are lists of two to four integers (@pxref{Time of Day}).
1378 1378
1379@defun date-to-time string 1379@defun date-to-time string
1380This function parses the time-string @var{string} and returns the 1380This function parses the time-string @var{string} and returns the
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index 4336baa128f..bba416d5614 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -460,18 +460,8 @@ Lisp programs.
460 460
461@itemize @bullet 461@itemize @bullet
462@item 462@item
463@cindex profiling 463Profile your program, to find out where the time is being spent.
464@cindex timing programs 464@xref{Profiling}.
465@cindex @file{elp.el}
466Profile your program with the @file{elp} library. See the file
467@file{elp.el} for instructions.
468
469@item
470@cindex @file{benchmark.el}
471@cindex benchmarking
472Check the speed of individual Emacs Lisp forms using the
473@file{benchmark} library. See the functions @code{benchmark-run} and
474@code{benchmark-run-compiled} in @file{benchmark.el}.
475 465
476@item 466@item
477Use iteration rather than recursion whenever possible. 467Use iteration rather than recursion whenever possible.
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index b8581b1cc62..e515b24db93 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -2038,7 +2038,8 @@ Evaluating the form above will cause @code{display-buffer} to proceed as
2038follows: If `*foo*' already appears on a visible or iconified frame, it 2038follows: If `*foo*' already appears on a visible or iconified frame, it
2039will reuse its window. Otherwise, it will try to pop up a new window 2039will reuse its window. Otherwise, it will try to pop up a new window
2040or, if that is impossible, a new frame. If all these steps fail, it 2040or, if that is impossible, a new frame. If all these steps fail, it
2041will try to use some existing window. 2041will proceed using whatever @code{display-buffer-base-action} and
2042@code{display-buffer-fallback-action} prescribe.
2042 2043
2043 Furthermore, @code{display-buffer} will try to adjust a reused window 2044 Furthermore, @code{display-buffer} will try to adjust a reused window
2044(provided `*foo*' was put by @code{display-buffer} there before) or a 2045(provided `*foo*' was put by @code{display-buffer} there before) or a
diff --git a/etc/NEWS b/etc/NEWS
index a66a3858e0e..090715587d3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -847,7 +847,7 @@ are deprecated and will be removed eventually.
847** New sampling-based Elisp profiler. 847** New sampling-based Elisp profiler.
848Try M-x profiler-start, do some work, and then call M-x profiler-report. 848Try M-x profiler-start, do some work, and then call M-x profiler-report.
849When finished, use M-x profiler-stop. The sampling rate can be based on 849When finished, use M-x profiler-stop. The sampling rate can be based on
850CPU time (only supported on some systems) or memory allocations. 850CPU time or memory allocations.
851 851
852+++ 852+++
853** CL-style generalized variables are now in core Elisp. 853** CL-style generalized variables are now in core Elisp.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3e35c8a9fcb..05f86ca22c0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,46 @@
12012-11-21 Eli Zaretskii <eliz@gnu.org>
2
3 * simple.el (line-move): Don't call line-move-partial if
4 scroll-conservatively is in effect. (Bug#12927)
5
62012-11-21 Stefan Monnier <monnier@iro.umontreal.ca>
7
8 * eshell/em-cmpl.el (eshell-pcomplete): Refine fix for bug#12838:
9 Fallback on completion-at-point rather than
10 pcomplete-expand-and-complete, and only if pcomplete actually failed.
11 (eshell-cmpl-initialize): Setup completion-at-point.
12
13 * pcomplete.el (pcomplete--entries): Obey pcomplete-ignore-case.
14
15 * emacs-lisp/ert.el (ert--expand-should-1): Adapt to cl-lib.
16
172012-11-21 Michael Albinus <michael.albinus@gmx.de>
18
19 * net/tramp-sh.el (tramp-do-copy-or-rename-file): If both files
20 are remote, check out-of-band property for both.
21
222012-11-21 Stefan Monnier <monnier@iro.umontreal.ca>
23
24 * window.el (switch-to-buffer): Re-add the warning that was lost in the
25 code rewrite.
26
272012-11-21 Paul Eggert <eggert@cs.ucla.edu>
28
29 More minor time fixes.
30 * calendar/time-date.el: Commentary fix.
31 * net/tramp-sh.el (tramp-do-file-attributes-with-ls): Undo last change;
32 too much other code depends on (0 0) time stamps.
33 * net/tramp.el (tramp-time-less-p, tramp-time-subtract):
34 Add a couple of FIXME comments.
35
36 Minor cleanup for times as lists of four integers.
37 * files.el (dir-locals-directory-cache):
38 * ps-bdf.el (bdf-file-mod-time, bdf-read-font-info):
39 Doc fixes.
40 * net/tramp-sh.el (tramp-do-file-attributes-with-ls):
41 * ps-bdf.el (bdf-file-newer-than-time):
42 Process four-integers time stamps, not two. Doc fixes.
43
12012-11-20 Stefan Monnier <monnier@iro.umontreal.ca> 442012-11-20 Stefan Monnier <monnier@iro.umontreal.ca>
2 45
3 * uniquify.el (uniquify-managed): Use defvar-local. 46 * uniquify.el (uniquify-managed): Use defvar-local.
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index b953a6fb2b0..9cac659d848 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -30,11 +30,10 @@
30;; value equal to HIGH * 2^16 + LOW + USEC * 10^-6 + PSEC * 10^-12 30;; value equal to HIGH * 2^16 + LOW + USEC * 10^-6 + PSEC * 10^-12
31;; seconds, where missing components are treated as zero. HIGH can be 31;; seconds, where missing components are treated as zero. HIGH can be
32;; negative, either because the value is a time difference, or because 32;; negative, either because the value is a time difference, or because
33;; the machine supports negative time stamps that fall before the 33;; the machine supports negative time stamps that fall before the epoch.
34;; epoch. The macro `with-decoded-time-value' and the 34;; The macro `with-decoded-time-value' and the function
35;; function `encode-time-value' make it easier to deal with these 35;; `encode-time-value' make it easier to deal with these formats.
36;; three formats. See `time-subtract' for an example of how to use 36;; See `time-subtract' for an example of how to use them.
37;; them.
38 37
39;;; Code: 38;;; Code:
40 39
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index ff00be7a237..9cbf417d876 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -388,16 +388,11 @@ DATA is displayed to the user and should state the reason of the failure."
388(defun ert--expand-should-1 (whole form inner-expander) 388(defun ert--expand-should-1 (whole form inner-expander)
389 "Helper function for the `should' macro and its variants." 389 "Helper function for the `should' macro and its variants."
390 (let ((form 390 (let ((form
391 ;; If `cl-macroexpand' isn't bound, the code that we're 391 (macroexpand form (cond
392 ;; compiling doesn't depend on cl and thus doesn't need an 392 ((boundp 'macroexpand-all-environment)
393 ;; environment arg for `macroexpand'. 393 macroexpand-all-environment)
394 (if (fboundp 'cl-macroexpand) 394 ((boundp 'cl-macro-environment)
395 ;; Suppress warning about run-time call to cl function: we 395 cl-macro-environment)))))
396 ;; only call it if it's fboundp.
397 (with-no-warnings
398 (cl-macroexpand form (and (boundp 'cl-macro-environment)
399 cl-macro-environment)))
400 (macroexpand form))))
401 (cond 396 (cond
402 ((or (atom form) (ert--special-operator-p (car form))) 397 ((or (atom form) (ert--special-operator-p (car form)))
403 (let ((value (ert--gensym "value-"))) 398 (let ((value (ert--gensym "value-")))
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index aa8aae2d245..b4c86e39e86 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -297,6 +297,8 @@ to writing a completion function."
297 (define-key eshell-command-map [? ] 'pcomplete-expand) 297 (define-key eshell-command-map [? ] 'pcomplete-expand)
298 (define-key eshell-mode-map [tab] 'eshell-pcomplete) 298 (define-key eshell-mode-map [tab] 'eshell-pcomplete)
299 (define-key eshell-mode-map [(control ?i)] 'eshell-pcomplete) 299 (define-key eshell-mode-map [(control ?i)] 'eshell-pcomplete)
300 (add-hook 'completion-at-point-functions
301 #'pcomplete-completions-at-point nil t)
300 ;; jww (1999-10-19): Will this work on anything but X? 302 ;; jww (1999-10-19): Will this work on anything but X?
301 (if (featurep 'xemacs) 303 (if (featurep 'xemacs)
302 (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse) 304 (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse)
@@ -452,9 +454,9 @@ to writing a completion function."
452(defun eshell-pcomplete () 454(defun eshell-pcomplete ()
453 "Eshell wrapper for `pcomplete'." 455 "Eshell wrapper for `pcomplete'."
454 (interactive) 456 (interactive)
455 (if eshell-cmpl-ignore-case 457 (condition-case nil
456 (pcomplete-expand-and-complete) ; hack workaround for bug#12838 458 (pcomplete)
457 (pcomplete))) 459 (text-read-only (completion-at-point)))) ; Workaround for bug#12838.
458 460
459(provide 'em-cmpl) 461(provide 'em-cmpl)
460 462
diff --git a/lisp/files.el b/lisp/files.el
index 40eddec469b..496f9bf8fa4 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3433,7 +3433,7 @@ DIR is the name of the directory.
3433CLASS is the name of a variable class (a symbol). 3433CLASS is the name of a variable class (a symbol).
3434MTIME is the recorded modification time of the directory-local 3434MTIME is the recorded modification time of the directory-local
3435variables file associated with this entry. This time is a list 3435variables file associated with this entry. This time is a list
3436of two integers (the same format as `file-attributes'), and is 3436of integers (the same format as `file-attributes'), and is
3437used to test whether the cache entry is still valid. 3437used to test whether the cache entry is still valid.
3438Alternatively, MTIME can be nil, which means the entry is always 3438Alternatively, MTIME can be nil, which means the entry is always
3439considered valid.") 3439considered valid.")
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index ec321d00506..07da0b3dc16 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1270,9 +1270,10 @@ target of the symlink differ."
1270 res-uid 1270 res-uid
1271 ;; 3. File gid. 1271 ;; 3. File gid.
1272 res-gid 1272 res-gid
1273 ;; 4. Last access time, as a list of two integers. First 1273 ;; 4. Last access time, as a list of integers. Normally this
1274 ;; integer has high-order 16 bits of time, second has low 16 1274 ;; would be in the same format as `current-time', but the
1275 ;; bits. 1275 ;; subseconds part is not currently implemented, and (0 0)
1276 ;; denotes an unknown time.
1276 ;; 5. Last modification time, likewise. 1277 ;; 5. Last modification time, likewise.
1277 ;; 6. Last status change time, likewise. 1278 ;; 6. Last status change time, likewise.
1278 '(0 0) '(0 0) '(0 0) ;CCC how to find out? 1279 '(0 0) '(0 0) '(0 0) ;CCC how to find out?
@@ -1980,6 +1981,7 @@ file names."
1980 (error "Unknown operation `%s', must be `copy' or `rename'" op)) 1981 (error "Unknown operation `%s', must be `copy' or `rename'" op))
1981 (let ((t1 (tramp-tramp-file-p filename)) 1982 (let ((t1 (tramp-tramp-file-p filename))
1982 (t2 (tramp-tramp-file-p newname)) 1983 (t2 (tramp-tramp-file-p newname))
1984 (length (nth 7 (file-attributes (file-truename filename))))
1983 (context (and preserve-selinux-context 1985 (context (and preserve-selinux-context
1984 (apply 'file-selinux-context (list filename)))) 1986 (apply 'file-selinux-context (list filename))))
1985 pr tm) 1987 pr tm)
@@ -2009,8 +2011,9 @@ file names."
2009 ok-if-already-exists keep-date preserve-uid-gid)) 2011 ok-if-already-exists keep-date preserve-uid-gid))
2010 2012
2011 ;; Try out-of-band operation. 2013 ;; Try out-of-band operation.
2012 ((tramp-method-out-of-band-p 2014 ((and
2013 v1 (nth 7 (file-attributes (file-truename filename)))) 2015 (tramp-method-out-of-band-p v1 length)
2016 (tramp-method-out-of-band-p v2 length))
2014 (tramp-do-copy-or-rename-file-out-of-band 2017 (tramp-do-copy-or-rename-file-out-of-band
2015 op filename newname keep-date)) 2018 op filename newname keep-date))
2016 2019
@@ -2038,8 +2041,7 @@ file names."
2038 2041
2039 ;; If the Tramp file has an out-of-band method, the 2042 ;; If the Tramp file has an out-of-band method, the
2040 ;; corresponding copy-program can be invoked. 2043 ;; corresponding copy-program can be invoked.
2041 ((tramp-method-out-of-band-p 2044 ((tramp-method-out-of-band-p v length)
2042 v (nth 7 (file-attributes (file-truename filename))))
2043 (tramp-do-copy-or-rename-file-out-of-band 2045 (tramp-do-copy-or-rename-file-out-of-band
2044 op filename newname keep-date)) 2046 op filename newname keep-date))
2045 2047
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index caaae5d553e..d6f2177b03b 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3767,6 +3767,7 @@ Invokes `password-read' if available, `read-passwd' else."
3767 ("oct" . 10) ("nov" . 11) ("dec" . 12)) 3767 ("oct" . 10) ("nov" . 11) ("dec" . 12))
3768 "Alist mapping month names to integers.") 3768 "Alist mapping month names to integers.")
3769 3769
3770;; FIXME: Shouldn't this also look at any subseconds parts of T1 and T2?
3770;;;###tramp-autoload 3771;;;###tramp-autoload
3771(defun tramp-time-less-p (t1 t2) 3772(defun tramp-time-less-p (t1 t2)
3772 "Say whether time value T1 is less than time value T2." 3773 "Say whether time value T1 is less than time value T2."
@@ -3776,6 +3777,7 @@ Invokes `password-read' if available, `read-passwd' else."
3776 (and (= (car t1) (car t2)) 3777 (and (= (car t1) (car t2))
3777 (< (nth 1 t1) (nth 1 t2))))) 3778 (< (nth 1 t1) (nth 1 t2)))))
3778 3779
3780;; FIXME: Shouldn't this also look at any subseconds parts of T1 and T2?
3779(defun tramp-time-subtract (t1 t2) 3781(defun tramp-time-subtract (t1 t2)
3780 "Subtract two time values. 3782 "Subtract two time values.
3781Return the difference in the format of a time value." 3783Return the difference in the format of a time value."
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 9e55976a8bd..13cf7356e7f 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -833,7 +833,8 @@ this is `comint-dynamic-complete-functions'."
833 . ,(lambda (comps) 833 . ,(lambda (comps)
834 (sort comps pcomplete-compare-entry-function))) 834 (sort comps pcomplete-compare-entry-function)))
835 ,@(cdr (completion-file-name-table s p a))) 835 ,@(cdr (completion-file-name-table s p a)))
836 (let ((completion-ignored-extensions nil)) 836 (let ((completion-ignored-extensions nil)
837 (completion-ignore-case pcomplete-ignore-case))
837 (completion-table-with-predicate 838 (completion-table-with-predicate
838 #'comint-completion-file-name-table pred 'strict s p a)))))) 839 #'comint-completion-file-name-table pred 'strict s p a))))))
839 840
diff --git a/lisp/ps-bdf.el b/lisp/ps-bdf.el
index a82e03ceda7..477aee1b2da 100644
--- a/lisp/ps-bdf.el
+++ b/lisp/ps-bdf.el
@@ -70,20 +70,15 @@ for BDFNAME."
70 70
71(defsubst bdf-file-mod-time (filename) 71(defsubst bdf-file-mod-time (filename)
72 "Return modification time of FILENAME. 72 "Return modification time of FILENAME.
73The value is a list of two integers, the first integer has high-order 73The value is a list of integers in the same format as `current-time'."
7416 bits, the second has low 16 bits."
75 (nth 5 (file-attributes filename))) 74 (nth 5 (file-attributes filename)))
76 75
77(defun bdf-file-newer-than-time (filename mod-time) 76(defun bdf-file-newer-than-time (filename mod-time)
78 "Return non-nil if and only if FILENAME is newer than MOD-TIME. 77 "Return non-nil if and only if FILENAME is newer than MOD-TIME.
79MOD-TIME is a modification time as a list of two integers, the first 78MOD-TIME is a modification time as a list of integers in the same
80integer has high-order 16 bits, the second has low 16 bits." 79format as `current-time'."
81 (let* ((new-mod-time (bdf-file-mod-time filename)) 80 (let ((new-mod-time (bdf-file-mod-time filename)))
82 (new-time (car new-mod-time)) 81 (time-less-p mod-time new-mod-time)))
83 (time (car mod-time)))
84 (or (> new-time time)
85 (and (= new-time time)
86 (> (nth 1 new-mod-time) (nth 1 mod-time))))))
87 82
88(defun bdf-find-file (bdfname) 83(defun bdf-find-file (bdfname)
89 "Return a buffer visiting a bdf file BDFNAME. 84 "Return a buffer visiting a bdf file BDFNAME.
@@ -178,8 +173,8 @@ FONT-INFO is a list of the following format:
178 (BDFFILE MOD-TIME FONT-BOUNDING-BOX 173 (BDFFILE MOD-TIME FONT-BOUNDING-BOX
179 RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR) 174 RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
180 175
181MOD-TIME is last modification time as a list of two integers, the 176MOD-TIME is last modification time as a list of integers in the
182first integer has high-order 16 bits, the second has low 16 bits. 177same format as `current-time'.
183 178
184SIZE is a size of the font on 72 dpi device. This value is got 179SIZE is a size of the font on 72 dpi device. This value is got
185from SIZE record of the font. 180from SIZE record of the font.
diff --git a/lisp/simple.el b/lisp/simple.el
index aed945d6e13..5867561da26 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4583,6 +4583,9 @@ lines."
4583 (unless (and auto-window-vscroll try-vscroll 4583 (unless (and auto-window-vscroll try-vscroll
4584 ;; Only vscroll for single line moves 4584 ;; Only vscroll for single line moves
4585 (= (abs arg) 1) 4585 (= (abs arg) 1)
4586 ;; Under scroll-conservatively, the display engine
4587 ;; does this better.
4588 (zerop scroll-conservatively)
4586 ;; But don't vscroll in a keyboard macro. 4589 ;; But don't vscroll in a keyboard macro.
4587 (not defining-kbd-macro) 4590 (not defining-kbd-macro)
4588 (not executing-kbd-macro) 4591 (not executing-kbd-macro)
diff --git a/lisp/window.el b/lisp/window.el
index d378ea5ff14..52909fa9e5f 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5870,7 +5870,12 @@ the selected window or never appeared in it before, or if
5870 :version "24.3") 5870 :version "24.3")
5871 5871
5872(defun switch-to-buffer (buffer-or-name &optional norecord force-same-window) 5872(defun switch-to-buffer (buffer-or-name &optional norecord force-same-window)
5873 "Switch to buffer BUFFER-OR-NAME in the selected window. 5873 "Display buffer BUFFER-OR-NAME in the selected window.
5874
5875WARNING: This is NOT the way to work on another buffer temporarily
5876within a Lisp program! Use `set-buffer' instead. That avoids
5877messing with the window-buffer correspondences.
5878
5874If the selected window cannot display the specified 5879If the selected window cannot display the specified
5875buffer (e.g. if it is a minibuffer window or strongly dedicated 5880buffer (e.g. if it is a minibuffer window or strongly dedicated
5876to another buffer), call `pop-to-buffer' to select the buffer in 5881to another buffer), call `pop-to-buffer' to select the buffer in
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 4f9e8a2663c..0eda3a699d6 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,11 @@
12012-11-21 Eli Zaretskii <eliz@gnu.org>
2
3 * nmake.defs: Use !if, not !ifdef. For the details, see
4 http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00027.html
5
6 * inc/stdint.h (INTPTR_MIN):
7 (PTRDIFF_MIN) [!__GNUC__]: Define for MSVC.
8
12012-11-18 Eli Zaretskii <eliz@gnu.org> 92012-11-18 Eli Zaretskii <eliz@gnu.org>
2 10
3 * inc/unistd.h: Don't include fcntl.h and don't define O_RDWR. 11 * inc/unistd.h: Don't include fcntl.h and don't define O_RDWR.
diff --git a/nt/inc/stdint.h b/nt/inc/stdint.h
index 5c53fa18b55..97c9bbdaee9 100644
--- a/nt/inc/stdint.h
+++ b/nt/inc/stdint.h
@@ -37,6 +37,7 @@ typedef unsigned __int64 uint64_t;
37#define INT64_MAX 9223372036854775807i64 37#define INT64_MAX 9223372036854775807i64
38#define INT64_MIN (~INT64_MAX) 38#define INT64_MIN (~INT64_MAX)
39#define INTPTR_MAX INT64_MAX 39#define INTPTR_MAX INT64_MAX
40#define INTPTR_MIN INT64_MIN
40#define UINTMAX_MAX UINT64_MAX 41#define UINTMAX_MAX UINT64_MAX
41#define UINTMAX_MIN UINT64_MIN 42#define UINTMAX_MIN UINT64_MIN
42#define INTMAX_MAX INT64_MAX 43#define INTMAX_MAX INT64_MAX
@@ -51,6 +52,7 @@ typedef unsigned int uint32_t;
51#define INT32_MAX 2147483647 52#define INT32_MAX 2147483647
52#define INT32_MIN (~INT32_MAX) 53#define INT32_MIN (~INT32_MAX)
53#define INTPTR_MAX INT32_MAX 54#define INTPTR_MAX INT32_MAX
55#define INTPTR_MIN INT32_MIN
54#define UINTMAX_MAX UINT32_MAX 56#define UINTMAX_MAX UINT32_MAX
55#define UINTMAX_MIN UINT32_MIN 57#define UINTMAX_MIN UINT32_MIN
56#define INTMAX_MAX INT32_MAX 58#define INTMAX_MAX INT32_MAX
@@ -60,6 +62,7 @@ typedef unsigned int uint32_t;
60#endif 62#endif
61 63
62#define PTRDIFF_MAX INTPTR_MAX 64#define PTRDIFF_MAX INTPTR_MAX
65#define PTRDIFF_MIN INTPTR_MIN
63 66
64#endif /* !__GNUC__ */ 67#endif /* !__GNUC__ */
65 68
diff --git a/nt/nmake.defs b/nt/nmake.defs
index 48809afc771..16a787ea30a 100644
--- a/nt/nmake.defs
+++ b/nt/nmake.defs
@@ -116,7 +116,7 @@ RC_INCLUDE = -i
116 116
117USE_CRT_DLL = 1 117USE_CRT_DLL = 1
118 118
119!ifdef USE_CRT_DLL 119!if USE_CRT_DLL
120libc = msvcrt$(D).lib 120libc = msvcrt$(D).lib
121EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1 121EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1
122!else 122!else
diff --git a/src/ChangeLog b/src/ChangeLog
index 332656fcf00..c16a4dc87ce 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,24 @@
12012-11-21 Ken Brown <kbrown@cornell.edu>
2
3 * emacs.c (main): Set the G_SLICE environment variable for all
4 Cygwin builds, not just GTK builds. See
5 https://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00368.html.
6
72012-11-21 Eli Zaretskii <eliz@gnu.org>
8
9 * w32.c (FILE_DEVICE_FILE_SYSTEM, METHOD_BUFFERED)
10 (FILE_ANY_ACCESS, CTL_CODE, FSCTL_GET_REPARSE_POINT) [_MSC_VER]:
11 Define for the MSVC compiler.
12
13 * w32term.h (EnumSystemLocalesW) [_MSC_VER]: Add a missing semi-colon.
14
15 * fileio.c (Fsubstitute_in_file_name, Ffile_name_directory)
16 (Fexpand_file_name) [DOS_NT]: Pass encoded file name to
17 dostounix_filename. Prevents crashes down the road, because
18 dostounix_filename assumes it gets a unibyte string. Reported by
19 Michel de Ruiter <michel@sentient.nl>, see
20 http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00017.html
21
12012-11-20 Stefan Monnier <monnier@iro.umontreal.ca> 222012-11-20 Stefan Monnier <monnier@iro.umontreal.ca>
2 23
3 Conflate Qnil and Qunbound for `symbol-function'. 24 Conflate Qnil and Qunbound for `symbol-function'.
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/fileio.c b/src/fileio.c
index 572f6d8ef83..e1a7cf55e28 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 {
@@ -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/w32.c b/src/w32.c
index 94cf472a4ae..b51022c6001 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. */
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