Eli Zaretskii [Tue, 25 Sep 2012 12:44:13 +0000 (14:44 +0200)]
Followup to not using maybe_unify_char in processing buffers and strings.
src/coding.c (CHAR_STRING_ADVANCE_NO_UNIFY): Make it an alias of
CHAR_STRING_ADVANCE.
(STRING_CHAR_ADVANCE_NO_UNIFY): Make it an alias of
STRING_CHAR_ADVANCE.
Eli Zaretskii [Tue, 25 Sep 2012 11:50:01 +0000 (13:50 +0200)]
Fix handling of fatal signals and exceptions on MS-Windows.
src/w32proc.c (sys_signal): Handle all signals defined by the
MS-Windows runtime, not just SIGCHLD. Actually install the signal
handlers for signals supported by Windows. Don't override
term_ntproc as the handler for SIGABRT.
(sigaction): Rewrite to call sys_signal instead of duplicating its
code.
(sys_kill): Improve commentary.
src/w32.c (term_ntproc): Accept (and ignore) one argument, for
consistency with a signature of a signal handler. All callers
changed.
(init_ntproc): Accept an argument DUMPING. If dumping, don't
install term_ntproc as a signal handler for SIGABRT, as that
should be done by the dumped Emacs.
src/w32.h (init_ntproc, term_ntproc): Adjust prototypes.
src/w32select.c (term_w32select): Protect against repeated
invocation by setting clipboard_owner to NULL after calling
DestroyWindow.
src/emacs.c (shut_down_emacs, main): Adapt the calls to init_ntproc
and term_ntproc to their modified signatures.
Martin Rudalics [Tue, 25 Sep 2012 08:20:05 +0000 (10:20 +0200)]
Improve resizing of minibuffer windows (Bug#12419).
* window.el (window--resize-child-windows): When resizing child
windows proportionally, process them in reverse order to
preserve the "when splitting a window the new one gets the odd
line" behavior.
(window--resize-root-window-vertically): When resizing the
minibuffer window try to affect only windows at the bottom of the
frame. (Bug#12419)
Eli Zaretskii [Tue, 25 Sep 2012 07:01:52 +0000 (09:01 +0200)]
Don't call MAYBE_UNIFY_CHAR while processing buffers and strings.
src/character.c (char_string, string_char): Remove calls to
MAYBE_UNIFY_CHAR. See the discussion starting at
http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00433.html
for the details.
* lisp/iswitchb.el (iswitchb-read-buffer): Move code of
iswitchb-define-mode-map here, and delete that obsolete function.
* lisp/subr.el (eval-next-after-load, makehash, insert-string)
(assoc-ignore-representation, assoc-ignore-case): Use declare to
mark obsolete.
(mode-line-inverse-video): Variable deleted.
* lisp/emacs-lisp/byte-run.el (make-obsolete): Doc fix; emphasize that
this applies to functions.
* lisp/erc/erc.el (erc-send-command): Use define-obsolete-function-alias.
* lisp/font-lock.el (font-lock-reference-face): Use
define-obsolete-variable-alias.
* lisp/international/mule.el (set-char-table-default): Remove.
(set-coding-priority, make-coding-system, generic-char-p)
(charset-list, charset-bytes, charset-id): Use declare to mark
obsolete.
* lisp/mail/supercite.el (sc-version): Remove obsolete function.
(sc-describe): Don't mark as obsolete, since it is bound.
(sc-submit-bug-report): Remove.
Paul Eggert [Sun, 23 Sep 2012 22:25:22 +0000 (15:25 -0700)]
Move pid_t related decls out of lisp.h.
* lisp.h, syswait.h (record_child_status_change, wait_for_termination)
(interruptible_wait_for_termination):
Move these decls from lisp.h to syswait.h, since they use pid_t.
Needed on FreeBSD; see Herbert J. Skuhra in
<http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00571.html>.
* callproc.c: Include syswait.h.
Eli Zaretskii [Sun, 23 Sep 2012 17:34:30 +0000 (19:34 +0200)]
Clean-up left-overs after 2012-09-23T08:44:20Z!eggert@cs.ucla.edu wrt signal handling.
src/.gdbinit: Set breakpoint on terminate_due_to_signal, not on
fatal_error_backtrace.
src/w32proc.c (sys_kill): Undo last change: don't do anything when
invoked to deliver SIGABRT to our own process. This is now
handled by emacs_raise.
nt/inc/ms-w32.h (emacs_raise): Redefine to invoke emacs_abort.
Paul Eggert [Sun, 23 Sep 2012 17:05:14 +0000 (10:05 -0700)]
Do not use SA_NODEFER.
Problem reported by Dani Moncayo in
<http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00557.html>.
* alloc.c (die):
* sysdep.c (emacs_abort): Do not reset signal handler.
* emacs.c (terminate_due_to_signal): Reset signal handler here.
* sysdep.c (init_signals): Do not use SA_NODEFER. It wasn't
wanted even on POSIXish hosts, and it doesn't work on Windows.
Remove LIBRARIES arg from w32_delayed_load and friends.
These always use Vdynamic_library_alist anyway.
* src/image.c (Finit_image_library, lookup_image_type)
(define_image_type): Remove now-unneeded second arg.
(init_xpm_functions, init_png_functions, init_jpeg_functions)
(init_tiff_functions, init_gif_functions, init_svg_functions):
Arglist and w32_delayed_load calling convention changed.
(gs_type): Remove init_gs_functions; there is no such function.
Paul Eggert [Sun, 23 Sep 2012 08:44:20 +0000 (01:44 -0700)]
Simplify and avoid signal-handling races.
* nt/inc/ms-w32.h (emacs_raise): New macro.
* src/alloc.c (die):
* src/sysdep.c (emacs_abort) [HAVE_NTGUI]:
Avoid recursive loop if there's a fatal error in the function itself.
* src/atimer.c (pending_atimers):
* src/blockinput.h: Don't include "atimer.h"; no longer needed.
(interrupt_input_pending): Remove. All uses removed.
pending_signals now counts both atimers and ordinary interrupts.
This is less racy than having three separate pending-signal flags.
(block_input, unblock_input, totally_unblock_input, unblock_input_to)
(input_blocked_p):
Rename from their upper-case counterparts BLOCK_INPUT,
UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT, UNBLOCK_INPUT_TO,
INPUT_BLOCKED_P, and turn into functions. All uses changed.
This makes it easier to access volatile variables more accurately.
(BLOCK_INPUT_RESIGNAL): Remove. All uses replaced by unblock_input ().
(input_blocked_p): Prefer this to 'interrupt_input_blocked', as
that's more reliable if the code is buggy and sets
interrupt_input_blocked to a negative value. All uses changed.
* src/atimer.c (deliver_alarm_signal):
Remove. No need to deliver this to the parent; any thread can
handle this signal now. All uses replaced by underlying handler.
* src/atimer.c (turn_on_atimers):
* src/dispnew.c (handle_window_change_signal):
* src/emacs.c (handle_danger_signal):
* src/keyboard.c (kbd_buffer_get_event):
Don't reestablish signal handler; not needed with sigaction.
* src/blockinput.h (UNBLOCK_INPUT_TO, TOTALLY_UNBLOCK_INPUT)
(UNBLOCK_INPUT_TO):
Rework to avoid unnecessary accesses to volatile variables.
(UNBLOCK_INPUT_TO): Now a function.
(totally_unblock_input, unblock_input): New decls.
* src/data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c
(init_data): Remove. Necessary stuff now done in init_signal.
* src/emacs.c, src/xdisp.c: Include "atimer.h", since we invoke atimer functions.
* src/emacs.c (handle_fatal_signal, deliver_fatal_signal): Move to sysdep.c.
(fatal_error_code): Remove; no longer needed.
(terminate_due_to_signal): Rename from fatal_error_backtrace, since
it doesn't always backtrace. All uses changed. No need to reset
signal to default, since sigaction and/or die does that for us now.
Use emacs_raise (FOO), not kill (getpid (), FOO).
(main): Check more-accurately whether we're dumping.
Move fatal-error setup to sysdep.c
* src/floatfns.c: Do not include "syssignal.h"; no longer needed.
* src/gtkutil.c (xg_get_file_name, xg_get_font):
Remove no-longer-needed signal-mask manipulation.
* src/keyboard.c, src/process.c (POLL_FOR_INPUT):
Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined.
* src/keyboard.c (read_avail_input): Remove.
All uses replaced by gobble_input.
(Ftop_level): Use TOTALLY_UNBLOCK_INPUT rather than open code.
(kbd_buffer_store_event_hold, gobble_input):
(record_asynch_buffer_change) [USABLE_SIGIO]:
(store_user_signal_events):
No need to mess with signal mask.
(gobble_input): If blocking input and there are terminals, simply
set pending_signals to 1 and return. All hooks changed to not
worry about whether input is blocked.
(process_pending_signals): Clear pending_signals before processing
them, in case a signal comes in while we're processing.
By convention callers now test pending_signals before calling us.
(UNBLOCK_INPUT_TO, unblock_input, totally_unblock_input):
New functions, to support changes to blockinput.h.
(handle_input_available_signal): Now extern.
(reinvoke_input_signal): Remove. All uses replaced by
handle_async_input.
(quit_count): Now volatile, since a signal handler uses it.
(handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg. All
callers changed. Block SIGINT only if not already blocked.
Clear sigmask reliably, even if Fsignal returns, which it can.
Omit unnecessary accesses to volatile var.
(quit_throw_to_read_char): No need to restore sigmask.
* src/keyboard.c (gobble_input, handle_user_signal):
* src/process.c (wait_reading_process_output):
Call signal-handling code rather than killing ourselves.
* src/lisp.h: Include <float.h>, for...
(IEEE_FLOATING_POINT): New macro, moved here to avoid duplication.
(pending_signals): Now volatile.
(syms_of_data): Now const if IEEE floating point.
(handle_input_available_signal) [USABLE_SIGIO]:
(terminate_due_to_signal, record_child_status_change): New decls.
* src/process.c (create_process): Avoid disaster if memory is exhausted
while we're processing a vfork, by tightening the critical section
around the vfork.
(send_process_frame, process_sent_to, handle_pipe_signal)
(deliver_pipe_signal): Remove. No longer needed, as Emacs now
ignores SIGPIPE.
(send_process): No need for setjmp/longjmp any more, since the
SIGPIPE stuff is now gone. Instead, report an error if errno
is EPIPE.
(record_child_status_change): Now extern. PID and W are now args.
Return void, not bool. All callers changed.
* src/sysdep.c (wait_debugging) [(BSD_SYSTEM || HPUX) && !defined (__GNU__)]:
Remove. All uses removed. This bug should be fixed now in a
different way.
(wait_for_termination_1): Use waitpid rather than sigsuspend,
and record the child status change directly. This avoids the
need to futz with the signal mask.
(process_fatal_action): Move here from emacs.c.
(emacs_sigaction_flags): New function, containing
much of what used to be in emacs_sigaction_init.
(emacs_sigaction_init): Use it. Block nonfatal system signals that are
caught by emacs, to make races less likely.
(deliver_process_signal): Rename from handle_on_main_thread.
All uses changed.
(BACKTRACE_LIMIT_MAX): Now at top level.
(thread_backtrace_buffer, threadback_backtrace_pointers):
New static vars.
(deliver_thread_signal, deliver_fatal_thread_signal):
New functions, for more-accurate delivery of thread-specific signals.
(handle_fatal_signal, deliver_fatal_signal): Move here from emacs.c.
(deliver_arith_signal): Handle in this thread, not
in the main thread, since it's triggered by this thread.
(maybe_fatal_sig): New function.
(init_signals): New arg DUMPING so that we can be more accurate
about whether we're dumping. Caller changed.
Treat thread-specific signals differently from process-general signals.
Block all signals while handling fatal error; that's safer.
xsignal from SIGFPE only on non-IEEE hosts, treating it as fatal
on IEEE hosts.
When batch, ignore SIGHUP, SIGINT, SIGTERM if they were already ignored.
Ignore SIGPIPE unless batch.
(emacs_backtrace): Output backtrace for the appropriate thread,
which is not necessarily the main thread.
* src/syssignal.h: Include <stdbool.h>.
(emacs_raise): New macro.
* src/xterm.c (x_connection_signal): Remove; no longer needed
now that we use sigaction.
(x_connection_closed): No need to mess with sigmask now.
(x_initialize): No need to reset SIGPIPE handler here, since
init_signals does this for us now.
* src/dispextern.h (struct image_type): Add new slot, storing a type
initialization function.
* src/image.c (define_image_type): Call the image initializer function
if it is defined. Arguments and return value changed.
(valid_image_p, make_image): Callers changed.
(xbm_type, xpm_type, pbm_type, png_type, jpeg_type, tiff_type)
(gif_type, imagemagick_type, svg_type, gs_type): Add
initialization functions.
(Finit_image_library): Call lookup_image_type.
(CHECK_LIB_AVAILABLE): Macro deleted.
(lookup_image_type): Call define_image_type here, rather than via
Finit_image_library, and without using CHECK_LIB_AVAILABLE.
(syms_of_image): Move define_image_type calls for xbm_type and
pbm_type to lookup_image_type.
Eli Zaretskii [Sat, 22 Sep 2012 13:16:03 +0000 (16:16 +0300)]
Fix bugs #12447 and #12326 with infloop causes by idle timers, update docs.
src/keyboard.c (timer_check_2): Move calculation of 'timers' and
'idle_timers' from here ...
(timer_check): ... to here. Use Fcopy_sequence to copy the timer
lists, to avoid infloops when the timer does something stupid,
like reinvoke itself with the same or smaller time-out.
lisp/emacs-lisp/timer.el (run-with-idle-timer)
(timer-activate-when-idle): Warn against reinvoking an idle timer
from within its own timer action.
doc/lispref/os.texi (Idle Timers): Warn against reinvoking an idle timer
from within its own timer action.
Martin Rudalics [Sat, 22 Sep 2012 12:56:08 +0000 (14:56 +0200)]
Make Temp Buffer Resize Mode less intrusive (Bug#1806).
* window.c (Fsplit_window_internal): Handle only Qt value of
Vwindow_combination_limit separately.
(Qtemp_buffer_resize): New symbol.
(Vwindow_combination_limit): New default value. Rewrite
doc-string.
* cus-start.el (window-combination-limit): Add new optional
values.
* window.el (temp-buffer-window-show)
(window--try-to-split-window): Obey new values of
window-combination-limit.
(split-window): Test window-combination-limit for t instead of
non-nil.
(display-buffer-at-bottom): New buffer display action function.
* help.el (temp-buffer-resize-regexps): New option.
(temp-buffer-resize-mode): Rewrite doc-string.
(resize-temp-buffer-window): Obey temp-buffer-resize-regexps.
Don't resize reused window. Suggested by Glen Morris.
Eli Zaretskii [Sat, 22 Sep 2012 12:31:05 +0000 (15:31 +0300)]
Fix bug #10159 with crashes in auto-complete package.
src/xdisp.c (next_overlay_string): Initialize it->end_charpos for
the new overlay string. Otherwise, the call to composition_compute_stop_pos
in compute_stop_pos uses a wrong it->end_charpos value, and crashes because
it runs off the end of the overlay string.
Stefan Merten [Sat, 22 Sep 2012 09:16:00 +0000 (11:16 +0200)]
* rst.el: Revamp section title faces.
(rst-official-version)
(rst-package-emacs-version-alist): Sync with official version
V1.4.0.
(rst-faces-defaults, rst-set-level-default)
(rst-level-face-max, rst-level-face-base-color)
(rst-level-face-base-light, rst-level-face-format-light)
(rst-level-face-step-light, rst-define-level-faces): Obsolete.
(rst-adornment-faces-alist): Match new setup.
(rst-level-1, rst-level-2, rst-level-3, rst-level-4)
(rst-level-5, rst-level-6): New faces.
Juri Linkov [Thu, 20 Sep 2012 21:57:13 +0000 (00:57 +0300)]
* lisp/replace.el (query-replace-read-from): Use `read-regexp' instead
of `read-from-minibuffer' when `regexp-flag' is non-nil.
(occur-read-primary-args): Use `read-regexp' instead of
`read-string'.
(multi-occur-in-matching-buffers): Use `read-regexp' instead of
`read-from-minibuffer'.
* lisp/isearch.el (isearch-occur): Use `read-regexp' instead of
`read-string'.
* lisp/dired.el (dired-read-regexp): Use `read-regexp' instead of
`read-from-minibuffer'.
* lisp/progmodes/grep.el (grep-read-regexp): Use `read-regexp' instead
of `read-string'.
Juri Linkov [Thu, 20 Sep 2012 21:35:40 +0000 (00:35 +0300)]
* lisp/replace.el (read-regexp): Rename DEFAULT-VALUE arg to DEFAULTS
and allow accepting a list of strings prepended to a list of
standard default values. Doc fix.
Stefan Monnier [Thu, 20 Sep 2012 13:46:36 +0000 (09:46 -0400)]
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning): New function.
(macroexp--expand-all): Use it.
(macroexp--funcall-and-return): Remove by folding it into its sole
caller (macroexp--warn-and-return).
* lisp/emacs-lisp/bytecomp.el (byte-compile-warn-obsolete):
Use macroexp--obsolete-warning.
Stefan Monnier [Thu, 20 Sep 2012 03:10:52 +0000 (23:10 -0400)]
* src/alloc.c (mark_object) <PVEC_WINDOW>: Mark prev/next_buffers *after*
calling mark_vectorlike since that's the one that marks the window.
(mark_discard_killed_buffers): Mark the final cdr.
* src/window.h (struct window): Move prev/next_buffers to the
non-standard fields.
* src/window.c (make_window): Initialize prev/next_buffers manually.
Juri Linkov [Wed, 19 Sep 2012 20:09:55 +0000 (23:09 +0300)]
* lisp/dired-aux.el (dired-diff): Add (require 'diff) because
`diff-latest-backup-file' is not autoloaded.
(dired-do-chxxx, dired-do-chmod): Set `no-error-if-not-filep' arg
of `dired-get-filename' to t to not report error when there is
no default file on the current line.
Stefan Monnier [Wed, 19 Sep 2012 19:59:52 +0000 (15:59 -0400)]
* lisp/emacs-lisp/macroexp.el (macroexp--funcall-if-compiled): Rename from
macroexp--eval-if-compile.
(macroexp--funcall-and-return, macroexp--warn-and-return): New funs.
(macroexp--expand-all): Use them.
New feature: set optimal slice from BoundingBox information.
* doc-view.el (doc-view-mode-map): Add keybinding.
(doc-view-menu): Add menu entry.
(doc-view-set-slice): Adapt docstring.
(doc-view-get-bounding-box, doc-view-guess-paper-size)
(doc-view-scale-bounding-box)
(doc-view-set-slice-from-bounding-box): New functions.
(doc-view-paper-sizes): New defvar.
* doc/emacs/misc.texi (DocView Slicing): Document new slice from
BoundingBox feature.