1. 10 Jul, 2013 4 commits
    • Paul Eggert's avatar
      Port to C89. · 29abe551
      Paul Eggert authored
      * 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...
      29abe551
    • Paul Eggert's avatar
      Syntax cleanup, mostly replacing macros with functions. · 45b683a1
      Paul Eggert authored
      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.
      45b683a1
    • Jan Djärv's avatar
      * emacs.c (main): Fix syntax error. · 29be4a50
      Jan Djärv authored
      29be4a50
    • Paul Eggert's avatar
      Timestamp fixes for undo. · 954b166e
      Paul Eggert authored
      * 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.
      
      Fixes: debbugs:14824
      954b166e
  2. 09 Jul, 2013 3 commits
    • Ken Brown's avatar
    • Juanma Barranquero's avatar
    • Paul Eggert's avatar
      Handle errno and exit status a bit more carefully. · 4ebbdd67
      Paul Eggert authored
      * 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.
      4ebbdd67
  3. 08 Jul, 2013 1 commit
  4. 07 Jul, 2013 6 commits
    • Paul Eggert's avatar
      Port to Ubuntu 10. · 9caab067
      Paul Eggert authored
      Problem reported by T.V. Raman.
      * configure.ac (accept4): New function to check for.
      * src/process.c (close_on_exec, accept4, process_socket):
      Define these if !HAVE_ACCEPT4, not if !SOCK_CLOEXEC.
      
      Fixes: debbugs:14803
      9caab067
    • Juanma Barranquero's avatar
      ChangeLog fixes. · 5165d44a
      Juanma Barranquero authored
      5165d44a
    • Eli Zaretskii's avatar
      MS-Windows followup for 2013-07-07T18:00:14Z!eggert@cs.ucla.edu. · 1d442672
      Eli Zaretskii authored
       nt/inc/sys/socket.h (F_SETFD, O_CLOEXEC, F_DUPFD_CLOEXEC)
       (FD_CLOEXEC): New macros.
      
       src/w32.c (sys_dup): Declare prototype.
      
       src/filelock.c:
       src/emacs.c:
       src/callproc.c [WINDOWSNT]: Include sys/socket.h.
      1d442672
    • Paul Eggert's avatar
      Make file descriptors close-on-exec when possible. · 067428c1
      Paul Eggert authored
      This simplifies Emacs a bit, since it no longer needs to worry
      about closing file descriptors by hand in some cases.
      It also fixes some unlikely races.  Not all such races, as
      libraries often open files internally without setting
      close-on-exec, but it's an improvement.
      * admin/merge-gnulib (GNULIB_MODULES): Add fcntl, pipe2.
      (GNULIB_TOOL_FLAGS): Avoid binary-io, close.  Do not avoid fcntl.
      * configure.ac (mkostemp): New function to check for.
      (PTY_OPEN): Pass O_CLOEXEC to posix_openpt.
      * lib/fcntl.c, lib/getdtablesize.c, lib/pipe2.c, m4/fcntl.m4:
      * m4/getdtablesize.m4, m4/pipe2.m4: New files, taken from gnulib.
      * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
      * nt/gnulib.mk: Remove empty gl_GNULIB_ENABLED_verify section;
      otherwise, gnulib-tool complains given close-on-exec changes.
      * nt/inc/ms-w32.h (pipe): Remove.
      * nt/mingw-cfg.site (ac_cv_func_fcntl, gl_cv_func_fcntl_f_dupfd_cloexec)
      (gl_cv_func_fcntl_f_dupfd_works, ac_cv_func_pipe2): New vars.
      * src/alloc.c (valid_pointer_p) [!WINDOWSNT]:
      * src/callproc.c (Fcall_process) [!MSDOS]:
      * src/emacs.c (main) [!DOS_NT]:
      * src/nsterm.m (ns_term_init):
      * src/process.c (create_process):
      Use 'pipe2' with O_CLOEXEC instead of 'pipe'.
      * src/emacs.c (Fcall_process_region) [HAVE_MKOSTEMP]:
      * src/filelock.c (create_lock_file) [HAVE_MKOSTEMP]:
      Prefer mkostemp with O_CLOEXEC to mkstemp.
      * src/callproc.c (relocate_fd) [!WINDOWSNT]:
      * src/emacs.c (main): Use F_DUPFD_CLOEXEC, not plain F_DUPFD.
      No need to use fcntl (..., F_SETFD, FD_CLOEXEC), since we're
      now using pipe2.
      * src/filelock.c (create_lock_file) [! HAVE_MKOSTEMP]:
      Make the resulting file descriptor close-on-exec.
      * src/lisp.h, src/lread.c, src/process.c (close_load_descs, close_process_descs):
      * src/lread.c (load_descriptor_list, load_descriptor_unwind):
      Remove; no longer needed.  All uses removed.
      * src/process.c (SOCK_CLOEXEC): Define to 0 if not supplied by system.
      (close_on_exec, accept4, process_socket) [!SOCK_CLOEXEC]:
      New functions.
      (socket) [!SOCK_CLOEXEC]: Supply a substitute.
      (Fmake_network_process, Fnetwork_interface_list):
      (Fnetwork_interface_info, server_accept_connection):
      Make newly-created socket close-on-exec.
      * src/sysdep.c (emacs_open, emacs_fopen):
      Make new-created descriptor close-on-exec.
      * src/w32.c (fcntl): Support F_DUPFD_CLOEXEC well enough for Emacs.
      * src/w32.c, src/w32.h (pipe2): Rename from 'pipe', with new flags arg.
      
      Fixes: debbugs:14803
      067428c1
    • Jan Djärv's avatar
      *** empty log message *** · 0da857dd
      Jan Djärv authored
      0da857dd
    • Paul Eggert's avatar
      Fix openp errno handling. · 5f86adcd
      Paul Eggert authored
      * callproc.c (Fcall_process): Preserve openp errno around close.
      * lread.c (openp): Set errno when returning -1, as some callers
      expect this.
      5f86adcd
  5. 06 Jul, 2013 4 commits
    • Jan Djärv's avatar
      * lisp/files.el (write-file): Do not display confirm dialog for NS, · 1afb1d07
      Jan Djärv authored
      it does its own dialog, which can't be cancelled.
      
      * src/nsfns.m: Remove panelOK.
      (ns_fd_data): New.
      (ns_run_file_dialog): New function.
      (Fns_read_file_name): Fill in ns_fd_data, post an event and start the
      event loop, so file dialog is popped up by ns_run_file_dialog, called
      by sendEvent (Bug#14578).
      (EmacsSavePanel, EmacsOpenPanel): Remove ok and cancel methods.
      
      * src/nsterm.h (NSSavePanel): Update comment.
      (NSAPP_DATA2_RUNFILEDIALOG): Define.
      (ns_run_file_dialog): Declare.
      
      * src/nsterm.m (sendEvent:): Handle NSAPP_DATA2_RUNFILEDIALOG.
      1afb1d07
    • Eli Zaretskii's avatar
      Fix bug #14771 with scroll-step = 1 and non-nil line-spacing. · fdda0220
      Eli Zaretskii authored
       src/xdisp.c (default_line_pixel_height): New function.
       (pos_visible_p, move_it_vertically_backward, try_scrolling)
       (try_cursor_movement, redisplay_window, try_window)
       (try_window_id): Use it instead of FRAME_LINE_HEIGHT.  (Bug#14771)
       src/window.c (window_scroll_pixel_based): use
       default_line_pixel_height.
       src/dispextern.h (default_line_pixel_height): Add prototype.
       src/frame.c (x_set_line_spacing): Accept a float value for
       line-spacing parameter, per the documentation.
      fdda0220
    • Eli Zaretskii's avatar
      Clarify documentation of multibyte-string-p. · 3323c263
      Eli Zaretskii authored
       src/data.c (Fmultibyte_string_p): Doc fix.
      
       doc/lispref/nonascii.texi (Text Representations): Document that
       multibyte-string-p returns nil for non-string objects.
      3323c263
    • Paul Eggert's avatar
      Use emacs_open more consistently when opening files. · 406af475
      Paul Eggert authored
      This handles EINTR more consistently now, and makes it easier
      to introduce other uniform changes to file descriptor handling.
      * src/systdio.h: New file.
      * src/buffer.c (mmap_init):
      * cygw32.c (chdir_to_default_directory):
      * dispnew.c (Fopen_termscript):
      * emacs.c (Fdaemon_initialized):
      * fileio.c (Fdo_auto_save):
      * image.c (slurp_file, png_load_body, jpeg_load_body):
      * keyboard.c (Fopen_dribble_file):
      * lread.c (Fload):
      * print.c (Fredirect_debugging_output):
      * sysdep.c (get_up_time, procfs_ttyname, procfs_get_total_memory):
      * termcap.c (tgetent):
      * unexaix.c, unexcoff.c (unexec, adjust_lnnoptrs):
      * unexcw.c, unexelf.c, unexhp9k800.c, unexmacosx.c (unexec):
      * w32term.c (w32_initialize) [CYGWIN]:
      * xfaces.c (Fx_load_color_file):
      Use emacs_open instead of plain open, and emacs_fopen instead of
      plain fopen.
      * dispnew.c, fileio.c, image.c, keyboard.c, lread.c, print.c, sysdep.c:
      * xfaces.c: Include sysstdio.h rather than stdio.h, for emacs_fopen.
      * callproc.c (default_output_mode): New constant.
      (Fcall_process): Use it to call emacs_open instead of plain creat.
      * dispnew.c (Fopen_termscript): Fix minor race in opening termscript.
      * sysdep.c (emacs_open): Add commentary and don't call file name "path".
      (emacs_fopen): New function.
      * unexaix.c, unexcoff.c, unexelf.c, unexhp9k800.c, unexmacosx.c:
      Include <lisp.h>, for emacs_open.
      * unexelf.c (fatal): Remove decl; not needed with <lisp.h> included.
      406af475
  6. 05 Jul, 2013 1 commit
    • Paul Eggert's avatar
      Remove duplicate #include directives. · 47ba6d43
      Paul Eggert authored
      * alloc.c [GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES]:
      * xfaces.c:
      Don't include stdio.h twice.
      * buffer.c [USE_MMAP_FOR_BUFFERS]:
      Don't include sys/types.h or stdio.h twice.
      * fileio.c [WINDOWSNT | MSDOS]: Don't include fcntl.h twice.
      * lread.c: Don't include coding.h twice.
      * nsfont.m: Don't include frame.h twice.
      * process.c [HAVE_RES_INIT]: Don't include <netinet/in.h> twice.
      * ralloc.c: Don't include <unistd.h> twice.
      * xdisp.c: Don't include font.h twice.
      * xterm.c: Don't include fontset.h twice.
      * xterm.h [USE_X_TOOLKIT]: Don't include X11/StringDefs.h twice.
      47ba6d43
  7. 04 Jul, 2013 6 commits
  8. 02 Jul, 2013 5 commits
    • Paul Eggert's avatar
      Remove some unused macros from 'configure'. · 57f8c490
      Paul Eggert authored
      * configure.ac (HAVE_SOUNDCARD_H, HAVE_LINUX_VERSION_H, HAVE_SPEED_T)
      (HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY)
      (HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION, HAVE_UTIMES)
      (HAVE_LIBHESIOD, HAVE_LIBRESOLV, HAVE_LIBCOM_ERR, HAVE_LIBCRYPTO)
      (HAVE_LIBK5CRYPTO, HAVE_LIBKRB5, HAVE_LIBDES425, HAVE_LIBDES)
      (HAVE_LIBKRB4, HAVE_LIBKRB, HAVE_DES_H, HAVE_KERBEROSIV_DES_H)
      (HAVE_DEV_PTMX, DEVICE_SEP, USG5):
      Remove these macros, as they are not used.
      (sys_siglist): Remove macro; src/sysdep.c now does this.
      * src/sysdep.c (sys_siglist) [HAVE_DECL___SYS_SIGLIST]:
      Define to __sys_siglist.
      57f8c490
    • Eli Zaretskii's avatar
      Fix bug #2749 with overflow-newline-into-fringe in visual-line-mode. · bcffb5ca
      Eli Zaretskii authored
       src/xdisp.c (IT_OVERFLOW_NEWLINE_INTO_FRINGE): Don't disallow
       word-wrap, so that overflow-newline-into-fringe would work in
       visual-line-mode.
       (move_it_in_display_line_to): When the last scanned display
       element fits exactly on the display line, and
       overflow-newline-into-fringe is non-nil, but wrap_it is valid,
       don't return MOVE_NEWLINE_OR_CR, but instead back up to the last
       wrap point and return MOVE_LINE_CONTINUED.  Fixes problems with
       finding buffer position that corresponds to pixel coordinates,
       e.g. in buffer_posn_from_coords.
      bcffb5ca
    • Jan Djärv's avatar
    • Paul Eggert's avatar
      Don't convert function pointers to void * and back. · 52a9bcae
      Paul Eggert authored
      It isn't portable C, and it's easy enough to avoid.
      * alloc.c: Verify SAVE_FUNCPOINTER bits, too.
      (make_save_value): Add support for SAVE_FUNCPOINTER.
      * keymap.c (map_keymap_char_table_item, map_keymap_internal):
      * print.c (print_object):
      Distinguish function from object pointers.
      * lisp.h (SAVE_FUNCPOINTER): New constant.
      (SAVE_SLOT_BITS): Adjust to it.
      (SAVE_TYPE_FUNCPTR_PTR_OBJ): New constant, replacing
      SAVE_TYPE_PTR_PTR_OBJ.  Change the only use.
      (voidfuncptr): New typedef.
      (struct Lisp_Save_Value): New member data[0].funcpointer.
      (XSAVE_FUNCPOINTER): New function.
      52a9bcae
    • Paul Eggert's avatar
      Simplify buildobj processing. · c2418359
      Paul Eggert authored
      * Makefile.in (buildobj.h): Make it a sequence of strings each
      followed by comma, rather than a single string.  Put it into a
      .tmp file in case there's an error while generating it.
      (gl-stamp): Use .tmp for temp files.
      (mostlyclean): Clean .tmp files.
      * doc.c (buildobj): Move to just the routine that needs it.
      It's now an array of strings, so processing is simpler.
      c2418359
  9. 01 Jul, 2013 3 commits
  10. 30 Jun, 2013 7 commits
    • Michal Nazarewicz's avatar
      Add `remember-notes' function to store random notes across Emacs · ef099a94
      Michal Nazarewicz authored
      restarts.
      * remember.el (remember-data-file): Add :set callback to affect
      notes buffer (if any).
      (remember-notes): New command.
      (remember-notes-buffer-name, bury-remember-notes-on-kill):
      New defcustoms for the `remember-notes' function.
      (remember-notes-save-and-bury-buffer): New command.
      (remember-notes-mode-map): New variable.
      (remember-mode): New minor mode.
      (remember-notes--kill-buffer-query): New function.
      * lisp/startup.el (initial-buffer-choice): Add notes to custom type.
      * src/buffer.c (FKill_buffer): Run `kill-buffer-query-functions'
      before checking whether buffer is modified.  This lets
      `kill-buffer-query-functions' cancel killing of the buffer or save
      its content before `kill-buffer' asks user the "Buffer %s
      modified; kill anyway?" question.
      
      * remember.el (remember-append-to-file):
      Don't mix `find-buffer-visiting' and `get-file-buffer'.
      
      * lisp/files.el (find-file-noselect): Simplify conditional expression.
      ef099a94
    • Jan Djärv's avatar
      * nsfns.m (handlePanelKeys): Don't process Command+Function keys. · 9d3f2fc2
      Jan Djärv authored
      Let the super performKeyEquivalent deal with them.
      
      Fixes: debbugs:14747
      9d3f2fc2
    • Paul Eggert's avatar
      Fix minor problems found by static checking. · 1d71c1d9
      Paul Eggert authored
      * lwlib/lwlib-Xaw.h (xaw_update_one_value, xaw_popup_menu):
      * lwlib/lwlib-Xlw.h (xlw_update_one_value, xlw_pop_instance):
      * lwlib/lwlib.h (lw_allow_resizing, lw_set_main_areas) [!USE_MOTIF]:
      Now const.
      * src/widget.c (resize_cb): Remove unused local.
      1d71c1d9
    • Paul Eggert's avatar
      Remove duplicate ChangeLog entry. · 16b6e7f2
      Paul Eggert authored
      16b6e7f2
    • Paul Eggert's avatar
      Do not use GTK 3 if it exists but cannot be compiled. · 8f5f35cc
      Paul Eggert authored
      * configure.ac: Leave GTK_OBJ and term_header alone if GTK 3
      exists but cannot be compiled.
      * src/xmenu.c (x_menu_wait_for_event) [!USE_GTK]:
      * src/xterm.c (x_error_handler) [!USE_GTK]:
      Do not use GTK 3.
      8f5f35cc
    • Paul Eggert's avatar
      * intervals.c (get_local_map): Actually clip POSITION · e6c6c8c7
      Paul Eggert authored
      Fixes: debbugs:14753
      e6c6c8c7
    • Eli Zaretskii's avatar
      A possible fix for bug #14753 with aborts in get_local_map. · 5d1c3286
      Eli Zaretskii authored
       src/intervals.c (get_local_map): Instead of aborting, clip POSITION
       to the valid range of values.
      5d1c3286