Eli Zaretskii [Fri, 30 May 2014 09:02:55 +0000 (12:02 +0300)]
Enhance error checking in heap allocation routines on MS-Windows.
src/w32heap.c (malloc_before_dump, malloc_after_dump)
(malloc_before_dump, realloc_after_dump, realloc_before_dump)
(mmap_alloc, mmap_realloc): Check for errors more thoroughly and
set errno where appropriate to emulate CRT functions.
Dmitry Antipov [Fri, 30 May 2014 07:40:29 +0000 (11:40 +0400)]
Debugging facility to check whether 'const char *' points to
relocatable data of non-pure Lisp string.
* alloc.c (maybe_lisp_pointer): New function, refactored out of ...
(mark_maybe_pointer): ... adjusted user.
(relocatable_string_data_p): New function.
* lisp.h (relocatable_string_data_p): Add prototype.
* xdisp.c (message_with_string): If ENABLE_CHECKING, make sure
the pointer to relocatable Lisp data is not used.
Paul Eggert [Fri, 30 May 2014 04:12:08 +0000 (21:12 -0700)]
Don't let SIGINT handling block SIGCHLD indefinitely.
* atimer.c (block_atimers):
* callproc.c (block_child_signal): Block SIGINT too;
otherwise, its handler might now unblock signals that it shouldn't.
* keyboard.c (read_char): Clear signal mask, since we may
be in a SIGINT handler, and many signals may be masked.
* keyboard.c (handle_interrupt):
* sysdep.c (handle_arith_signal):
Clear signal mask instead of just unblocking the signal that
was received, since several signals may be blocked at this point.
nt/Makefile.in (DONT_INSTALL): Now empty.
(addsection${EXEEXT}): Remove target.
nt/addsection.c: File removed.
src/Makefile.in (TEMACS_POST_LINK): Remove target.
(emacs$(EXEEXT)): Remove $(ADDSECTION) from prerequisites.
(temacs$(EXEEXT)): Remove $(TEMACS_POST_LINK) from the recipe.
Paul Eggert [Thu, 29 May 2014 15:05:06 +0000 (08:05 -0700)]
Don't substitute sigprocmask for pthread_sigmask.
sigprocmask isn't portable in a multithreaded process.
* configure.ac (gl_THREADLIB): Remove dummy.
Merge from gnulib, incorporating:
2014-05-28 pthread_sigmask, timer-time: use gl_THREADLIB only if needed
* m4/pthread_sigmask.m4, m4/timer_time.m4: Update from gnulib.
* src/Makefile.in (LIB_PTHREAD_SIGMASK): Remove; all uses removed.
Eli Zaretskii [Thu, 29 May 2014 14:52:47 +0000 (17:52 +0300)]
Fix bug #17622 with crashes in mmap routines.
src/buffer.c (init_buffer): Accept an argument 'initialized'.
[USE_MMAP_FOR_BUFFERS]: If 'initialized' is non-zero, reset
mmap_regions and mmap_fd, to avoid referencing stale data from the
dump phase. Add an assertion for buffer text of buffers created
in temacs before this function is called.
(mmap_regions_1, mmap_fd_1): Remove unused variables.
src/lisp.h (init_buffer): Update prototype.
src/emacs.c (main): Pass 'initialized' as the argument to init_buffer.
Stefan Monnier [Thu, 29 May 2014 03:54:37 +0000 (23:54 -0400)]
* lisp/whitespace.el: Use font-lock-flush. Minimize refontifications.
Side benefit: it works without jit-lock.
(whitespace-point--used): New buffer-local var.
(whitespace-color-on): Initialize it and flush it. Use font-lock-flush.
(whitespace-color-off): Use font-lock-flush.
(whitespace-point--used, whitespace-point--flush-used): New functions.
(whitespace-trailing-regexp, whitespace-empty-at-bob-regexp)
(whitespace-empty-at-eob-regexp): Use them.
(whitespace-post-command-hook): Rewrite.
Dmitry Antipov [Wed, 28 May 2014 08:00:10 +0000 (12:00 +0400)]
On X, always make pointer visible when deleting frame (Bug#17609).
* frame.c (frame_make_pointer_visible, frame_make_pointer_invisible):
Pass frame as arg.
* frame.h (frame_make_pointer_visible, frame_make_pointer_invisible):
Adjust prototypes.
* cmds.c (Fself_insert_command): Use SELECTED_FRAME.
* keyboard.c (gobble_input): If there is no terminal input error,
make sure the pointer is visible for all frames on this terminal.
* xterm.c (x_free_frame_resources): Always enable pointer visibility.
Stefan Monnier [Wed, 28 May 2014 00:50:44 +0000 (20:50 -0400)]
* lisp/subr.el (zerop): Move from C. Add compiler-macro.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-zerop): Remove.
* src/data.c (Fzerop): Move to Elisp.
(syms_of_data): Don't defsubr it.
* src/keyboard.c (echo_keystrokes_p): New function.
(read_char, record_menu_key, read_key_sequence): Use it.
Stefan Monnier [Wed, 28 May 2014 00:09:14 +0000 (20:09 -0400)]
* src/callint.c (Ffuncall_interactively): New function.
(Qfuncall_interactively): New var.
(Qcall_interactively): Remove.
(Fcall_interactively): Use it.
(syms_of_callint): Defsubr it.
* lisp/subr.el (internal--funcall-interactively): New.
(internal--call-interactively): Remove.
(called-interactively-p): Detect funcall-interactively instead of
call-interactively.
* lisp/simple.el (repeat-complex-command): Use funcall-interactively.
(repeat-complex-command--called-interactively-skip): Remove.
Fabrice Popineau [Tue, 27 May 2014 17:31:17 +0000 (20:31 +0300)]
Use mmap(2) emulation for buffer text on MS-Windows.
src/Makefile.in (C_HEAP_SWITCH): Get the predefined heap size from
configure.
(ADDSECTION, MINGW_TEMACS_POST_LINK): Remove, no longer used.
src/lisp.h (NONPOINTER_BITS): Modify the condition to define to zero
for MinGW, since it no longer uses gmalloc.
src/buffer.c: Do not define mmap allocations functions for Windows.
Remove mmap_find which is unused. Remove mmap_set_vars which does
nothing useful.
[WINDOWSNT]: Include w32heap.h.
(init_buffer): Always allocate new memory for buffers.
src/emacs.c: Remove mmap_set_vars calls.
src/image.c (free_image): Undef free for Windows because it is
redirected to our private version.
src/unexw32.c (COPY_PROC_CHUNK): Use %p format for 64bits
compatibility.
(copy_executable_and_dump_data): Remove dumping the heap section.
(unexec): Restore using_dynamic_heap after dumping.
src/w32heap.c (dumped_data_commit, malloc_after_dump)
(malloc_before_dump, realloc_after_dump, realloc_before_dump)
(free_after_dump, free_before_dump, mmap_alloc, mmap_realloc)
(mmap_free): New functions.
src/w32heap.h: Declare dumped_data and mmap_* function prototypes.
nt/inc/ms-w32.h: Switch to the system heap allocation scheme
instead of GNU malloc and ralloc.
nt/inc/sys/mman.h: New file.
nt/INSTALL: Update for the new build requirements.
etc/NEWS: Mention build changes on MS-Windows.
configure.ac (C_HEAP_SWITCH) define for different values of
dumped heap size depending on 32/64bits arch on Windows.
Don't check for pthreads.h on MinGW32/64, it gets in the way.
Use mmap(2) for buffers and system malloc for MinGW32/64.
Stefan Monnier [Tue, 27 May 2014 14:28:07 +0000 (10:28 -0400)]
* test/indent/ps-mode.ps: New file.
* test/automated/core-elisp-tests.el
(core-elisp-test-window-configurations): New test.
* test/indent/octave.m: Add a few more tests.
* test/indent/ruby.rb: Add one more test.
Paul Eggert [Tue, 27 May 2014 03:46:30 +0000 (20:46 -0700)]
Don't kill already-reaped process.
* process.c (process_send_signal): Fix race condition where a
subprocess was reaped by a signal handler between the check for
liveness and calling 'kill', which meant that Emacs could in
theory kill an innocent bystander process. Do the fix by blocking
SIGCHLD in a critical section that checks liveness before killing.
Thien-Thi Nguyen [Sun, 25 May 2014 16:53:28 +0000 (18:53 +0200)]
Arrange to never byte-compile the generated -pkg.el file.
* lisp/emacs-lisp/package.el (package-generate-description-file):
Output first-line comment to set buffer-local var `no-byte-compile'.
Suggested by Dmitry Gutov:
<http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00401.html>.
Thien-Thi Nguyen [Sun, 25 May 2014 16:32:08 +0000 (18:32 +0200)]
Fix bug: Properly quote args to generated -pkg.el `define-package'.
* lisp/emacs-lisp/package.el (package-generate-description-file):
Inline `package--alist-to-plist'; rewrite to selectively
quote alist values that are not self-quoting.
(package--alist-to-plist): Delete func.
Stefan Monnier [Sat, 24 May 2014 15:50:05 +0000 (11:50 -0400)]
* src/xdisp.c: Bind inhibit-quit during pre-redisplay-function.
(safe__call, safe__call1, safe__eval): New functions.
(safe_call): Use it.
(prepare_menu_bars): Use it for pre-redisplay-function.
(display_mode_element): Same for `:eval'.
Eli Zaretskii [Sat, 24 May 2014 12:02:25 +0000 (15:02 +0300)]
Avoid marking too deep portions of stack in mark_stack.
src/alloc.c (garbage_collect_1): New function, with all of the guts
of Fgarbage_collect.
(mark_stack): Accept an argument END and don't mark Lisp objects
on the stack beyond the address given by END. Calculation of END
was moved to Fgarbage_collect.
(Fgarbage_collect): Calculate the end address of the stack portion
that needs to be examined by mark_stack, and pass that address to
garbage_collect_1, which will pass it to mark_stack. See
http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00270.html
for more details about the underlying problems. In particular,
this avoids dumping Emacs with the large hash-table whose value is
held in purify-flag for most of the time loadup.el runs.
Jan Djärv [Sat, 24 May 2014 08:41:19 +0000 (10:41 +0200)]
* xfns.c (x_window_property_intern): New function (code from
x_window_property).
(Fx_window_property): Call x_window_property_intern. If property
not found and NILP (source) and outer window != inner window,
check outer window for property.
Stephen Berman [Fri, 23 May 2014 16:54:35 +0000 (18:54 +0200)]
todo-mode.el: Remove dependence on auto-mode-alist.
* calendar/todo-mode.el: Remove dependence on auto-mode-alist,
to avoid errors when trying to create or visit a file foo.todo
located outside to todo-directory, and to allow having such files
without them being tied to Todo mode.
(todo-show, todo-move-category, todo-merge-category, todo-find-archive)
(todo-archive-done-item, todo-find-filtered-items-file)
(todo-filter-items, todo-find-item, todo-diary-goto-entry)
(todo-category-completions, todo-read-category): When visiting a
Todo file, make sure we're in the right mode and the buffer local
variables are set.
(todo-make-categories-list, todo-reset-nondiary-marker)
(todo-reset-done-string, todo-reset-comment-string): After
processing all Todo files, kill the buffers of those files that
weren't being visited before the processing.
(todo-display-as-todo-file, todo-add-to-buffer-list)
(todo-visit-files-commands): Comment out.
(todo-modes-set-3, todo-mode): Comment out additions to find-file-hook.
(auto-mode-alist): Remove add-to-list calls making Todo file
extensions unrestrictedly tied to Todo modes.
* doc/misc/todo-mode.texi: Update in light of changes due to bug#17482.
Replace numerous mistaken uses of literal quotes with proper
Texinfo markup.
(Todo Mode Entry Points): Comment out reference to using find-file
or Dired to visit Todo files, since this has been disabled (bug#17482).
Stefan Monnier [Fri, 23 May 2014 16:17:14 +0000 (12:17 -0400)]
* lisp/emacs-lisp/nadvice.el (advice--member-p): Change second arg.
(advice-function-member-p): Tell it to check both names and functions.
(advice--add-function): Adjust call accordingly.
Stefan Monnier [Fri, 23 May 2014 15:54:44 +0000 (11:54 -0400)]
* lisp/minibuffer.el (completion--sreverse): Remove.
(completion--common-suffix): Use `reverse' instead.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-group): Use `reverse' on strings.
Stephen Berman [Fri, 23 May 2014 12:10:50 +0000 (14:10 +0200)]
* calendar/todo-mode.el: Miscellaneous bug fixes.
(todo-delete-file): When deleting an archive but not its todo
file, make sure to update the todo file's category sexp.
(todo-move-category): Keep the moved category's name unless the
file moved to already has a category with that name. If the
numerically last category of the source file was moved, make the
first category current to avoid selecting a nonexisting category.
(todo-merge-category): Fix implementation to make merging to a
category in another file work as documented. Eliminate now
insufficient and unnecessary renaming of archive category, correct
document string accordingly, and clarify it. If the numerically
last category of the source file was merged, make the first
category current to avoid selecting a nonexisting category.
(todo-archive-done-item): When there are marked items and point
happens to be on an unmarked item, ignore the latter. Don't leave
point below last item after archiving marked items.
(todo-unarchive-items): Fix logic to ensure unarchiving an item
from an archive with only one category deletes the archive only
when the category is empty after unarchiving. Make sure the todo
file's category sexp is updated.
(todo-read-file-name): Allow an existing file name even when it is
not required (todo-move-category needs this to work as documented).
(todo-add-file): Call todo-validate-name to reject the name of an
existing todo file (needed due to fix in todo-read-file-name).
(todo-reset-nondiary-marker): Also reset in filtered items files.
(todo-reset-done-string, todo-reset-comment-string): Also reset in
regexp filtered items files.
(todo-reset-highlight-item): Also reset in filtered items files.
Fix incorrect variable reference in document string.
Paul Eggert [Thu, 22 May 2014 05:00:39 +0000 (22:00 -0700)]
Fix port to 32-bit AIX.
* configure.ac (opsys): On Power Architecture, treat release 7 of
AIX like releases 5 and 6.
* src/unexaix.c (copy_text_and_data): Don't add text_scnptr to ptr
twice. _text already includes this offset.
(unrelocate_symbols): Don't cast 64-bit integer to pointer.
Eli Zaretskii [Wed, 21 May 2014 15:03:18 +0000 (18:03 +0300)]
Fix bug #17539 with infinite recursion during scroll commands.
src/xdisp.c (move_it_in_display_line_to): Avoid infinite recursion:
when closest_pos is identical to to_charpos, don't recurse, since
we already tried that, and failed.
Dmitry Gutov [Wed, 21 May 2014 02:14:38 +0000 (05:14 +0300)]
Replace uses of `save-buffer' with `write-region'
* lisp/emacs-lisp/package.el (package--download-one-archive): Use
`write-region' instead of `save-buffer' to avoid running various
hooks.
(describe-package-1): Same. Insert newline at the end of the
buffer if appropriate.
* lisp/progmodes/sh-script.el (sh-ancestor-alist): Add mksh, a pdksh
derivative.
(sh-alias-alist): Alias /system/bin/sh (Android's system shell) to
mksh. Improve custom spec; allow regular expressions.
(sh-shell): Delegate name splitting to `sh-canonicalize-shell'.
(sh-after-hack-local-variables): New function.
(sh-mode): Use it; respect file-local `sh-shell' variable.
(sh-set-shell): Use `sh-canonicalize-shell' instead of open-coding
the normalization.
(sh-canonicalize-shell): Rewrite to support regexes.
* lisp/progmodes/sh-script.el (sh-ancestor-alist): Add mksh, a pdksh
derivative.
(sh-alias-alist): Alias /system/bin/sh (Android's system shell) to
mksh. Improve custom spec; allow regular expressions.
(sh-shell): Delegate name splitting to `sh-canonicalize-shell'.
(sh-after-hack-local-variables): New function.
(sh-mode): Use it; respect file-local `sh-shell' variable.
(sh-set-shell): Use `sh-canonicalize-shell' instead of open-coding
the normalization.
(sh-canonicalize-shell): Rewrite to support regexes.