Paul Eggert [Sat, 7 Jul 2012 01:57:42 +0000 (18:57 -0700)]
Do not require float-time's arg to fit in time_t (Bug#11825).
This works better on hosts where time_t is unsigned, and where
float-time is applied to the (negative) difference between two times.
* editfns.c (decode_time_components): Last arg is now double *,
not int *, and means to store all the result as a double, without
worrying about whether the seconds part fits in time_t.
All callers changed.
(lisp_time_argument): Remove last int * arg, as it's no longer needed.
All callers changed.
(Ffloat_time): Do not fail merely because the specified time falls
outside of time_t range.
Replace some src/s undefs by never even checking on relevant platforms
* configure.in: (getwd): Don't check for it on unixware.
(random, rint): Don't check for these on hpux.
(res_init, libresolv): Don't check for these on darwin.
Andreas Schwab [Fri, 6 Jul 2012 19:34:39 +0000 (21:34 +0200)]
Fixes: debbugs:11870
* w32fns.c (Fx_window_property): Accept the same arguments as the
X Windows version. Doc fix.
* xfns.c (Fx_window_property): Doc fix.
* nt/config.nt: Complete rework to bring it in sync with autogen/config.in.
All Windows-specific code moved to src/s/ms-w32.h.
* src/s/ms-w32.h: Settings not specific to Windows moved to nt/config.nt.
Windows-specific code from nt/config.nt moved here.
Obsolete settings removed.
Paul Eggert [Fri, 6 Jul 2012 16:57:32 +0000 (09:57 -0700)]
* process.c: Avoid unnecessary calls to gettime.
(wait_reading_process_output): Don't get the time of day
when gobbling data immediately and not waiting, as there's no need
for it in that case. This removes a FIXME.
Fix marker debugging code.
* marker.c (byte_char_debug_check): Do not perform the check
if buffer is not multibyte.
(buf_charpos_to_bytepos, buf_bytepos_to_charpos): Call
byte_char_debug_check with correct arguments.
Compile marker debugging code only if ENABLE_CHECKING is defined.
* marker.c (byte_char_debug_check, count_markers): Use
only if ENABLE_CHECKING is defined.
(byte_debug_flag): Remove.
(CONSIDER, buf_charpos_to_bytepos, buf_bytepos_to_charpos):
Always call byte_char_debug_check if ENABLE_CHECKING is defined.
* make-dist [update]: Let autoreconf figure out what needs updating.
Use `make info-real'. leim/leim-list.el should always exist.
Check cd return value.
Move a comment from lisp/Makefile.in to lisp/loadup.el.
The comment in Makefile.in has been orphaned ever since
the bootstrap-prepare rule was removed in 2008.
Do not use Fdelete_overlay in delete_all_overlays
to avoid redundant calls to unchain_overlay.
* buffer.c (drop_overlay): New function.
(delete_all_overlays, Fdelete_overlay): Use it.
* minibuf.c (get_minibuffer): Fix comment.
* doc/lispref/intro.texi (A Sample Function Description): Fix incorrect
markup, undoing previous change.
(A Sample Variable Description): Minor clarifications and markup
improvements.
* doc/lispref/elisp.texi (Top):
* doc/lispref/text.texi (Text): Fix menu order.
* src/Makefile.in (emacs$(EXEEXT)): Don't check for load-path shadows.
It has nothing to do with building Emacs, and no-one is likely to be
paying attention to the result. The CANNOT_DUMP branch was pointless,
since it sets EMACSLOADPATH=$(lispsource) it is impossible for there
to ever be any shadows. The EMACSLOADPATH setting was probably necessary
for emacs to work at all when uninstalled, given the way init_lread
works for the CANNOT_DUMP case. Since -batch implies -q, in the
non-CANNOT_DUMP branch, any shadows could only come from site-lisp
files.
Eli Zaretskii [Thu, 5 Jul 2012 16:28:34 +0000 (19:28 +0300)]
Avoid long futile looping on a TTY under huge values of hscroll.
src/xdisp.c (display_line): Fix horizontal pixel coordinates when
hscroll is larger than the line width. Fixes long and futile
looping inside extend_face_to_end_of_line (on a TTY) producing
glyphs that are not needed and thrown away.
Jan Djärv [Thu, 5 Jul 2012 15:44:53 +0000 (17:44 +0200)]
Don't use deprecated functions when compiling with Gtk3.
* gtkutil.c (gtk_scrollbar_new, gtk_box_new): Define when HAVE_GTK3 is
not defined (Bug#11768).
(xg_create_frame_widgets): Use gtk_plug_new_for_display (Bug#11768).
(xg_create_frame_widgets, create_dialog, xg_get_file_with_chooser)
(make_widget_for_menu_item, xg_make_tool_item): Use gtk_box_new
followed by gtk_box_set_homogeneous (Bug#11768).
(xg_update_menu_item): Use GTK_IS_BOX (Bug#11768).
(update_theme_scrollbar_width, xg_create_scroll_bar): Use
gtk_scrollbar_new (Bug#11768).
(xg_event_is_for_scrollbar): Use Gdk Device functions for HAVE_GTK3.
(is_box_type): New function (Bug#11768).
(xg_tool_item_stale_p): Call is_box_type.
(xg_initialize): Get settings by calling gtk_settings_get_for_screen
with default display (Bug#11768).
Eli Zaretskii [Thu, 5 Jul 2012 15:04:57 +0000 (18:04 +0300)]
Fix bug #11857 with messed up display for insanely large hscroll values.
src/xdisp.c (window_hscroll_limited): New function.
(pos_visible_p, init_iterator): Use it to avoid overflow of pixel
coordinates when window's hscroll is set to insanely large
values.
src/window.h (struct window) <hscroll, min_hscroll>: Change type to 'int'.
* net/tramp-compat.el (top): Require packages, which aren't
autoloaded anymore for XEmacs. Protect call of
`tramp-file-name-handler' by `tramp-compat-funcall', pacifying the
compiler. Do not require tramp-util.el and tramp-vc.el anymore,
it hurts at least for SXEmacs.
(tramp-compat-temporary-file-directory): In XEmacs, there is no
standard-value for `temporary-file-directory'.
* net/tramp-sh.el (tramp-do-directory-files-and-attributes-with-stat):
Redirect stderr to /dev/null.
(tramp-sh-handle-write-region): uid and gid can be floats.
Reported by Russell Sim <russell.sim@gmail.com>.
(tramp-sh-handle-vc-registered): Hide errors.
(tramp-vc-file-name-handler): Use dummy results for `process-file'
and `start-file-process'.
(tramp-maybe-open-connection): Check also whether `non-essential'
is bound.
Paul Eggert [Wed, 4 Jul 2012 17:58:55 +0000 (10:58 -0700)]
* window.c (set_window_hscroll): Revert the 100000 hscroll limit.
This should be fixed in a better way; see Eli Zaretskii in
<http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00088.html>.
(HSCROLL_MAX): Remove; this is now internal to set_window_hscroll.
Paul Eggert [Wed, 4 Jul 2012 17:04:09 +0000 (10:04 -0700)]
* emacs.c (gdb_pvec_type): Change it back to enum pvec_type.
This variable's comment says Emacs needs at least one GDB-visible
symbol of type enum pvec_type, to work around GDB problems.
The symbol's value doesn't matter.
* xml.el (xml--parse-buffer): Use xml-syntax-table.
(xml-parse-tag): Likewise, and avoid changing entity tables.
(xml-syntax-table): Define from scratch, making sure not to give
x2000 and other Unicode spaces whitespace syntax, since those are
not spaces in XML.
(xml-parse-fragment): Delete unused function.
(xml-name-start-char-re, xml-name-char-re, xml-name-re)
(xml-names-re, xml-nmtoken-re, xml-nmtokens-re, xml-char-ref-re)
(xml-entity-ref, xml-pe-reference-re)
(xml-reference-re,xml-att-value-re, xml-tokenized-type-re)
(xml-notation-type-re, xml-enumeration-re, xml-enumerated-type-re)
(xml-att-type-re, xml-default-decl-re, xml-att-def-re)
(xml-entity-value-re): Use syntax references in regexps where
possible; no need to define inside a let-binding.
(xml-parse-dtd): Use xml-pe-reference-re.
(xml-entity-or-char-ref-re): New defconst.
(xml-parse-string, xml-substitute-special): Use it.
Stefan Monnier [Wed, 4 Jul 2012 15:59:12 +0000 (11:59 -0400)]
* lisp/files.el (locate-dominating-file): Allow `name' to be a predicate.
(find-file--read-only): New function.
(find-file-read-only, find-file-read-only-other-window)
(find-file-read-only-other-frame): Use it.
(insert-file-contents-literally): Don't `fset'.
(get-free-disk-space): Use locate-dominating-file.
* buffer.c (init_buffer_once): Fix initialization of
headers for buffer_defaults and buffer_local_symbols.
Reported by Juanma Barranquero <lekktu@gmail.com>.
Stefan Monnier [Wed, 4 Jul 2012 14:38:02 +0000 (10:38 -0400)]
Turn VECTOR_FREE_LIST_FLAG into PVEC_FREE.
* src/lisp.h (enum pvec_type): Use fewer bits.
(PSEUDOVECTOR_SIZE_BITS): New constant.
(PSEUDOVECTOR_SIZE_MASK, PVEC_TYPE_MASK): Use it.
(XSETPVECTYPESIZE, XSETTYPED_PSEUDOVECTOR, DEFUN): Adapt code to
change in pvec_type.
(PSEUDOVECTOR_TYPEP): New macro.
(TYPED_PSEUDOVECTORP): Use it.
* src/fns.c (internal_equal): Adapt code to extract pvectype.
* src/emacs.c (gdb_pvec_type): Update type.
* src/alloc.c (PSEUDOVECTOR_NBYTES): New macro.
(VECTOR_FREE_LIST_SIZE_MASK): Remove (=> PSEUDOVECTOR_SIZE_MASK).
(VECTOR_FREE_LIST_FLAG): Remove (=> PVEC_FREE).
(SETUP_ON_FREE_LIST): Use XSETPVECTYPESIZE.
(sweep_vectors): Use it. Use local var `total_bytes' instead of
abusing vector->header.next.nbytes.
(live_vector_p): Use PVEC_TYPE.
(mark_object): Adapt code to extract pvectype. Use switch.
Fix compilation with --enable-gcc-warnings and -O1
optimization level.
* configure.in: If --enable-gcc-warnings, disable
-Wunsafe-loop-optimizations for -O1 optimization level.
* src/doprnt.c (doprnt): Change type of tem to int, initialize
to avoid compiler warning. Add eassert.
* src/search.c (simple_search): Initialize match_byte to avoid
compiler warning. Add eassert.
Paul Eggert [Wed, 4 Jul 2012 06:15:31 +0000 (23:15 -0700)]
Avoid weird behavior with large horizontal scrolls.
Without this change, for example, large hscroll values would
mess up Emacs's display on Fedora 15 x86, presumably due to
overflows in int calculations in the display code.
Also, if buffers had long lines, Emacs would freeze.
* window.c (HSCROLL_MAX): Reduce to 100000, and make it visible to GDB.
(set_window_hscroll): New function, containing the old guts of
Fset_window_hscroll. Return the clipped value.
(Fset_window_hscroll, Fscroll_left, Fscroll_right): Use it.
This avoids the need to check against PTRDIFF_MAX.
Paul Eggert [Wed, 4 Jul 2012 00:04:46 +0000 (17:04 -0700)]
Fix bugs in file timestamp newness comparisons.
* fileio.c (Ffile_newer_than_file_p):
* lread.c (Fload): Use full timestamp resolution of files,
not just the 1-second resolution, so that files that are only
slightly newer still count as newer.
* fileio.c (Ffile_newer_than_file_p): Don't assume file
timestamps fit in 'int'; this fixes a Y2038 bug on most hosts.
Fix block vector allocation code to allow VECTOR_BLOCK_SIZE
values which aren't power of 2.
* alloc.c (VECTOR_FREE_LIST_SIZE_MASK): New macro. Verify
it's value and the value of VECTOR_BLOCK_SIZE. Adjust users
accordingly.
* alloc.c (allocate_vector_block): Remove redundant
calls to mallopt if DOUG_LEA_MALLOC is defined.
(allocate_vectorlike): If DOUG_LEA_MALLOC is defined,
avoid calls to mallopt if zero_vector is returned.
* xml.el: Protect parser against XML bombs.
(xml-entity-expansion-limit): New variable.
(xml-parse-string, xml-substitute-special): Use it.
(xml-parse-dtd): Avoid infloop if the DTD is not terminated.
Cleanup basic buffer management.
* buffer.h (struct buffer): Change layout to use generic vector
marking code. Fix some comments. Change type of 'clip_changed'
to bitfield. Remove unused #ifndef old.
(FIRST_FIELD_PER_BUFFER, LAST_FIELD_PER_BUFFER): Remove.
(GET_OVERLAYS_AT): Fix indentation.
(for_each_per_buffer_object_at): New macro.
* buffer.c (clone_per_buffer_values, reset_buffer_local_variables)
(Fbuffer_local_variables): Use it.
(init_buffer_once, syms_of_buffer): Remove unused #ifndef old.
* alloc.c (allocate_buffer): Adjust to match new layout of
struct buffer. Fix comment.
(mark_overlay): New function.
(mark_buffer): Use it. Use mark_vectorlike to mark normal
Lisp area of struct buffer.
(mark_object): Use it. Adjust marking of misc objects
and related comments.
* lisp/xml.el: Handle entity and character reference expansion correctly.
(xml-default-ns): New variable.
(xml-entity-alist): Use XML spec definitions for lt and amp.
(xml-parse-region): Make first two arguments optional. Discard
text properties.
(xml-parse-tag-1): New function, spun off from xml-parse-tag. All
callers changed.
(xml-parse-tag): Call xml-parse-tag-1. For backward
compatibility, this function should not modify buffer contents.
(xml-parse-tag-1): Fix opening-tag regexp.
(xml-parse-string): Rewrite, handling entity and character
references properly.
(xml--entity-replacement-text): Signal an error if a parameter
entity is undefined.
* test/automated/xml-parse-tests.el (xml-parse-tests--data): More
testcases.