Paul Eggert [Fri, 23 Aug 2013 17:57:07 +0000 (10:57 -0700)]
Don't let very long directory names overrun the stack.
Fix some related minor problems involving "//", vfork.
* callproc.c (encode_current_directory): New function.
(call_process): Don't append "/"; not needed.
* fileio.c (file_name_as_directory_slop): New constant.
(file_name_as_directory): Allow SRC to be longer than SRCLEN;
this can save the caller having to alloca.
(Ffile_name_as_directory, Fdirectory_file_name, Fexpand_file_name):
Use SAFE_ALLOCA, not alloca.
(directory_file_name, Fexpand_file_name): Leave leading "//"
alone, since it can be special even on POSIX platforms.
* callproc.c (call_process):
* process.c (Fformat_network_address):
* sysdep.c (sys_subshell):
Use encode_current_directory rather than rolling our own.
(create_process): No need to encode directory; caller does that now.
* process.h (encode_current_directory): New decl.
* sysdep.c (sys_subshell): Work even if vfork trashes saved_handlers.
Rework to avoid 'goto xyzzy;'.
Stefan Monnier [Fri, 23 Aug 2013 15:21:19 +0000 (11:21 -0400)]
* lisp/calc/calc-keypd.el (calc-keypad-execute): `x-flush-mouse-queue' doesn't
exist any more.
(calc-keypad-redraw): Remove unused var `pad'.
(calc-keypad-press): Remove unused var `menu'.
Martin Rudalics [Fri, 23 Aug 2013 06:52:19 +0000 (08:52 +0200)]
In display-buffer-pop-up-frame make BUFFER current (Bug#15133).
* window.el (display-buffer-pop-up-frame): Call pop-up-frame-function
with BUFFER current so `make-frame' will use it as the new frame's
buffer (Bug#15133).
Dmitry Antipov [Fri, 23 Aug 2013 04:03:25 +0000 (08:03 +0400)]
Minor cleanup for redisplay interface and few related functions.
* frame.h (enum text_cursor_kinds): Move from here...
* dispextern.h (enum text_cursor_kinds): ...to here.
(toplevel): Drop unnecessary declarations.
(struct redisplay_interface): Use bool and enum text_cursor_kinds
in update_window_end_hook and draw_window_cursor functions.
(display_and_set_cursor, x_update_cursor): Adjust prototypes.
* nsterm.m (ns_update_window_end, ns_draw_window_cursor):
* w32term.c (x_update_window_end,w32_draw_window_cursor):
* xterm.c (x_update_window_end, x_draw_window_cursor):
* xdisp.c (display_and_set_cursor, update_window_cursor)
(update_cursor_in_window_tree, x_update_cursor): Use bool and
enum text_cursor_kinds where appropriate.
This improves on the patch already installed, by quoting options
that contain spaces and suchlike systematically, so that
EMACS_CONFIG_OPTIONS is no longer ambiguous when options contain
these characters.
Stefan Monnier [Thu, 22 Aug 2013 04:06:45 +0000 (00:06 -0400)]
* lisp/erc/erc.el: Use lexical-binding.
(erc-user-full-name): Minor CSE simplification.
(erc-mode-map): Assume command-remapping is available.
(erc-once-with-server-event): Replace `forms' arg with a function arg.
(erc-once-with-server-event-global): Remove.
(erc-ison-p): Adjust to change in erc-once-with-server-event.
(erc-get-buffer-create): Remove arg `proc'.
(iswitchb-make-buflist-hook): Declare.
(erc-setup-buffer): Use pcase; avoid ((lambda ..) ..).
(read-passwd): Assume it exists.
(erc-display-line, erc-cmd-IDLE): Avoid add-to-list, adjust to change
in erc-once-with-server-event.
(erc-cmd-JOIN, erc-set-channel-limit, erc-set-channel-key)
(erc-add-query): Minor CSE simplification.
(erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Adjust to change
in erc-once-with-server-event.
(erc-echo-notice-in-user-and-target-buffers): Avoid add-to-list.
* lisp/erc/erc-track.el: Use lexical-binding.
(erc-make-mode-line-buffer-name): Use closures instead of `(lambda...).
(erc-faces-in): Avoid add-to-list.
* lisp/erc/erc-notify.el: Use lexical-binding.
(erc-notify-timer): Adjust to change in erc-once-with-server-event.
(erc-notify-QUIT): Use a closure instead of `(lambda...).
* lisp/erc/erc-list.el: Use lexical-binding.
(erc-list-install-322-handler, erc-cmd-LIST): Adjust to change in
erc-once-with-server-event.
* lisp/erc/erc-button.el: Use lexical-binding.
(erc-button-next-function): Use a closure instead of `(lambda...).
Stefan Monnier [Thu, 22 Aug 2013 01:09:08 +0000 (21:09 -0400)]
* lisp/calendar/timeclock.el: Minor cleanups.
(timeclock-ask-before-exiting, timeclock-use-display-time): Use `symbol'.
(timeclock-modeline-display): Define as alias before the actual definition.
(timeclock-mode-line-display): Use define-minor-mode.
(timeclock-day-list-template): Make it a function, add an argument.
(timeclock-day-list-required, timeclock-day-list-length)
(timeclock-day-list-debt, timeclock-day-list-span)
(timeclock-day-list-break): Adjust calls accordingly.
Paul Eggert [Wed, 21 Aug 2013 21:27:30 +0000 (14:27 -0700)]
* callproc.c: Fix race that killed background processes.
(call_process): New arg TEMPFILE_INDEX. Callers changed.
Record deleted process-id in critical section, not afterwards.
Don't mistakenly kill process created by a call-process invocation
that discards output and does not wait.
David Engster [Wed, 21 Aug 2013 19:42:52 +0000 (21:42 +0200)]
Imported EIEIO test suite from CEDET upstream
* automated/eieio-tests.el, automated/eieio-test-persist.el:
* automated/eieio-test-methodinvoke.el: EIEIO tests from CEDET
upstream. Changed to use ERT.
Dmitry Antipov [Wed, 21 Aug 2013 07:02:45 +0000 (11:02 +0400)]
Fix compilation with GC_MARK_STACK == GC_USE_GCPROS_AS_BEFORE
and GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES.
* alloc.c (toplevel): Remove unnecessary nested #if...#endif.
(mark_maybe_object) [!GC_MARK_STACK]: Define to emacs_abort
to shut up compiler in mark_object.
(dump_zombies): Convert to global and add EXTERNALLY_VISIBLE.
Paul Eggert [Wed, 21 Aug 2013 06:11:50 +0000 (23:11 -0700)]
Port close-on-exec pty creation to FreeBSD 9.1-RELEASE.
* configure.ac (PTY_OPEN): If posix_openpt with O_CLOEXEC fails
and reports EINVAL, try it again without O_CLOEXEC. This should
port PTY_OPEN to FreeBSD 9, which stupidly rejects O_CLOEXEC.
What were they thinking?
Paul Eggert [Tue, 20 Aug 2013 00:51:35 +0000 (17:51 -0700)]
* image.c (SIGNATURE_DIGESTSIZE): Remove.
(struct animation_cache): Make signature a flexible array member.
All uses changed. This is a tad slower but may insulate us better
from future changes to ImageMagick.
Paul Eggert [Mon, 19 Aug 2013 20:47:27 +0000 (13:47 -0700)]
* image.c: Shrink memory needed for animation cache.
(SIGNATURE_DIGESTSIZE): New constant.
(struct animation_cache): Make 'signature' a fixed size array of bytes.
(imagemagick_create_cache): Copy the signature. This saves
several KB of memory that ImageMagick wastes per signature.
Don't bother updating the update_time, as the caller does that now.
(imagemagick_prune_animation_cache): Don't destroy the signature, as
it's a fixed size struct member now.
(imagemagick_get_animation_cache): Always destroy the signature,
as it's now imagemagick_create_cache's responsibility to copy it.
Avoid duplicate calls to strcmp and to imagemagick_create_cache,
and use memcmp rather than strcmp.
eassert that ImageMagick returns a signature of the specified length.
Fix some other minor performance problems while we're at it.
(imagemagick_create_cache): Clear just the members that
need clearing. Don't set update_time, as caller does that now.
(imagemagick_prune_animation_cache, imagemagick_get_animation_cache):
Simplify by using pointer-to-pointer instead of a prev pointer.
(imagemagick_prune_animation_cache): Use make_emacs_time rather
than EMACS_TIME_FROM_DOUBLE, and DestroyString rather than free.
(imagemagick_get_animation_cache): Don't xstrdup the image signature;
it's already a copy. Free the signature probe unless it's cached.
Ken Brown [Sun, 18 Aug 2013 17:37:31 +0000 (13:37 -0400)]
Change size of static heap on Cygwin; report maximum usage after dumping.
* src/sheap.c (STATIC_HEAP_SIZE): Adjust to current needs; use bigger
static heap if ENABLE_CHECKING is defined.
(max_bss_sbrk_ptr): New variable.
(bss_sbrk): Use it.
(report_sheap_usage): Report maximum static heap usage instead of
ending static heap usage.