Avoid integer overflow on scroll-left and scroll-right.

* window.c (HSCROLL_MAX): New macro.
(Fscroll_left, Fscroll_right): Avoid undefined behavior on integer
overflow when requested scroll falls outside ptrdiff_t range.
* configure.in: Fix previous change. Remove --enable-asserts.
(CPPFLAGS): Remove conditional -DXASSERTS=1.
Add --enable-link-time-optimization.
* INSTALL: Mention this.
* src/editfns.c (region_limit): Clip to narrowing.

Fixes: debbugs:11770
lisp/emacs-lisp/cl-lib.el (cl-pushnew): Don't capture X (bug#11811).
* nsfns.m: Fix GLYPH_DEBUG usage assuming that it may be
undefined.  Convert from xassert to eassert.
* nsmenu.m: Convert from xassert to eassert.
* nsterm.m: Likewise.
* editfns.c (region_limit): Fix type mismatch.
lisp/gnus/tests/: Remove
Merge from emacs-24; up to 2012-04-30T11:57:47Z!sdl.web@gmail.com
* net/ange-ftp.el (ange-ftp-get-passwd): Throw if `non-essential'
is non-nil.
(ange-ftp-ignore-errors-if-non-essential): New defmacro.
(ange-ftp-file-name-all-completions): Use it.  (Bug#11808)
Auto-commit of generated files.
* lisp/fringe.el (fringe-mode): Doc fix.
* src/window.h (struct window): Change type of 'fringes_outside_margins'
to bitfield.  Fix comment.  Adjust users accordingly.
(struct window): Change type of 'window_end_bytepos' to ptrdiff_t.
Adjust comment.
* src/xdisp.c (try_window_id): Change type of 'first_vpos' and 'vpos'
to ptrdiff_t.
Fix the current directory of the Emacs process on MS-Windows.

 src/w32.c (getwd): Adjust commentary about startup_dir.
 (init_environment): Always call sys_access, even in non-MSVC
 builds.  Don't chdir to the directory of the Emacs executable.
 This undoes code from 1997 which was justified by the need to
 "avoid conflicts when removing and renaming directories".  But its
 downside was that every relative file name was being interpreted
 relative to the directory of the Emacs executable, which can never
 be TRT.  In particular, it broke sys_access when called with
 relative file names.
 (sys_access): Map GetLastError to errno.
Texinfo markup fixes for Emacs manual.

* doc/emacs/maintaining.texi (Basic VC Editing, VC Pull, Merging):
* doc/emacs/basic.texi (Erasing, Basic Undo): Fix markup.
Undo change in xdisp.c in 2012-06-29T11:48:08Z!dmantipov@yandex.ru.

 src/xdisp.c (try_window_id): Undo last change.  'int' is wide 
 enough to hold vertical pixel positions on screen.
* lisp/emacs-lisp/cl-lib.el (cl-pushnew): Use macroexp-let2.
* lisp.h (CHECK_RANGED_INTEGER): Make value to check the first
argument.
* character.c, charset.c, menu.c, process.c, window.c: Adjust all
uses.
* font.c (font_style_to_value, font_style_symbolic)
(font_prop_validate_style): Add type checks for values in
font_style_table.
* xml.el: Implement XML parameter entities.
(xml-parameter-entity-alist): New variable.
(xml-parse-region, xml-parse-fragment): Preserve previous values
of xml-entity-alist and xml-parameter-entity-alist, so that
repeated calls on different documents do not change them.
(xml-parse-tag): Fix doctype regexp.
(xml--entity-replacement-text): New function.
(xml-parse-dtd): Use it.  Don't handle system entities; doing that
properly requires url retrieval which is unimplemented.
(xml-escape-string): Doc fix.
* lisp/emacs-lisp/cl-lib.el: Require macroexp for its macros.
* lisp/emacs-lisp/cl-lib.el: Require macroexp.