Paul Eggert [Thu, 13 Sep 2012 01:22:08 +0000 (18:22 -0700)]
Work around GCC and GNOME bugs when --enable-gcc-warnings.
* emacsgtkfixed.c (G_STATIC_ASSERT): Redefine to use 'verify',
to work around GNOME bug 683906.
* image.c (jpeg_load_body) [HAVE_JPEG && lint]: Pacify gcc -Wclobber.
(struct my_jpeg_error_mgr) [HAVE_JPEG && lint]: New member fp.
This works around GCC bug 54561.
Paul Eggert [Wed, 12 Sep 2012 21:34:24 +0000 (14:34 -0700)]
More fixes for 'volatile' and setjmp/longjmp.
* eval.c (Fdefvar, Fcondition_case): Remove unnecessary 'volatile's.
* image.c (struct png_load_context) [HAVE_PNG]: New type.
(png_load_body) [HAVE_PNG]:
(jpeg_load_body) [HAVE_JPEG]:
New function, with most of the old parent function's body.
(png_load) [HAVE_PNG]:
(jpeg_load) [HAVE_JPEG]:
Invoke the new function, to avoid longjmp munging our locals.
(struct my_jpeg_error_mgr) [HAVE_JPEG]: New members cinfo, failure_code.
(my_error_exit) [HAVE_JPEG]: Don't trust 'setjmp' to return 2 when
longjmp is passed 2, as the C standard doesn't guarantee this.
Instead, store the failure code into mgr->failure_code.
Juri Linkov [Wed, 12 Sep 2012 20:51:46 +0000 (23:51 +0300)]
Use Isearch lax whitespace mode in Info.
http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00811.html
* lisp/info.el (Info-search): Don't check for isearch-mode and
isearch-regexp before let-binding search-spaces-regexp to
Info-search-whitespace-regexp.
(Info-isearch-search): Let-bind Info-search-whitespace-regexp to
search-whitespace-regexp if isearch-lax-whitespace or
isearch-regexp-lax-whitespace is non-nil.
(Info-mode): Don't set local variable search-whitespace-regexp.
Jan Djärv [Wed, 12 Sep 2012 20:21:39 +0000 (22:21 +0200)]
* configure.ac: No --with-x-toolkit given: Try gtk3 toolkit first
and then gtk2 if not found.
--with-x-toolkit=gtk|yes: As above, but fail if gtk2 or gt3 not found.
--with-x-toolkit=gtk2: Only try gtk2, fail if not found.
--with-x-toolkit=gtk3: Only try gtk3, fail if not found.
Stefan Monnier [Wed, 12 Sep 2012 19:16:36 +0000 (15:16 -0400)]
Remove unread-command-char.
* src/keyboard.c (read_char, requeued_events_pending_p, Finput_pending_p)
(Fdiscard_input, quit_throw_to_read_char, init_keyboard)
(syms_of_keyboard): Remove support for unread-command-char.
* lisp/emacs-lisp/debug.el (debugger-outer-unread-command-char, debug)
(debugger-env-macro): Remove support for unread-command-char.
* lisp/ehelp.el (with-electric-help): Accept functions in
electric-help-form-to-execute.
(electric-help-execute-extended, electric-help-ctrl-x-prefix): Use it.
And replace unread-command-char -> unread-command-events.
* lisp/subr.el (set-temporary-overlay-map): Minimize slightly the impact of
the temporary map re-appearing on emulation-mode-map-alists.
* lisp/emacs-lisp/edebug.el (def-edebug-form-spec): Remove, it's been broken
since 22.1.
Eli Zaretskii [Wed, 12 Sep 2012 19:14:02 +0000 (22:14 +0300)]
Fix silent exit upon assertion violation on MS-Windows.
src/w32proc.c (sys_kill): If PID is our process ID and the signal is
SIGABRT, call emacs_abort. Avoids silently exiting upon assertion
violation. (Bug#12426)
Martin Rudalics [Wed, 12 Sep 2012 15:49:17 +0000 (17:49 +0200)]
Try to keep height of debugger window consistent. (Bug#8789)
* emacs-lisp/debug.el (debugger-previous-window-height): New
variable.
(debug): When debugger-jumping-flag is non-nil try to restore
height of debugger window. (Bug#8789)
Stefan Monnier [Wed, 12 Sep 2012 13:12:48 +0000 (09:12 -0400)]
* lisp/emacs-lisp/edebug.el (edebug-enter): Don't mess with
overriding-local-map and pre/post-command-hook here.
(edebug-recursive-edit): Do it here instead.
(edebug-outside-unread-command-char): Remove all uses of
unread-command-char.
Paul Eggert [Tue, 11 Sep 2012 23:50:28 +0000 (16:50 -0700)]
Avoid _setjmp/_longjmp problems with local nonvolatile variables.
If a nonvolatile local variable is written before a _longjmp to
the frame containing the variable, and is read after the _longjmp,
the value read is indeterminate. Some local variables of type
'struct handler' and 'struct catchtag' are used in this way, so
mark each of their slots as volatile if the slot can be set before
_longjmp and read afterwards.
* lisp.h (struct handler): var and chosen_clause are now volatile.
(struct catchtag): val, next, and pdlcount are now volatile.
Paul Eggert [Tue, 11 Sep 2012 22:59:50 +0000 (15:59 -0700)]
Prefer assignment to memcpy when either will do.
* lib-src/pop.c (socket_connection) [HAVE_GETADDRINFO]:
* src/bidi.c (bidi_push_it, bidi_pop_it):
* src/fns.c (copy_hash_table):
* src/image.c (define_image_type):
* src/keyboard.c (kbd_buffer_store_event_hold):
* src/process.c (Fprocess_send_eof):
* src/xfaces.c (x_create_gc) [HAVE_NS]:
* src/xgselect.c (xg_select):
Use assignment, not memcpy, as either will do here, and assignment is
more likely to catch type errors.
Paul Eggert [Tue, 11 Sep 2012 20:35:23 +0000 (13:35 -0700)]
* alloc.c (discard_killed_buffers): Tune and simplify a bit.
Use pointer-to-a-pointer to simplify and avoid a NILP check each
time an item is removed. No need to mark this function 'inline';
the compiler knows better than we do.
Jan Djärv [Tue, 11 Sep 2012 17:08:02 +0000 (19:08 +0200)]
* nsterm.h: Add delay parameter to updateFrameSize.
* nsterm.m (ns_judge_scroll_bars): Pass NO to updateFrameSize.
(updateFrameSize:): Add delay parameter to updateFrameSize, send it
to change_frame_size.
(windowDidResize:): Pass YES to updateFrameSize.
Discard killed buffers from deleted window and frame objects.
This reduces an amount of references to killed buffers and
helps GC to reclaim them faster.
* alloc.c (discard_killed_buffers): New function.
(mark_object): Use it for deleted windows and frames.
(mark_object): If symbol's value is set up for a killed buffer
or deleted frame, restore it's global binding.
* data.c (swap_in_global_binding): Add GC notice.
(swap_in_symval_forwarding): Use convenient set_blv_where.
* window.c (wset_next_buffers, wset_prev_buffers): Move ...
* window.h: ... to here.
* Makefile.in (install-arch-dep, install-arch-indep, install-doc):
Be more explicit about dependencies, for parallel `make install'.
It is not so unreasonable to run `make -j# install' from a clean state
for a self-contained NS build, where the "installation" happens within
the build tree.
Convenient macro to check whether the buffer is live.
* buffer.h (BUFFER_LIVE_P): New macro.
* alloc.c, buffer.c, editfns.c, insdel.c, lread.c, marker.c:
* minibuf.c, print.c, process.c, window.c, xdisp.c: Use it.
Paul Eggert [Tue, 11 Sep 2012 02:28:27 +0000 (19:28 -0700)]
Simplify, document, and port floating-point.
The porting part of this patch fixes bugs on non-IEEE platforms
with frexp, ldexp, logb.
* admin/CPP-DEFINES (HAVE_CBRT, HAVE_LOGB, logb): Remove.
* configure.ac (logb, cbrt): Do not check for these functions,
as they are not being used.
* doc/lispref/numbers.texi (Float Basics, Arithmetic Operations, Math Functions):
Document that / and mod (with floating point arguments), along
with asin, acos, log, log10, expt and sqrt, return special values
instead of signaling exceptions.
(Float Basics): Document that logb operates on the absolute value
of its argument.
(Math Functions): Document that (log ARG BASE) also returns NaN if
BASE is negative. Document that (expt X Y) returns NaN if X is a
finite negative number and Y a finite non-integer.
* etc/NEWS: Document NaNs versus signaling-error change.
* src/data.c, src/lisp.h (Qdomain_error, Qsingularity_error, Qunderflow_error):
Now static.
* src/floatfns.c: Simplify discussion of functions that Emacs doesn't
support, by removing commented-out code and briefly listing the
C89 functions excluded. The commented-out stuff was confusing
maintenance, e.g., we thought we needed cbrt but it was commented out.
(logb): Remove decl; no longer needed.
(isfinite): New macro, if not already supplied.
(isnan): Don't replace any existing macro.
(Ffrexp, Fldexp): Define even if !HAVE_COPYSIGN, as frexp and ldexp
are present on all C89 platforms.
(Ffrexp): Do not special-case zero, as frexp does the right thing
for that case.
(Flogb): Do not use logb, as it doesn't have the desired meaning
on hosts that use non-base-2 floating point. Instead, stick with
frexp, which is C89 anyway. Do not pass an infinity or a NaN to
frexp, to avoid getting an unspecified result.
Paul Eggert [Mon, 10 Sep 2012 01:03:27 +0000 (18:03 -0700)]
Improve robustness of 'make bootstrap'.
Run autogen.sh after bootstrap-clean, to avoid bzr pull issues.
* INSTALL, README: Document autogen.sh.
* Makefile.in (Makefile): Mark it as precious, since it's updated
atomically.
(MAKE_CONFIG_STATUS): New macro.
(config.status, bootstrap): Use it. This causes 'make bootstrap'
to run config.status with the --recheck option, which is more
appropriate for a bootstrap.
(bootstrap): Run autogen.sh right after cleaning. Don't worry
about failures due to missing tools.
* autogen.sh: Exit with status 101 when failing due to missing tools.
* make-dist: Distribute autogen.sh.
Juri Linkov [Sun, 9 Sep 2012 22:15:24 +0000 (01:15 +0300)]
* lisp/replace.el (replace-regexp-lax-whitespace): New defcustom.
(replace-lax-whitespace, query-replace-regexp)
(query-replace-regexp-eval, replace-regexp): Doc fix.
(perform-replace, replace-highlight): Let-bind
isearch-lax-whitespace to replace-lax-whitespace and
isearch-regexp-lax-whitespace to replace-regexp-lax-whitespace.
* lisp/isearch.el (isearch-query-replace): Let-bind
replace-lax-whitespace to isearch-lax-whitespace and
replace-regexp-lax-whitespace to
isearch-regexp-lax-whitespace.
Eli Zaretskii [Sun, 9 Sep 2012 20:10:36 +0000 (23:10 +0300)]
Avoid leaving traces of cursor when entering linum-mode.
src/fringe.c (draw_fringe_bitmap_1): Don't reduce the width of the
left fringe if the window has a left margin. This avoids leaving
traces of the cursor because its leftmost pixel is not drawn over.
Paul Eggert [Sun, 9 Sep 2012 16:06:33 +0000 (09:06 -0700)]
Assume C89 or later for math functions.
This simplifies the code, and makes it a bit smaller and faster,
and (most important) makes it easier to clean up signal handling
since we can stop worring about floating-point exceptions in
library code. That was a problem before C89, but the problem
went away many years ago on all practical Emacs targets.
* configure.ac (frexp, fmod): Remove checks for these functions,
as we now assume them.
(FLOAT_CHECK_DOMAIN, HAVE_INVERSE_HYPERBOLIC, NO_MATHERR)
(HAVE_EXCEPTION):
Remove; no longer needed.
* admin/CPP-DEFINES (HAVE_FMOD, HAVE_FREXP, FLOAT_CHECK_DOMAIN)
(HAVE_INVERSE_HYPERBOLIC, NO_MATHERR): Remove.
* src/data.c, src/image.c, src/lread.c, src/print.c:
Don't include <math.h>; no longer needed.
* src/data.c, src/floatfns.c (IEEE_FLOATING_POINT): Don't worry that it
might be autoconfigured, as that never happens.
* src/data.c (fmod):
* src/doprnt.c (DBL_MAX_10_EXP):
* src/print.c (DBL_DIG):
Remove. C89 or later always defines these.
* src/floatfns.c (HAVE_MATHERR, FLOAT_CHECK_ERRNO, FLOAT_CHECK_DOMAIN)
(in_float, float_error_arg, float_error_arg2, float_error_fn_name)
(arith_error, domain_error, domain_error2):
Remove all this pre-C89 cruft. Do not include <errno.h> as that's
no longer needed -- we simply return what C returns. All uses removed.
(IN_FLOAT, IN_FLOAT2): Remove. All uses replaced with
the wrapped code.
(FLOAT_TO_INT, FLOAT_TO_INT2, range_error, range_error2):
Remove. All uses expanded, as these macros are no longer used
more than once and are now more trouble than they're worth.
(Ftan): Use tan, not sin / cos.
(Flogb): Assume C89 frexp.
(fmod_float): Assume C89 fmod.
(matherr) [HAVE_MATHERR]: Remove; no longer needed.
(init_floatfns): Remove. All uses removed.
Alan Mackenzie [Sun, 9 Sep 2012 11:03:37 +0000 (11:03 +0000)]
Correct the handling of two c-state-cache state variables.
cc-engine.el (c-state-cache-init): Initialise
c-state-semi-nonlit-pos-cache\(-limit\)? properly.
(c-record-parse-state-state): record
c-state-semi-nonlit-pos-cache\(-limit\)?.
* lisp/progmodes/ruby-mode.el (ruby-toggle-block): Guess the current block,
not just expect to be at its beginning. Adjust callees.
Succeed when do-end block has no space before the pipe character.
(ruby-brace-to-do-end): When the original block is one-liner,
convert to multiline. Reindent the result.
* test/automated/ruby-mode-tests.el:
(ruby-toggle-block-to-multiline): New test.
(ruby-should-indent-buffer, ruby-toggle-block-to-do-end)
(ruby-toggle-block-to-brace): Use buffer-string.
Jambunathan K [Sat, 8 Sep 2012 20:09:06 +0000 (16:09 -0400)]
* lisp/register.el (increment-register): Route it to `append-to-register',
if register contains text so that `C-x r +' can now be
used for appending to a text register.
(register): New group.
(register-separator): New user option.
(append-to-register, prepend-to-register): Add separator based on
`register-separator.
* doc/emacs/regs.texi (Text Registers): `C-x r +' can now be used instead of
M-x append-to-register. New option `register-separator'.
(Number Registers): Mention that `C-x r +' is polymorphic.
Alan Mackenzie [Sat, 8 Sep 2012 20:00:13 +0000 (20:00 +0000)]
AWK Mode: make auto-newline work when there's "==" in the pattern.
cc-cmds.el (c-point-syntax): Handle virtual semicolons correctly.
cc-engine.el (c-guess-basic-syntax CASE 5A.3): Test more rigorously for
"=" token.
Martin Rudalics [Sat, 8 Sep 2012 13:28:11 +0000 (15:28 +0200)]
Fix handling of debugger window. (Bug#8789)
* window.el (display-buffer-in-previous-window): New buffer
display action function.
* emacs-lisp/debug.el (debugger-bury-or-kill): New option.
(debugger-previous-window): New variable.
(debug): Rewrite using display-buffer-in-previous-window,
quit-restore-window and debugger-bury-or-kill. (Bug#8789)
Jan Djärv [Sat, 8 Sep 2012 12:48:33 +0000 (14:48 +0200)]
* nsterm.h (EmacsView): Add updateFrameSize.
* nsterm.m (ns_clip_to_row): Remove code that deals with drawing fringe
in the internal border.
(x_set_window_size): Remove static variables and their usage.
(ns_redraw_scroll_bars): Fix NSTRACE arg.
(ns_after_update_window_line, ns_draw_fringe_bitmap): Remove
fringe/internal border adjustment.
(ns_draw_fringe_bitmap): Make code more like other terms (xterm.c).
(ns_draw_window_cursor): Remove fringe/internal border adjustment.
(ns_fix_rect_ibw): Remove.
(ns_get_glyph_string_clip_rect): Remove call to ns_fix_rect_ibw.
(ns_dumpglyphs_box_or_relief): Ditto.
(ns_maybe_dumpglyphs_background): Remove fringe/internal border
adjustment.
(ns_dumpglyphs_image): Ditto.
(ns_dumpglyphs_stretch): Fix coding style. Remove fringe/internal
border adjustment.
(ns_set_vertical_scroll_bar): Remove variables barOnVeryLeft/Right and
their usage. Add fringe_extended_p and its use as in other terms.
(ns_judge_scroll_bars): Code style fix. Call updateFrameSize if
scroll bar was removed.
(updateFrameSize): New function.
(windowDidResize): Move code to updateFrameSize and call it.
Matt McClure [Fri, 7 Sep 2012 14:53:15 +0000 (16:53 +0200)]
* progmodes/python.el (python-shell-send-string): When
default-directory is remote, create temp file on remote
filesystem.
(python-shell-send-file): When file is remote, pass local view of
file paths to remote Python interpreter. (Bug#12340)
Paul Eggert [Fri, 7 Sep 2012 08:46:44 +0000 (01:46 -0700)]
More signal-handler cleanup.
* configure.ac (FLOAT_CHECK_DOMAIN): Comment fix (Bug#12327).
* src/floatfns.c: Comment fix.
* src/lisp.h (force_auto_save_soon): Declare regardless of SIGDANGER.
SIGDANGER might not be in scope so "#ifdef SIGDANGER" is not right,
and anyway the declaration is harmless even if SIGDANGER is not defined.
* src/syssignal.h (SIGIO): Also #undef if (! defined FIONREAD ||
defined BROKEN_FIONREAD). systty.h formerly did this, but other
source files not surprisingly expected syssignal.h to define, or
not define, SIGIO, and it's cleaner to do it that way, for consistency.
Include <sys/ioctl.h>, for FIONREAD.
* src/systty.h (SIGIO): Do not #undef here; it's now syssignal.h's job.
This eliminates a problem whereby other files mysteriously had
to include "syssignal.h" before including "systty.h" if they
wanted to use "#ifdef SIGIO".
* lisp/progmodes/ruby-mode.el
(ruby-beginning-of-defun): Only consider 3 keywords defun beginners.
(ruby-end-of-defun): Expect that the point is at the beginning of
the defun.
* lisp/progmodes/ruby-mode.el (ruby-end-of-defun)
(ruby-beginning-of-defun): Simplify, allow indentation before
block beginning and end keywords. Also, fix accidental change in the former.
* lisp/progmodes/ruby-mode.el (ruby-indent-beg-re): Add pieces from
ruby-beginning-of-indent, simplify, allow all keywords to have
indentation before them.
(ruby-beginning-of-indent): Adjust for above. Search until the
found point is not inside a string or comment.
(ruby-font-lock-keywords): Allow symbols to start with "@"
character, give them higher priority than variables.
(ruby-syntax-propertize-function)
(ruby-font-lock-syntactic-keywords): Remove the "not comments"
matchers. Expression expansions are not comments when inside a
string, and there comment syntax status is irrelevant.
(ruby-match-expression-expansion): New function. Check that
expression expansion is inside a string, and it's not escaped.
(ruby-font-lock-keywords): Use it.
* test/automated/ruby-mode-tests.el: New tests (Bug#11613).
Paul Eggert [Fri, 7 Sep 2012 01:27:44 +0000 (18:27 -0700)]
Signal-handler cleanup.
Emacs's signal handlers were written in the old 4.2BSD style with
sigblock and sigmask and so forth, and this led to some
inefficiencies and confusion. Rewrite these to use
pthread_sigmask etc. without copying signal sets around. Also,
get rid of the confusing macros 'SIGNAL_THREAD_CHECK' and
'signal', and instead use functions that do not attempt to take
over the system name space. This patch causes Emacs's text
segment to shrink by 0.7% on my platform, Fedora 17 x86-64.
* configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF):
Adjust to syssignal.h changes.
(SIGNAL_H_AB): Remove; no longer needed.
* src/alloc.c, src/emacsgtkfixed.c, src/nsfns.m, src/widget.c, src/xmenu.c:
Do not include <signal.h> or "syssignal.h", as these
modules do not use signals.
* src/atimer.c, src/callproc.c, src/data.c, src/dispnew.c, src/emacs.c:
* src/floatfns.c, src/gtkutil.c, src/keyboard.c, src/process.c, src/sound.c:
* src/sysdep.c, src/term.c, src/xterm.c:
Do not include <signal.h>, as "syssignal.h" does that for us now.
* src/atimer.c (sigmask_atimers): New function.
(block_atimers, unblock_atimers): New functions,
replacing the old macros BLOCK_ATIMERS and UNBLOCK_ATIMERS.
All uses replaced.
* src/conf_post.h [SIGNAL_H_AHB]: Do not include <signal.h>;
no longer needed here.
* src/emacs.c (main): Inspect existing signal handler with sigaction,
so that there's no need to block and unblock SIGHUP.
* src/sysdep.c (struct save_signal): New member 'action', replacing
old member 'handler'.
(save_signal_handlers, restore_signal_handlers):
Use sigaction instead of 'signal' to save and restore.
(get_set_sighandler, set_sighandler) [!WINDOWSNT]:
New function. All users of 'signal' modified to use set_sighandler
if they're writeonly, and to use sys_signal if they're read+write.
(emacs_sigaction_init, forwarded_signal): New functions.
(sys_signal): Remove. All uses replaced by calls to sigaction
and emacs_sigaction_init, or by direct calls to 'signal'.
(sys_sigmask) [!__GNUC__]: Remove; no longer needed.
(sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove;
all uses replaced by pthread_sigmask etc. calls.
* src/syssignal.h: Include <signal.h>.
(emacs_sigaction_init, forwarded_signal): New decls.
(SIGMASKTYPE): Remove. All uses replaced by its definiens, sigset_t.
(SIGEMPTYMASK): Remove; all uses replaced by its definiens, empty_mask.
(sigmask, sys_sigmask): Remove; no longer needed.
(sigpause): Remove. All uses replaced by its definiens, sigsuspend.
(sigblock, sigunblock, sigfree):
(sigsetmask) [!defined sigsetmask]:
Remove. All uses replaced by pthread_sigmask.
(signal): Remove. Its remaining uses (with SIG_DFL and SIG_IGN)
no longer need to be replaced, and its typical old uses
are now done via emacs_sigaction_init and sigaction.
(sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove decls.
(sys_sigdel): Remove; unused.
(NSIG): Remove a FIXME; the code's fine. Remove an unnecessary ifdef.
* progmodes/vhdl-mode.el (vhdl-speedbar-initialize): Don't use
obsolete alias speedbar-key-map.
(vhdl-doc-variable, vhdl-doc-mode): Use called-interactively-p.
(vhdl-index-menu-init): Don't use obsolete variable font-lock-maximum-size.