1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

Merge from emacs-24; up to 2012-11-17T22:12:47Z!eggert@cs.ucla.edu

This commit is contained in:
Glenn Morris 2012-11-20 20:47:55 -08:00
commit 6ef2e5ef52
30 changed files with 324 additions and 119 deletions

View File

@ -1,3 +1,7 @@
2012-11-21 Glenn Morris <rgm@gnu.org>
* configure.ac (--enable-profiling): Doc fix.
2012-11-20 Paul Eggert <eggert@cs.ucla.edu>
Improve static checking of integer overflow and stack smashing.

View File

@ -329,10 +329,15 @@ if test "${enableval}" != "no"; then
fi)
dnl The name of this option is unfortunate. It predates, and has no
dnl relation to, the "sampling-based elisp profiler" added in 24.3.
dnl Actually, it stops it working.
dnl http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00393.html
AC_ARG_ENABLE(profiling,
[AS_HELP_STRING([--enable-profiling],
[build emacs with profiling support.
This might not work on all platforms])],
[build emacs with low-level, gprof profiling support.
Mainly useful for debugging Emacs itself. May not work on
all platforms. Stops profiler.el working.])],
[ac_enable_profiling="${enableval}"],[])
if test x$ac_enable_profiling != x ; then
PROFILING_CFLAGS="-DPROFILING=1 -pg"

View File

