1. 10 Dec, 2012 3 commits
    • Eli Zaretskii's avatar
      f282b9f7
    • Rüdiger Sonderfeld's avatar
      Support filesystem notification through inotify on GNU/Linux. · 81606b10
      Rüdiger Sonderfeld authored
       configure.ac (inotify): New option.
       (HAVE_INOTIFY): Test for inotify.
      
       src/termhooks.h (enum event_kind) [HAVE_INOTIFY]: Add
       FILE_NOTIFY_EVENT.
       src/lisp.h (syms_of_inotify) [HAVE_INOTIFY]: Add prototype.
       src/keyboard.c (Qfile_inotify) [HAVE_INOTIFY]: New variable.
       (syms_of_keyboard): DEFSYM it.
       (kbd_buffer_get_event) [HAVE_INOTIFY]: Generate FILE_NOTIFY_EVENT.
       (make_lispy_event): Support FILE_NOTIFY_EVENT by generating
       Qfile_inotify events.
       (keys_of_keyboard) [HAVE_INOTIFY]: Bind file-inotify events in
       special-event-map to inotify-handle-event.
       src/emacs.c (main) [HAVE_INOTIFY]: Call syms_of_inotify.
       src/Makefile.in (base_obj): Add inotify.o.
       src/inotify.c: New file.
      
       lisp/subr.el (inotify-event-p, inotify-handle-event): New functions.
      
       test/automated/inotify-test.el: New test.
      81606b10
    • Paul Eggert's avatar
      * fileio.c (Fsubstitute_in_file_name): Use ptrdiff_t, not int, · 5f460827
      Paul Eggert authored
      for string length.
      5f460827
  2. 08 Dec, 2012 10 commits
    • Jan Djärv's avatar
      * nsterm.m (fd_handler:): FD_ZERO fds. · a06ae17d
      Jan Djärv authored
      Fixes: debbugs:13103
      a06ae17d
    • Eli Zaretskii's avatar
      Fix putenv and unsetenv on MS-Windows. · a16e75cd
      Eli Zaretskii authored
       src/w32.c (unsetenv): Return 0 if the input string is too long.
      
       nt/inc/ms-w32.h (sys_putenv): Add prototype.
      
      Fixes: debbugs:13070
      a16e75cd
    • Paul Eggert's avatar
      Use putenv+unsetenv instead of modifying environ directly. · 5745a7df
      Paul Eggert authored
      * admin/merge-gnulib (GNULIB_MODULES): Add putenv, unsetenv.
      * lib/putenv.c, lib/unsetenv.c, m4/putenv.m4, m4/setenv.m4:
      New files, copied automatically from gnulib.
      * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
      * src/alloc.c (xputenv): New function.
      * src/dbusbind.c (Fdbus_init_bus):
      * src/emacs.c (main):
      * src/xterm.c (x_term_init):
      Use xputenv instead of setenv or putenv, to detect memory exhaustion.
      * src/editfns.c (initial_tz): Move static var decl up.
      (tzvalbuf_in_environ): New static var.
      (init_editfns):	Initialize these two static vars.
      (Fencode_time): Don't assume arbitrary limit on EMACS_INT width.
      Save old TZ value on stack, if it's small.
      (Fencode_time, set_time_zone_rule): Don't modify 'environ' directly;
      instead, use xputenv+unsetenv to set and restore TZ.
      (environbuf): Remove static var.  All uses removed.
      (Fset_time_zone_rule): Do not save TZ and environ;
      no longer needed here.
      (set_time_zone_rule_tz1, set_time_zone_rule_tz2) [LOCALTIME_CACHE]:
      Move to inside set_time_zone_rule; they don't need file scope any more.
      (set_time_zone_rule): Maintain the TZ=value string separately.
      (syms_of_editfns): Don't initialize initial_tz;
      init_editfns now does it.
      * src/emacs.c (dump_tz) [HAVE_TZSET]: Now const.
      * src/lisp.h (xputenv): New decl.
      
      Fixes: debbugs:13070
      5745a7df
    • Fabrice Popineau's avatar
    • Fabrice Popineau's avatar
      Fix incompatibilities with 64-bit Windows builds. · cb576b5c
      Fabrice Popineau authored
       src/w32fns.c (cache_system_info): Cast sysinfo_cache.dwPageSize to
       DWORD_PTR, for compatibility with 64-bit builds.
       src/w32.c (_PROCESS_MEMORY_COUNTERS_EX): 
       (GetProcessWorkingSetSize_Proc, get_process_working_set_size)
       (system_process_attributes): Use SIZE_T rather than DWORD, for
       compatibility with 64-bit builds.
      cb576b5c
    • Eli Zaretskii's avatar
      Provide unsetenv for MS-Windows and make putenv Posix-compatible. · 75ceee05
      Eli Zaretskii authored
       src/w32.c (unsetenv, sys_putenv): New functions.
      
       nt/inc/ms-w32.h (putenv): Redirect to sys_putenv.
       nt/config.nt (HAVE_UNSETENV): Define to 1.
      
      Fixes: debbugs:13070
      75ceee05
    • Chong Yidong's avatar
      * src/editfns.c (Finsert_char): Make the error message more informative. · 1b6dbfeb
      Chong Yidong authored
      Fixes: debbugs:12992
      1b6dbfeb
    • Paul Eggert's avatar
      Simplify get_lim_data. · 7be78020
      Paul Eggert authored
      * admin/CPP-DEFINES (ULIMIT_BREAK_VALUE): Remove.
      * configure.ac (ULIMIT_BREAK_VALUE): Remove.
      * src/vm-limit.c (get_lim_data): Combine RLIMIT_AS and RLIMIT_DATA methods.
      Remove USG and vlimit methods; no longer used these days.
      Add #error catchall just in case.
      7be78020
    • Christopher Schmidt's avatar
      * lread.c (Vload_source_file_function): Doc fix. · 76b92fee
      Christopher Schmidt authored
      Fixes: debbugs:11647
      76b92fee
    • Paul Eggert's avatar
      Assume POSIX 1003.1-1988 or later for signal.h. · d983a10b
      Paul Eggert authored
      Exceptions: do not assume SIGCONT, SIGSTOP, SIGTSTP, SIGTTIN,
      SIGTTOU, SIGUSR1, SIGUSR2, as Microsoft platforms lack these.
      * admin/CPP-DEFINES (SIGALRM, SIGCHLD, SIGHUP, SIGKILL, SIGPIPE, SIGQUIT):
      Remove.
      (SIGTRAP): Remove this one too, as config.h no longer defines it.
      * admin/merge-gnulib (GNULIB_MODULES): Add sig2str.
      * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF):
      Use SIGCHLD rather than SIGCLD.
      * lib/sig2str.c, lib/sig2str.h, m4/sig2str.m4: New files, from gnulib.
      * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
      * lib/makefile.w32-in (GNULIBOBJS): Add $(BUILD)/sig2str.$(O).
      * src/process.c [subprocesses]: Include <c-ctype.h>, <sig2str.h>.
      (deleted_pid_list, Fdelete_process, create_process)
      (record_child_status_change, handle_child_signal, deliver_child_signal)
      (init_process_emacs, syms_of_process):
      Assume SIGCHLD is defined.
      (parse_signal): Remove.  All uses removed.
      (abbr_to_signal): New static function.
      (Fsignal_process): Use it to convert signal names to ints.
      * src/sysdep.c (sys_suspend) [!DOS_NT]: Use kill (0, ...) rather than
      kill (getpgrp (), ...).
      (emacs_sigaction_init): Assume SIGCHLD is defined.
      (init_signals): Assume SIGALRM, SIGCHLD, SIGHUP, SIGKILL,
      SIGPIPE, and SIGQUIT are defined.  Do not worry about SIGCLD any more.
      * src/syssignal.h (EMACS_KILLPG): Remove.
      All uses replaced by 'kill' with a negative pid.
      (SIGCHLD): Remove definition, as we now assume SIGCHLD.
      * src/w32proc.c (sys_kill): Support negative pids compatibly with POSIX.
      
      Fixes: debbugs:13026
      d983a10b
  3. 07 Dec, 2012 5 commits
  4. 06 Dec, 2012 4 commits
    • Eli Zaretskii's avatar
      Avoid busy-waiting for child processes on Windows. (Bug#13086) · e86f5134
      Eli Zaretskii authored
       src/w32proc.c (waitpid): Avoid busy-waiting when called with WNOHANG
       if the child process is still running.  Instead, exit the wait
       loop and return zero.
      e86f5134
    • Dmitry Antipov's avatar
      * frame.h (x_char_width, x_char_height): Remove prototypes. · 1700db3c
      Dmitry Antipov authored
      * w32term.h (x_char_width, x_char_height): Likewise.
      * xfns.c (x_char_width, x_char_height): Remove.
      * w32fns.c (x_char_width, x_char_height): Likewise.
      * nsfns.c (x_char_width, x_char_height): Likewise.
      * frame.c (Fframe_char_width): Use FRAME_COLUMN_WIDTH for
      all window frames.
      (Fframe_char_height): Likewise with FRAME_LINE_HEIGHT.
      * keyboard.c (command_loop_1): Remove prototype.
      (command_loop_2, top_level_1): Add static to match prototype.
      1700db3c
    • Paul Eggert's avatar
      Fix a recently-introduced delete-process race condition. · 35fb8050
      Paul Eggert authored
      * callproc.c, process.h (record_kill_process):
      New function, containing part of the old call_process_kill.
      (call_process_kill): Use it.
      This does not change call_process_kill's behavior.
      * process.c (Fdelete_process): Use record_kill_process to fix a
      race condition that could cause Emacs to lose track of a child.
      35fb8050
    • Dmitry Antipov's avatar
      Avoid code duplication between prev_frame and next_frame. · 565212e5
      Dmitry Antipov authored
      * frame.c (candidate_frame): New function.  Add comment.
      (prev_frame, next_frame): Use it.  Adjust comment.
      565212e5
  5. 05 Dec, 2012 3 commits
  6. 04 Dec, 2012 3 commits
  7. 03 Dec, 2012 6 commits
    • Paul Eggert's avatar
      Don't let call-process be a zombie factory. · bb5f74ee
      Paul Eggert authored
      Fixing this bug required some cleanup of the signal-handling code.
      As a side effect, this change also fixes a longstanding rare race
      condition whereby Emacs could mistakenly kill unrelated processes,
      and it fixes a bug where a second C-g does not kill a recalcitrant
      synchronous process in GNU/Linux and similar platforms.
      The patch should also fix the last vestiges of Bug#9488,
      a bug which has mostly been fixed on the trunk by other changes.
      * callproc.c, process.h (synch_process_alive, synch_process_death)
      (synch_process_termsig, sync_process_retcode):
      Remove.  All uses removed, to simplify analysis and so that
      less consing is done inside critical sections.
      * callproc.c (call_process_exited): Remove.  All uses replaced
      with !synch_process_pid.
      * callproc.c (synch_process_pid, synch_process_fd): New static vars.
      These take the role of what used to be in unwind-protect arg.
      All uses changed.
      (block_child_signal, unblock_child_signal):
      New functions, to avoid races that could kill innocent-victim processes.
      (call_process_kill, call_process_cleanup, Fcall_process): Use them.
      (call_process_kill): Record killed processes as deleted, so that
      zombies do not clutter up the system.  Do this inside a critical
      section, to avoid a race that would allow the clutter.
      (call_process_cleanup): Fix code so that the second C-g works again
      on common platforms such as GNU/Linux.
      (Fcall_process): Create the child process in a critical section,
      to fix a race condition.  If creating an asynchronous process,
      record it as deleted so that zombies do not clutter up the system.
      Do unwind-protect for WINDOWSNT too, as that's simpler in the
      light of these changes.  Omit unnecessary call to emacs_close
      before failure, as the unwind-protect code does that.
      * callproc.c (call_process_cleanup):
      * w32proc.c (waitpid): Simplify now that synch_process_alive is gone.
      * process.c (record_deleted_pid): New function, containing
      code refactored out of Fdelete_process.
      (Fdelete_process): Use it.
      (process_status_retrieved): Remove.  All callers changed to use
      child_status_change.
      (record_child_status_change): Remove, folding its contents into ...
      (handle_child_signal): ... this signal handler.  Now, this
      function is purely a handler for SIGCHLD, and is not called after
      a synchronous waitpid returns; the synchronous code is moved to
      wait_for_termination.  There is no need to worry about reaping
      more than one child now.
      * sysdep.c (get_child_status, child_status_changed): New functions.
      (wait_for_termination): Now takes int * status and bool
      interruptible arguments, too.  Do not record child status change;
      that's now the caller's responsibility.  All callers changed.
      Reimplement in terms of get_child_status.
      (wait_for_termination_1, interruptible_wait_for_termination):
      Remove.  All callers changed to use wait_for_termination.
      * syswait.h: Include <stdbool.h>, for bool.
      (record_child_status_change, interruptible_wait_for_termination):
      Remove decls.
      (record_deleted_pid, child_status_changed): New decls.
      (wait_for_termination): Adjust to API changes noted above.
      
      Fixes: debbugs:12980
      bb5f74ee
    • Paul Eggert's avatar
      * bytecode.c, lisp.h (Qbytecode): Remove. · bc9dbce6
      Paul Eggert authored
      No longer needed after 2012-11-20 interactive-p changes.
      bc9dbce6
    • Eli Zaretskii's avatar
      Fix bug #13055 with cursor positioning inside scroll-margin. · 3cf3c607
      Eli Zaretskii authored
       src/xdisp.c (redisplay_window): If the cursor is visible, but inside
       the scroll margin, move point outside the margin.
      3cf3c607
    • Jan Djärv's avatar
      * gtkutil.c (my_log_handler): New function. · 005c8d13
      Jan Djärv authored
      (xg_set_geometry): Set log handler to my_log_handler.
      
      Fixes: debbugs:11177
      005c8d13
    • Dmitry Antipov's avatar
      * lisp.h (modify_region): Rename to... · 20edc1c9
      Dmitry Antipov authored
      (modify_region_1): ...new prototype.
      * textprop.c (modify_region): Now static.  Adjust users.
      * insdel.c (modify_region): Rename to...
      (modify_region_1): ...new function to work with current buffer.
      Adjust comment and users.  Use true and false for boolean arg.
      20edc1c9
    • Dmitry Antipov's avatar
      * alloc.c (free_save_value): New function. · 62c2e5ed
      Dmitry Antipov authored
      (safe_alloca_unwind): Use it.
      * lisp.h (free_save_value): New prototype.
      * editfns.c (save_excursion_save): Use Lisp_Misc_Save_Value.
      Add comment.
      (save_excursion_restore): Adjust to match saved data structure.
      Use free_save_value to offload some work from GC.  Drop obsolete
      #if 0 code.
      62c2e5ed
  8. 02 Dec, 2012 2 commits
    • Paul Eggert's avatar
      Fix xpalloc confusion after memory is exhausted. · 2dd2e622
      Paul Eggert authored
      * alloc.c (xpalloc): Comment fix.
      * charset.c (Fdefine_charset_internal): If xpalloc exhausts memory
      and signals an error, do not clear charset_table_size, as
      charset_table is still valid.
      * doprnt.c (evxprintf): Clear *BUF after freeing it.
      2dd2e622
    • Paul Eggert's avatar
      Use execve to avoid need to munge environ. · 21e54a94
      Paul Eggert authored
      * callproc.c (Fcall_process):
      * process.c (create_process):
      Don't save and restore environ;	no longer needed.
      * callproc.c (child_setup):
      Use execve, not execvp, to preserve environ.
      
      Fixes: debbugs:13054
      21e54a94
  9. 01 Dec, 2012 3 commits
  10. 30 Nov, 2012 1 commit
    • Juanma Barranquero's avatar
      src/doc.c: Fix bug#13034. · f8aff4c6
      Juanma Barranquero authored
      (Fdocumentation): Re-add handling of function-documentation,
      accidentally removed in 2012-11-09T04:10:16Z!monnier@iro.umontreal.ca.
      f8aff4c6