Grégoire Jadi [Tue, 16 Jul 2013 17:39:19 +0000 (19:39 +0200)]
* src/xwidget.c (Fxwidget_view_lookup): Bring `xwidget-view-lookup' to the
Lisp side.
(xwidget_view_lookup): `xwidget_view_lookup' is just a wrapper around
`xwidget-view-lookup' to convert from `struct *' to `Lisp_Object'.
Grégoire Jadi [Tue, 16 Jul 2013 17:39:18 +0000 (19:39 +0200)]
* src/xwidget.h src/xwidget.c (valid_xwidget_spec_p): Renamed
`valid_xwidget_p' to `valid_xwidget_p'.
(XWIDGETP): Rename `XXWIDGETP' to `XWIDGETP' and `XXWIDGET_VIEW_P' to
`XWIDGET_VIEW_P'. The old `XWIDGETP' is now implemented solely in
`valid_xwidget_spec_p'.
(CHECK_XWIDGET): New macro to check whether the argument is a xwidget.
(CHECK_XWIDGET_VIEW): New macro to check whether the argument is a
xwidget_view.
* src/print.c src/xdisp.c: Take into account the new names.
Alan Mackenzie [Sat, 13 Jul 2013 17:45:07 +0000 (17:45 +0000)]
progmodes/cc-engine.el (c-forward-decl-or-cast-1): Label CASE 13
and comment it out. This out-commenting enables certain C++
declarations to be parsed correctly.
Paul Eggert [Sat, 13 Jul 2013 00:24:38 +0000 (17:24 -0700)]
Don't lose top specpdl entry when memory is exhausted.
* eval.c (grow_specpdl): Increment specpdl top by 1 and check for
specpdl overflow here, to simplify callers; all callers changed.
Always reserve an unused entry at the stack top; this avoids
losing the top entry's information when memory is exhausted.
* lisp/progmodes/ruby-mode.el (ruby-percent-literals-beg-re):
(ruby-syntax-expansion-allowed-p): Support array of symbols, for
Ruby 2.0.
(ruby-font-lock-keywords): Distinguish calls to functions with
module-like names from module references. Highlight character
literals.
Paul Eggert [Fri, 12 Jul 2013 17:30:48 +0000 (10:30 -0700)]
Clean up errno reporting and fix some errno-reporting bugs.
* callproc.c (Fcall_process):
* fileio.c (Fcopy_file, Finsert_file_contents, Fwrite_region):
* process.c (create_process, Fmake_network_process):
* unexaix.c (report_error):
* unexcoff.c (report_error):
Be more careful about reporting the errno of failed operations.
The code previously reported the wrong errno sometimes.
Also, prefer report_file_errno to setting errno + report_file_error.
(Fcall_process): Look at openp return value rather than at path,
as that's a bit faster and clearer when there's a numeric predicate.
* fileio.c (report_file_errno): New function, with most of the
old contents of report_file_error.
(report_file_error): Use it.
(Ffile_exists_p, Ffile_accessible_directory_p):
Set errno to 0 when it is junk.
* fileio.c (Faccess_file):
* image.c (x_create_bitmap_from_file):
Use faccessat rather than opening the file, to avoid the hassle of
having a file descriptor open.
* lisp.h (report_file_errno): New decl.
* lread.c (Flocate_file_internal): File descriptor 0 is valid, too.
Paul Eggert [Fri, 12 Jul 2013 14:31:42 +0000 (07:31 -0700)]
Minor EBADF fixes.
* process.c (create_process, wait_reading_process_output) [AIX]:
Remove obsolete SIGHUP-related code, as Emacs no longer disables
SIGHUP, so EBADF is no longer acceptable here (it wouldn't work in
a multithreaded environment anyway).
* sysdep.c (emacs_close): It's not dangerous to invoke emacs_close (-1).
lisp/desktop.el: Minor fixes.
(desktop--v2s): Remove unused local variable.
(desktop-save-buffer): Make defvar-local; adjust docstring.
(desktop-auto-save-timeout, desktop-owner): Use ignore-errors.
(desktop-clear, desktop-save-buffer-p): Use string-match-p.
Paul Eggert [Fri, 12 Jul 2013 02:03:47 +0000 (19:03 -0700)]
Fix races with threads and file descriptors.
* configure.ac (PTY_TTY_NAME_SPRINTF): Use emacs_close, not close.
* src/callproc.c (Fcall_process_region):
* src/dired.c (open_directory):
* src/emacs.c (main, Fdaemon_initialized):
* src/image.c (x_find_image_file):
* src/inotify.c (Finotify_rm_watch):
* src/lread.c (Flocate_file_internal):
* src/process.c (Fnetwork_interface_list, Fnetwork_interface_info):
* src/term.c (term_mouse_moveto, init_tty):
* src/termcap.c (tgetent):
* src/unexaix.c, src/unexcoff.c (report_error, report_error_1, adjust_lnnoptrs)
* src/unexaix.c, src/unexcoff.c, src/unexcw.c, src/unexelf.c (unexec):
* src/unexhp9k800.c, src/unexmacosx.c (unexec):
* src/callproc.c (Fcall_process_region):
Use emacs_close, not close.
* src/sysdep.c (POSIX_CLOSE_RESTART, posix_close) [!POSIX_CLOSE_RESTART]:
New macro and function, which emulates the POSIX_CLOSE_RESTART macro
and posix_close function on current platforms (which all lack them).
(emacs_close): Use it. This should fix the races on GNU/Linux and
on AIX and on future platforms that support POSIX_CLOSE_RESTART,
and it should avoid closing random victim file descriptors on
other platforms.
Leo Liu [Thu, 11 Jul 2013 02:59:54 +0000 (10:59 +0800)]
* ido.el (ido-read-file-name): Conform to the requirements of
read-file-name.
(ido-read-directory-name): Conform to the requirements of
read-directory-name.
Paul Eggert [Wed, 10 Jul 2013 23:23:57 +0000 (16:23 -0700)]
Port to C89.
* lib-src/ebrowse.c (USAGE): Remove macro with too-long string literal ...
(usage_message): ... and replace it with this new static constant
containing multiple literals. All uses changed.
* lib-src/emacsclient.c (print_help_and_exit):
Rewrite to avoid string literals longer than the C89 limits.
(start_daemon_and_retry_set_socket):
Rewrite to avoid non-constant array initializer.
* lib-src/make-docfile.c (enum global_type): Omit trailing comma.
* src/bytecode.c (BYTE_CODE_THREADED): Do not define if __STRICT_ANSI__.
(B__dummy__): New dummy symbol, to pacify C89.
* src/dbusbind.c (XD_DEBUG_MESSAGE): Omit debugging on C89 hosts, since
they can't grok varargs macros.
* src/dispnew.c (add_window_display_history)
(add_frame_display_history):
* src/print.c (print_object):
* src/xdisp.c (debug_method_add):
Use %p printf format only for void pointers.
* src/emacs.c (usage_message): New constant, replacing ...
(USAGE1, USAGE2, USAGE3): Remove; they were too long for C89.
(main): Adjust to usage reorg.
* src/fns.c (syms_of_fns):
* src/profiler.c (syms_of_profiler):
Don't use non-constant struct initializers.
* src/gnutls.h (gnutls_initstage_t):
* src/lisp.h (enum Lisp_Fwd_Type):
* src/lread.c (lisp_file_lexically_bound_p):
* src/xsettings.c (anonymous enum):
Remove trailing comma.
* src/xsettings.c (apply_xft_settings): Use %f, not %lf; %lf is a C99ism.
* src/lisp.h (ENUM_BF): Use unsigned if pedantic.
(DEFUN_FUNCTION_INIT): New macro, that falls back on a cast if pre-C99.
(DEFUN): Use it.
* src/regex.c (const_re_char): New type, to pacify strict C89.
All uses of 'const re_char' replaced to use it.
* src/regex.h (_Restrict_): Rename from __restrict, to avoid clash
with glibc when strict C89. This change is imported from gnulib.
All uses changed.
(_Restrict_arr_): Rename from __restrict_arr, similarly.
* src/sysdep.c (time_from_jiffies) [!HAVE_LONG_LONG_INT]:
Omit GNU_LINUX implementation, since it requires long long.
* src/xterm.c (x_draw_underwave):
Do not assume the traditional order of struct's members.
(x_term_init): Rewrite to avoid the need for non-constant structure
initializers.
David Engster [Wed, 10 Jul 2013 22:17:07 +0000 (22:17 +0000)]
gnus-start.el (gnus-clean-old-newsrc): Always remove 'unexist' marks if `gnus-newsrc-file-version' does not match `gnus-version'. This fixes a bug in Emacs trunk where the 'unexist' marks were always removed at startup because "Gnus v5.13" was considered smaller than "Ma Gnus v0.03".
Eli Zaretskii [Wed, 10 Jul 2013 16:18:17 +0000 (19:18 +0300)]
Improve scrolling when line-spacing != 0 and scroll-step = 1.
lisp/simple.el (default-line-height): New function.
(line-move-partial, line-move): Use it instead of computing the
line height inline.
(line-move-partial): Always compute ROWH. If the last line is
partially-visible, but its text is completely visible, allow
cursor to enter such a partially-visible line.
Paul Eggert [Wed, 10 Jul 2013 16:11:09 +0000 (09:11 -0700)]
Syntax cleanup, mostly replacing macros with functions.
This removes the need for the syntax_temp hack.
* search.c: Include syntax.h after buffer.h, since syntax.h uses BVAR.
* syntax.c (SYNTAX_INLINE): New macro.
(SYNTAX_FLAGS_COMSTART_FIRST, SYNTAX_FLAGS_COMSTART_SECOND)
(SYNTAX_FLAGS_COMEND_FIRST, SYNTAX_FLAGS_COMEND_SECOND)
(SYNTAX_FLAGS_PREFIX, SYNTAX_FLAGS_COMMENT_STYLEB)
(SYNTAX_FLAGS_COMMENT_STYLEC, SYNTAX_FLAGS_COMMENT_STYLEC2)
(SYNTAX_FLAGS_COMMENT_NESTED, SYNTAX_FLAGS_COMMENT_STYLE)
(SYNTAX_COMEND_FIRST): Now functions, not macros.
(ST_COMMENT_STYLE, ST_STRING_STYLE, INTERVALS_AT_ONCE):
Now constants, not macros.
(syntax_temp) [!__GNUC__]: Remove.
(SYNTAX_PREFIX): Remove; all uses replaced by syntax_prefix_flag_p.
(syntax_prefix_flag_p): Move implementation of SYNTAX_PREFIX here.
(SET_RAW_SYNTAX_ENTRY, SET_RAW_SYNTAX_ENTRY_RANGE, SYNTAX_MATCH)
(SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT):
Move here from syntax.h; now functions, not macros. Except for the
last function, these are static since only syntax.c uses them.
(syntax_multibyte): Rename from SYNTAX_WITH_MULTIBYTE_CHECK.
All uses changed. Now a function, not a macro; use this fact
to simplify the code.
(scan_lists, scan_sexps_forward): Remove workarounds for ancient
compiler bugs; no longer relevant.
* syntax.h: Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
(SYNTAX_INLINE): New macro.
(struct gl_state_s, gl_state): Move earlier, so that it's in scope
for the new functions. Use bool for boolean member.
(SYNTAX_ENTRY, SYNTAX, SYNTAX_WITH_FLAGS, SYNTAX_MATCH)
(SYNTAX_TABLE_BYTE_TO_CHAR, UPDATE_SYNTAX_TABLE_FORWARD)
(UPDATE_SYNTAX_TABLE_BACKWARD, UPDATE_SYNTAX_TABLE)
(SETUP_BUFFER_SYNTAX_TABLE):
Now extern inline functions, not macros.
(CURRENT_SYNTAX_TABLE, SYNTAX_ENTRY_INT):
Remove; all uses replaced by implementation.
(syntax_temp) [!__GNUC__]: Remove decl.
(SETUP_SYNTAX_TABLE_FOR_OBJECT): New decl.
Michael Albinus [Wed, 10 Jul 2013 14:58:26 +0000 (16:58 +0200)]
Improve error messages. (Bug#14808)
* net/tramp.el (tramp-current-connection): New defvar, moved from
tramp-sh.el.
(tramp-message-show-progress-reporter-message): Removed, not
needed anymore.
(tramp-error-with-buffer): Show message in minibuffer. Discard
input before waiting. Reset connection timestamp.
(with-tramp-progress-reporter): Improve messages.
(tramp-process-actions): Use progress reporter. Delete process in
case of error. Improve messages.
* net/tramp-sh.el (tramp-barf-if-no-shell-prompt): Use
condition-case. Call `tramp-error-with-buffer' with vector and buffer.
(tramp-current-connection): Removed.
(tramp-maybe-open-connection): The car of
`tramp-current-connection' are the first 3 slots of the vector.
Paul Eggert [Wed, 10 Jul 2013 06:26:23 +0000 (23:26 -0700)]
Timestamp fixes for undo.
* doc/lispref/text.texi (Undo):
Document (t . 0) and (t . -1) in buffer-undo-list.
* etc/NEWS: Changes to visited-file-modtime, set-visited-file-modtime.
* lisp/files.el (clear-visited-file-modtime): Move here from fileio.c.
* src/atimer.c (schedule_atimer):
* src/fileio.c (Ffile_newer_than_file_p):
Minor cleanup: use EMACS_TIME_LT so that we can remove EMACS_TIME_GT.
* src/buffer.c (buffer-undo-list): Document (t . 0) and (t . -1).
* src/fileio.c (Fclear_visited_file_modtime): Move to lisp/files.el.
(syms_of_fileio): Remove Sclear_visited_file_name.
(Fvisited_file_modtime): Return -1, not (-1 ...), when the visited
file doesn't exist; this avoids an ambiguity with negative timestamps.
(Fset_visited_file_modtime): Accept -1 and 0 as time-list arg.
* src/systime.h (make_emacs_time, invalid_emacs_time):
Don't assume struct timespec layout; POSIX doesn't guarantee it.
(EMACS_TIME_NE, EMACS_TIME_GT, EMACS_TIME_GE): Remove.
* src/undo.c (record_first_change): Push (visited-file-modtime) onto
undo list rather than reimplementing it by hand, incorrectly.
Paul Eggert [Tue, 9 Jul 2013 17:16:21 +0000 (10:16 -0700)]
Port recent close-on-exec changes to Cygwin.
* lib/binary-io.c, lib/binary-io.h: New files.
Merge from gnulib, incorporating:
2013-07-09 accept4, dup3, pipe2: port to Cygwin
* lib/pipe2.c: Update from gnulib, as part of this merge.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
Paul Eggert [Tue, 9 Jul 2013 07:04:48 +0000 (00:04 -0700)]
Handle errno and exit status a bit more carefully.
* lib/ignore-value.h: Remove this gnulib-imported file.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* admin/merge-gnulib (GNULIB_MODULES): Remove ignore-value.
* src/callproc.c (child_setup) [!DOS_NT]: Don't try to stuff an error
number into an exit status. Instead, use EXIT_CANCELED.
(child_setup) [!MSDOS]: Avoid possible deadlock with vfork.
* src/callproc.c (relocate_fd):
* src/emacs.c (close_output_streams, main):
* src/process.c (create_process):
* src/sysdep.c (sys_subshell) [!DOS_NT || !WINDOWSNT]:
Use emacs_perror for simplicity.
* src/callproc.c (relocate_fd, main):
* src/sysdep.c (sys_subshell):
Exit with EXIT_CANCELED etc., not 1, when exec setup fails.
(shut_down_emacs): Use emacs_write, not write.
* src/emacs.c, src/sysdep.c: Don't include <ignore-value.h>.
* src/fileio.c (Fcopy_file, e_write):
* src/nsterm.m (ns_select):
* src/process.c (send_process):
* src/sound.c (vox_write):
Use emacs_write_sig, not emacs_write.
* src/lisp.h (emacs_write_sig, emacs_perror): New decls.
* src/process.h (EXIT_CANCELED), EXIT_CANNOT_INVOKE, EXIT_ENOENT):
New constants.
* src/sysdep.c (emacs_backtrace): Use emacs_write, not ignore_value
of write.
(emacs_full_write): New function.
(emacs_write): Rewrite to use it.
(emacswrite_sig, emacs_perror): New functions.
* src/xrdb.c (fatal): Don't invoke perror, since errno might be garbage.
Stefan Monnier [Mon, 8 Jul 2013 21:54:54 +0000 (17:54 -0400)]
* lisp/emacs-lisp/pcase.el (pcase--split-pred): Add `vars' argument to try
and detect when a guard/pred depends on local vars.
(pcase--u1): Adjust caller.