@ -1,3 +1,9 @@
2012-11-21 Dani Moncayo <dmoncayo@gmail.com>
* display.texi (Auto Scrolling): Fix some inaccuracies, plus
clarifications (Bug#12865).
(Horizontal Scrolling): Clarifications.
2012-11-18 Dani Moncayo <dmoncayo@gmail.com>
* mark.texi (Disabled Transient Mark): Doc fixes (Bug#12746).

View File

@ -213,59 +213,62 @@ entire current defun onto the screen if possible.
@node Auto Scrolling
@section Automatic Scrolling
@cindex automatic scrolling
Emacs performs @dfn{automatic scrolling} when point moves out of the
visible portion of the text.
visible portion of the text. Normally, automatic scrolling centers
point vertically in the window, but there are several ways to alter
this behavior.
@vindex scroll-conservatively
Normally, this centers point vertically within the window. However,
if you set @code{scroll-conservatively} to a small number @var{n},
then if you move point just a little off the screen (less than @var{n}
lines), Emacs scrolls the text just far enough to bring point back on
screen. If doing so fails to make point visible, Emacs centers point
in the window. By default, @code{scroll-conservatively} is@tie{}0.
If you set @code{scroll-conservatively} to a large number (larger than
100), Emacs will never center point as result of scrolling, even if
point moves far away from the text previously displayed in the window.
With such a large value, Emacs will always scroll text just enough for
bringing point into view, so point will end up at the top or bottom of
the window, depending on the scroll direction.
If you set @code{scroll-conservatively} to a small number @var{n},
then moving point just a little off the screen (no more than @var{n}
lines) causes Emacs to scroll just enough to bring point back on
screen; if doing so fails to make point visible, Emacs scrolls just
far enough to center point in the window. If you set
@code{scroll-conservatively} to a large number (larger than 100),
automatic scrolling never centers point, no matter how far point
moves; Emacs always scrolls text just enough to bring point into view,
either at the top or bottom of the window depending on the scroll
direction. By default, @code{scroll-conservatively} is@tie{}0, which
means to always center point in the window.
@vindex scroll-step
An alternative way of controlling how Emacs scrolls text is by
customizing the variable @code{scroll-step}. Its value determines how
many lines to scroll the window when point moves off the screen. If
moving by that number of lines fails to bring point back into view,
point is centered instead. The default value is zero, which causes
point to always be centered after scrolling.
Since both @code{scroll-conservatively} and @code{scroll-step}
control automatic scrolling in contradicting ways, you should set only
one of them. If you customize both, the value of
@code{scroll-conservatively} takes precedence.
Another way to control automatic scrolling is to customize the
variable @code{scroll-step}. Its value determines the number of lines
by which to automatically scroll, when point moves off the screen. If
scrolling by that number of lines fails to bring point back into view,
point is centered instead. The default value is zero, which (by
default) causes point to always be centered after scrolling.
@cindex aggressive scrolling
@vindex scroll-up-aggressively
@vindex scroll-down-aggressively
When the window does scroll by a distance longer than
@code{scroll-step}, you can control how aggressively it scrolls by
setting the variables @code{scroll-up-aggressively} and
@code{scroll-down-aggressively}. The value of
@code{scroll-up-aggressively} should be either @code{nil}, or a
fraction @var{f} between 0 and 1. A fraction specifies where on the
screen to put point when scrolling upward, i.e.@: forward. When point
goes off the window end, the new start position is chosen to put point
@var{f} parts of the window height from the bottom margin. Thus,
larger @var{f} means more aggressive scrolling: more new text is
brought into view. The default value, @code{nil}, is equivalent to
0.5.
A third way to control automatic scrolling is to customize the
variables @code{scroll-up-aggressively} and
@code{scroll-down-aggressively}, which directly specify the vertical
position of point after scrolling. The value of
@code{scroll-up-aggressively} should be either @code{nil} (the
default), or a floating point number @var{f} between 0 and 1. The
latter means that when point goes below the bottom window edge (i.e.@:
scrolling forward), Emacs scrolls the window so that point is @var{f}
parts of the window height from the bottom window edge. Thus, larger
@var{f} means more aggressive scrolling: more new text is brought into
view. The default value, @code{nil}, is equivalent to 0.5.
Likewise, @code{scroll-down-aggressively} is used for scrolling
down, i.e.@: backward. The value specifies how far point should be
placed from the top margin of the window; thus, as with
@code{scroll-up-aggressively}, a larger value is more aggressive.
Likewise, @code{scroll-down-aggressively} is used when point goes
above the bottom window edge (i.e.@: scrolling backward). The value
specifies how far point should be from the top margin of the window
after scrolling. Thus, as with @code{scroll-up-aggressively}, a
larger value is more aggressive.
These two variables are ignored if either @code{scroll-step} or
@code{scroll-conservatively} are set to a non-zero value.
Note that the variables @code{scroll-conservatively},
@code{scroll-step}, and @code{scroll-up-aggressively} /
@code{scroll-down-aggressively} control automatic scrolling in
contradictory ways. Therefore, you should pick no more than one of
these methods to customize automatic scrolling. In case you customize
multiple variables, the order of priority is:
@code{scroll-conservatively}, then @code{scroll-step}, and finally
@code{scroll-up-aggressively} / @code{scroll-down-aggressively}.
@vindex scroll-margin
The variable @code{scroll-margin} restricts how close point can come
@ -295,10 +298,10 @@ the cursor is left at the edge instead.)
@vindex hscroll-margin
The variable @code{hscroll-margin} controls how close point can get
to the window's edges before automatic scrolling occurs. It is
measured in columns. For example, if the value is 5, then moving
point within 5 columns of an edge causes horizontal scrolling away
from that edge.
to the window's left and right edges before automatic scrolling
occurs. It is measured in columns. For example, if the value is 5,
then moving point within 5 columns of an edge causes horizontal
scrolling away from that edge.
@vindex hscroll-step
The variable @code{hscroll-step} determines how many columns to

View File

@ -1,3 +1,20 @@
2012-11-21 Glenn Morris <rgm@gnu.org>
* debugging.texi (Profiling): New section.
(Debugging): Mention profiling in the introduction.
* tips.texi (Compilation Tips): Move profiling to separate section.
* elisp.texi: Add Profiling to detailed menu.
2012-11-21 Martin Rudalics <rudalics@gmx.at>
* windows.texi (Display Action Functions): Fix recently added
example. Suggested by Michael Heerdegen.
2012-11-21 Paul Eggert <eggert@cs.ucla.edu>
Minor cleanup for times as lists of four integers.
* os.texi (Time Parsing): Time values can now be four integers.
2012-11-18 Glenn Morris <rgm@gnu.org>
* loading.texi (How Programs Do Loading): Add eager macro expansion.

View File

@ -32,6 +32,9 @@ program.
@item
You can use the ERT package to write regression tests for the program.
@xref{Top,the ERT manual,, ERT, ERT: Emacs Lisp Regression Testing}.
@item
You can profile the program to get hints about how to make it more efficient.
@end itemize
Other useful tools for debugging input and output problems are the
@ -43,6 +46,7 @@ function (@pxref{Terminal Output}).
* Edebug:: A source-level Emacs Lisp debugger.
* Syntax Errors:: How to find syntax errors.
* Test Coverage:: Ensuring you have tested all branches in your code.
* Profiling:: Measuring the resources that your code uses.
@end menu
@node Debugger
@ -809,3 +813,63 @@ never return. If it ever does return, you get a run-time error.
Edebug also has a coverage testing feature (@pxref{Coverage
Testing}). These features partly duplicate each other, and it would
be cleaner to combine them.
@node Profiling
@section Profiling
@cindex profiling
@cindex measuring resource usage
@cindex memory usage
If your program is working correctly, but you want to make it run more
quickly or efficiently, the first thing to do is @dfn{profile} your
code so that you know how it is using resources. If you find that one
particular function is responsible for a significant portion of the
runtime, you can start looking for ways to optimize that piece.
Emacs has built-in support for this. To begin profiling, type
@kbd{M-x profiler-start}. You can choose to profile by processor
usage, memory usage, or both. After doing some work, type
@kbd{M-x profiler-report} to display a summary buffer for each
resource that you chose to profile. The names of the report buffers
include the times at which the reports were generated, so you can
generate another report later on without erasing previous results.
When you have finished profiling, type @kbd{M-x profiler-stop} (there
is a small overhead associated with profiling).
The profiler report buffer shows, on each line, a function that was
called, followed by how much resource (processor or memory) it used in
absolute and percentage times since profiling started. If a given
line has a @samp{+} symbol at the left-hand side, you can expand that
line by typing @key{RET}, in order to see the function(s) called by
the higher-level function. Pressing @key{RET} again will collapse
back to the original state.
Press @kbd{j} or @kbd{mouse-2} to jump to the definition of a function.
Press @kbd{d} to view a function's documentation.
You can save a profile to a file using @kbd{C-x C-w}.
You can compare two profiles using @kbd{=}.
@c FIXME reversed calltree?
@cindex @file{elp.el}
@cindex timing programs
The @file{elp} library offers an alternative approach. See the file
@file{elp.el} for instructions.
@cindex @file{benchmark.el}
@cindex benchmarking
You can check the speed of individual Emacs Lisp forms using the
@file{benchmark} library. See the functions @code{benchmark-run} and
@code{benchmark-run-compiled} in @file{benchmark.el}.
@c Not worth putting in the printed manual.
@ifnottex
@cindex --enable-profiling option of configure
For low-level profiling of Emacs itself, you can build it using the
@option{--enable-profiling} option of @command{configure}. When Emacs
exits, it generates a file @file{gmon.out} that you can examine using
the @command{gprof} utility. This feature is mainly useful for
debugging Emacs. It actually stops the Lisp-level @kbd{M-x
profiler-@dots{}} commands described above from working.
@end ifnottex

View File

@ -617,6 +617,7 @@ Debugging Lisp Programs
* Edebug:: A source-level Emacs Lisp debugger.
* Syntax Errors:: How to find syntax errors.
* Test Coverage:: Ensuring you have tested all branches in your code.
* Profiling:: Measuring the resources that your code uses.
The Lisp Debugger

View File

@ -1373,8 +1373,8 @@ on others, years as early as 1901 do work.
@node Time Parsing
@section Parsing and Formatting Times
These functions convert time values (lists of two or three integers)
to text in a string, and vice versa.
These functions convert time values to text in a string, and vice versa.
Time values are lists of two to four integers (@pxref{Time of Day}).
@defun date-to-time string
This function parses the time-string @var{string} and returns the

View File

@ -460,18 +460,8 @@ Lisp programs.
@itemize @bullet
@item
@cindex profiling
@cindex timing programs
@cindex @file{elp.el}
Profile your program with the @file{elp} library. See the file
@file{elp.el} for instructions.
@item
@cindex @file{benchmark.el}
@cindex benchmarking
Check the speed of individual Emacs Lisp forms using the
@file{benchmark} library. See the functions @code{benchmark-run} and
@code{benchmark-run-compiled} in @file{benchmark.el}.
Profile your program, to find out where the time is being spent.
@xref{Profiling}.
@item
Use iteration rather than recursion whenever possible.

View File

@ -2038,7 +2038,8 @@ Evaluating the form above will cause @code{display-buffer} to proceed as
follows: If `*foo*' already appears on a visible or iconified frame, it
will reuse its window. Otherwise, it will try to pop up a new window
or, if that is impossible, a new frame. If all these steps fail, it
will try to use some existing window.
will proceed using whatever @code{display-buffer-base-action} and
@code{display-buffer-fallback-action} prescribe.
Furthermore, @code{display-buffer} will try to adjust a reused window
(provided `*foo*' was put by @code{display-buffer} there before) or a

View File

@ -847,7 +847,7 @@ are deprecated and will be removed eventually.
** New sampling-based Elisp profiler.
Try M-x profiler-start, do some work, and then call M-x profiler-report.
When finished, use M-x profiler-stop. The sampling rate can be based on
CPU time (only supported on some systems) or memory allocations.
CPU time or memory allocations.
+++
** CL-style generalized variables are now in core Elisp.

View File

@ -1,3 +1,46 @@
2012-11-21 Eli Zaretskii <eliz@gnu.org>
* simple.el (line-move): Don't call line-move-partial if
scroll-conservatively is in effect. (Bug#12927)
2012-11-21 Stefan Monnier <monnier@iro.umontreal.ca>
* eshell/em-cmpl.el (eshell-pcomplete): Refine fix for bug#12838:
Fallback on completion-at-point rather than
pcomplete-expand-and-complete, and only if pcomplete actually failed.
(eshell-cmpl-initialize): Setup completion-at-point.
* pcomplete.el (pcomplete--entries): Obey pcomplete-ignore-case.
* emacs-lisp/ert.el (ert--expand-should-1): Adapt to cl-lib.
2012-11-21 Michael Albinus <michael.albinus@gmx.de>
* net/tramp-sh.el (tramp-do-copy-or-rename-file): If both files
are remote, check out-of-band property for both.
2012-11-21 Stefan Monnier <monnier@iro.umontreal.ca>
* window.el (switch-to-buffer): Re-add the warning that was lost in the
code rewrite.
2012-11-21 Paul Eggert <eggert@cs.ucla.edu>
More minor time fixes.
* calendar/time-date.el: Commentary fix.
* net/tramp-sh.el (tramp-do-file-attributes-with-ls): Undo last change;
too much other code depends on (0 0) time stamps.
* net/tramp.el (tramp-time-less-p, tramp-time-subtract):
Add a couple of FIXME comments.
Minor cleanup for times as lists of four integers.
* files.el (dir-locals-directory-cache):
* ps-bdf.el (bdf-file-mod-time, bdf-read-font-info):
Doc fixes.
* net/tramp-sh.el (tramp-do-file-attributes-with-ls):
* ps-bdf.el (bdf-file-newer-than-time):
Process four-integers time stamps, not two. Doc fixes.
2012-11-20 Stefan Monnier <monnier@iro.umontreal.ca>
* uniquify.el (uniquify-managed): Use defvar-local.

View File

@ -30,11 +30,10 @@
;; value equal to HIGH * 2^16 + LOW + USEC * 10^-6 + PSEC * 10^-12
;; seconds, where missing components are treated as zero. HIGH can be
;; negative, either because the value is a time difference, or because
;; the machine supports negative time stamps that fall before the
;; epoch. The macro `with-decoded-time-value' and the
;; function `encode-time-value' make it easier to deal with these
;; three formats. See `time-subtract' for an example of how to use
;; them.
;; the machine supports negative time stamps that fall before the epoch.
;; The macro `with-decoded-time-value' and the function
;; `encode-time-value' make it easier to deal with these formats.
;; See `time-subtract' for an example of how to use them.
;;; Code:

View File

@ -388,16 +388,11 @@ DATA is displayed to the user and should state the reason of the failure."
(defun ert--expand-should-1 (whole form inner-expander)
"Helper function for the `should' macro and its variants."
(let ((form
;; If `cl-macroexpand' isn't bound, the code that we're
;; compiling doesn't depend on cl and thus doesn't need an
;; environment arg for `macroexpand'.
(if (fboundp 'cl-macroexpand)
;; Suppress warning about run-time call to cl function: we
;; only call it if it's fboundp.
(with-no-warnings
(cl-macroexpand form (and (boundp 'cl-macro-environment)
cl-macro-environment)))
(macroexpand form))))
(macroexpand form (cond
((boundp 'macroexpand-all-environment)
macroexpand-all-environment)
((boundp 'cl-macro-environment)
cl-macro-environment)))))
(cond
((or (atom form) (ert--special-operator-p (car form)))
(let ((value (ert--gensym "value-")))

View File

@ -297,6 +297,8 @@ to writing a completion function."
(define-key eshell-command-map [? ] 'pcomplete-expand)
(define-key eshell-mode-map [tab] 'eshell-pcomplete)
(define-key eshell-mode-map [(control ?i)] 'eshell-pcomplete)
(add-hook 'completion-at-point-functions
#'pcomplete-completions-at-point nil t)
;; jww (1999-10-19): Will this work on anything but X?
(if (featurep 'xemacs)
(define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse)
@ -452,9 +454,9 @@ to writing a completion function."
(defun eshell-pcomplete ()
"Eshell wrapper for `pcomplete'."
(interactive)
(if eshell-cmpl-ignore-case
(pcomplete-expand-and-complete) ; hack workaround for bug#12838
(pcomplete)))
(condition-case nil
(pcomplete)
(text-read-only (completion-at-point)))) ; Workaround for bug#12838.
(provide 'em-cmpl)

View File

@ -3433,7 +3433,7 @@ DIR is the name of the directory.
CLASS is the name of a variable class (a symbol).
MTIME is the recorded modification time of the directory-local
variables file associated with this entry. This time is a list
of two integers (the same format as `file-attributes'), and is
of integers (the same format as `file-attributes'), and is
used to test whether the cache entry is still valid.
Alternatively, MTIME can be nil, which means the entry is always
considered valid.")

View File

@ -1270,9 +1270,10 @@ target of the symlink differ."
res-uid
;; 3. File gid.
res-gid
;; 4. Last access time, as a list of two integers. First
;; integer has high-order 16 bits of time, second has low 16
;; bits.
;; 4. Last access time, as a list of integers. Normally this
;; would be in the same format as `current-time', but the
;; subseconds part is not currently implemented, and (0 0)
;; denotes an unknown time.
;; 5. Last modification time, likewise.
;; 6. Last status change time, likewise.
'(0 0) '(0 0) '(0 0) ;CCC how to find out?
@ -1980,6 +1981,7 @@ file names."
(error "Unknown operation `%s', must be `copy' or `rename'" op))
(let ((t1 (tramp-tramp-file-p filename))
(t2 (tramp-tramp-file-p newname))
(length (nth 7 (file-attributes (file-truename filename))))
(context (and preserve-selinux-context
(apply 'file-selinux-context (list filename))))
pr tm)
@ -2009,8 +2011,9 @@ file names."
ok-if-already-exists keep-date preserve-uid-gid))
;; Try out-of-band operation.
((tramp-method-out-of-band-p
v1 (nth 7 (file-attributes (file-truename filename))))
((and
(tramp-method-out-of-band-p v1 length)
(tramp-method-out-of-band-p v2 length))
(tramp-do-copy-or-rename-file-out-of-band
op filename newname keep-date))
@ -2038,8 +2041,7 @@ file names."
;; If the Tramp file has an out-of-band method, the
;; corresponding copy-program can be invoked.
((tramp-method-out-of-band-p
v (nth 7 (file-attributes (file-truename filename))))
((tramp-method-out-of-band-p v length)
(tramp-do-copy-or-rename-file-out-of-band
op filename newname keep-date))

View File

@ -3767,6 +3767,7 @@ Invokes `password-read' if available, `read-passwd' else."
("oct" . 10) ("nov" . 11) ("dec" . 12))
"Alist mapping month names to integers.")
;; FIXME: Shouldn't this also look at any subseconds parts of T1 and T2?
;;;###tramp-autoload
(defun tramp-time-less-p (t1 t2)
"Say whether time value T1 is less than time value T2."
@ -3776,6 +3777,7 @@ Invokes `password-read' if available, `read-passwd' else."
(and (= (car t1) (car t2))
(< (nth 1 t1) (nth 1 t2)))))
;; FIXME: Shouldn't this also look at any subseconds parts of T1 and T2?
(defun tramp-time-subtract (t1 t2)
"Subtract two time values.
Return the difference in the format of a time value."

View File

@ -833,7 +833,8 @@ this is `comint-dynamic-complete-functions'."
. ,(lambda (comps)
(sort comps pcomplete-compare-entry-function)))
,@(cdr (completion-file-name-table s p a)))
(let ((completion-ignored-extensions nil))
(let ((completion-ignored-extensions nil)
(completion-ignore-case pcomplete-ignore-case))
(completion-table-with-predicate
#'comint-completion-file-name-table pred 'strict s p a))))))

View File

@ -70,20 +70,15 @@ for BDFNAME."
(defsubst bdf-file-mod-time (filename)
"Return modification time of FILENAME.
The value is a list of two integers, the first integer has high-order
16 bits, the second has low 16 bits."
The value is a list of integers in the same format as `current-time'."
(nth 5 (file-attributes filename)))
(defun bdf-file-newer-than-time (filename mod-time)
"Return non-nil if and only if FILENAME is newer than MOD-TIME.
MOD-TIME is a modification time as a list of two integers, the first
integer has high-order 16 bits, the second has low 16 bits."
(let* ((new-mod-time (bdf-file-mod-time filename))
(new-time (car new-mod-time))
(time (car mod-time)))
(or (> new-time time)
(and (= new-time time)
(> (nth 1 new-mod-time) (nth 1 mod-time))))))
MOD-TIME is a modification time as a list of integers in the same
format as `current-time'."
(let ((new-mod-time (bdf-file-mod-time filename)))
(time-less-p mod-time new-mod-time)))
(defun bdf-find-file (bdfname)
"Return a buffer visiting a bdf file BDFNAME.
@ -178,8 +173,8 @@ FONT-INFO is a list of the following format:
(BDFFILE MOD-TIME FONT-BOUNDING-BOX
RELATIVE-COMPOSE BASELINE-OFFSET CODE-RANGE MAXLEN OFFSET-VECTOR)
MOD-TIME is last modification time as a list of two integers, the
first integer has high-order 16 bits, the second has low 16 bits.
MOD-TIME is last modification time as a list of integers in the
same format as `current-time'.
SIZE is a size of the font on 72 dpi device. This value is got
from SIZE record of the font.

View File

@ -4583,6 +4583,9 @@ lines."
(unless (and auto-window-vscroll try-vscroll
;; Only vscroll for single line moves
(= (abs arg) 1)
;; Under scroll-conservatively, the display engine
;; does this better.
(zerop scroll-conservatively)
;; But don't vscroll in a keyboard macro.
(not defining-kbd-macro)
(not executing-kbd-macro)

View File

@ -5870,7 +5870,12 @@ the selected window or never appeared in it before, or if
:version "24.3")
(defun switch-to-buffer (buffer-or-name &optional norecord force-same-window)
"Switch to buffer BUFFER-OR-NAME in the selected window.
"Display buffer BUFFER-OR-NAME in the selected window.
WARNING: This is NOT the way to work on another buffer temporarily
within a Lisp program! Use `set-buffer' instead. That avoids
messing with the window-buffer correspondences.
If the selected window cannot display the specified
buffer (e.g. if it is a minibuffer window or strongly dedicated
to another buffer), call `pop-to-buffer' to select the buffer in

View File

@ -1,3 +1,11 @@
2012-11-21 Eli Zaretskii <eliz@gnu.org>
* nmake.defs: Use !if, not !ifdef. For the details, see
http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00027.html
* inc/stdint.h (INTPTR_MIN):
(PTRDIFF_MIN) [!__GNUC__]: Define for MSVC.
2012-11-18 Eli Zaretskii <eliz@gnu.org>
* inc/unistd.h: Don't include fcntl.h and don't define O_RDWR.

View File

@ -37,6 +37,7 @@ typedef unsigned __int64 uint64_t;
#define INT64_MAX 9223372036854775807i64
#define INT64_MIN (~INT64_MAX)
#define INTPTR_MAX INT64_MAX
#define INTPTR_MIN INT64_MIN
#define UINTMAX_MAX UINT64_MAX
#define UINTMAX_MIN UINT64_MIN
#define INTMAX_MAX INT64_MAX
@ -51,6 +52,7 @@ typedef unsigned int uint32_t;
#define INT32_MAX 2147483647
#define INT32_MIN (~INT32_MAX)
#define INTPTR_MAX INT32_MAX
#define INTPTR_MIN INT32_MIN
#define UINTMAX_MAX UINT32_MAX
#define UINTMAX_MIN UINT32_MIN
#define INTMAX_MAX INT32_MAX
@ -60,6 +62,7 @@ typedef unsigned int uint32_t;
#endif
#define PTRDIFF_MAX INTPTR_MAX
#define PTRDIFF_MIN INTPTR_MIN
#endif /* !__GNUC__ */

View File

@ -116,7 +116,7 @@ RC_INCLUDE = -i
USE_CRT_DLL = 1
!ifdef USE_CRT_DLL
!if USE_CRT_DLL
libc = msvcrt$(D).lib
EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1
!else

View File

@ -1,3 +1,24 @@
2012-11-21 Ken Brown <kbrown@cornell.edu>
* emacs.c (main): Set the G_SLICE environment variable for all
Cygwin builds, not just GTK builds. See
https://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00368.html.
2012-11-21 Eli Zaretskii <eliz@gnu.org>
* w32.c (FILE_DEVICE_FILE_SYSTEM, METHOD_BUFFERED)
(FILE_ANY_ACCESS, CTL_CODE, FSCTL_GET_REPARSE_POINT) [_MSC_VER]:
Define for the MSVC compiler.
* w32term.h (EnumSystemLocalesW) [_MSC_VER]: Add a missing semi-colon.
* fileio.c (Fsubstitute_in_file_name, Ffile_name_directory)
(Fexpand_file_name) [DOS_NT]: Pass encoded file name to
dostounix_filename. Prevents crashes down the road, because
dostounix_filename assumes it gets a unibyte string. Reported by
Michel de Ruiter <michel@sentient.nl>, see
http://lists.gnu.org/archive/html/help-emacs-windows/2012-11/msg00017.html
2012-11-20 Stefan Monnier <monnier@iro.umontreal.ca>
Conflate Qnil and Qunbound for `symbol-function'.

View File

@ -715,7 +715,7 @@ main (int argc, char **argv)
stack_base = &dummy;
#endif
#if defined (USE_GTK) && defined (G_SLICE_ALWAYS_MALLOC)
#ifdef G_SLICE_ALWAYS_MALLOC
/* This is used by the Cygwin build. */
setenv ("G_SLICE", "always-malloc", 1);
#endif

View File

@ -315,6 +315,7 @@ Given a Unix syntax file name, returns a string ending in slash. */)
register const char *beg;
#else
register char *beg;
Lisp_Object tem_fn;
#endif
register const char *p;
Lisp_Object handler;
@ -374,10 +375,13 @@ Given a Unix syntax file name, returns a string ending in slash. */)
p = beg + strlen (beg);
}
}
dostounix_filename (beg);
#endif /* DOS_NT */
tem_fn = ENCODE_FILE (make_specified_string (beg, -1, p - beg,
STRING_MULTIBYTE (filename)));
dostounix_filename (SSDATA (tem_fn));
return DECODE_FILE (tem_fn);
#else /* DOS_NT */
return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename));
#endif /* DOS_NT */
}
DEFUN ("file-name-nondirectory", Ffile_name_nondirectory,
@ -951,7 +955,18 @@ filesystem tree, not (expand-file-name ".." dirname). */)
#ifdef DOS_NT
/* Make sure directories are all separated with /, but
avoid allocation of a new string when not required. */
dostounix_filename (nm);
if (multibyte)
{
Lisp_Object tem_name = make_specified_string (nm, -1, strlen (nm),
multibyte);
tem_name = ENCODE_FILE (tem_name);
dostounix_filename (SSDATA (tem_name));
tem_name = DECODE_FILE (tem_name);
memcpy (nm, SSDATA (tem_name), SBYTES (tem_name) + 1);
}
else
dostounix_filename (nm);
#ifdef WINDOWSNT
if (IS_DIRECTORY_SEP (nm[1]))
{
@ -1305,10 +1320,13 @@ filesystem tree, not (expand-file-name ".." dirname). */)
target[0] = '/';
target[1] = ':';
}
dostounix_filename (target);
#endif /* DOS_NT */
result = make_specified_string (target, -1, o - target, multibyte);
result = ENCODE_FILE (result);
dostounix_filename (SSDATA (result));
result = DECODE_FILE (result);
#else /* !DOS_NT */
result = make_specified_string (target, -1, o - target, multibyte);
#endif /* !DOS_NT */
}
/* Again look to see if the file name has special constructs in it
@ -1587,8 +1605,18 @@ those `/' is discarded. */)
memcpy (nm, SDATA (filename), SBYTES (filename) + 1);
#ifdef DOS_NT
dostounix_filename (nm);
substituted = (strcmp (nm, SDATA (filename)) != 0);
{
Lisp_Object encoded_filename = ENCODE_FILE (filename);
Lisp_Object tem_fn;
dostounix_filename (SDATA (encoded_filename));
tem_fn = DECODE_FILE (encoded_filename);
nm = alloca (SBYTES (tem_fn) + 1);
memcpy (nm, SDATA (tem_fn), SBYTES (tem_fn) + 1);
substituted = (memcmp (nm, SDATA (filename), SBYTES (filename)) != 0);
if (substituted)
filename = tem_fn;
}
#endif
endp = nm + SBYTES (filename);

View File

@ -119,9 +119,10 @@ typedef struct _PROCESS_MEMORY_COUNTERS_EX {
#include <aclapi.h>
#ifdef _MSC_VER
/* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER, except
on ntifs.h, which cannot be included because it triggers conflicts
with other Windows API headers. So we define it here by hand. */
/* MSVC doesn't provide the definition of REPARSE_DATA_BUFFER and the
associated macros, except on ntifs.h, which cannot be included
because it triggers conflicts with other Windows API headers. So
we define it here by hand. */
typedef struct _REPARSE_DATA_BUFFER {
ULONG ReparseTag;
@ -149,6 +150,12 @@ typedef struct _REPARSE_DATA_BUFFER {
} DUMMYUNIONNAME;
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
#define FILE_DEVICE_FILE_SYSTEM 9
#define METHOD_BUFFERED 0
#define FILE_ANY_ACCESS 0x00000000
#define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m))
#define FSCTL_GET_REPARSE_POINT \
CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
#endif
/* TCP connection support. */

View File

@ -751,7 +751,7 @@ extern int w32_system_caret_y;
typedef BOOL (CALLBACK *LOCALE_ENUMPROCA)(LPSTR);
typedef BOOL (CALLBACK *LOCALE_ENUMPROCW)(LPWSTR);
BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD);
BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD)
BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD);
#ifdef UNICODE
#define EnumSystemLocales EnumSystemLocalesW
#else