1. 01 May, 2017 1 commit
    • Paul Eggert's avatar
      Merge from gnulib · 634d0a90
      Paul Eggert authored
      This incorporates:
      2017-05-01 New module 'localtime-buffer'
      2017-04-30 utimens: Add support for native Windows
      * admin/merge-gnulib (AVOIDED_MODULES): Add tzset.
      * configure.ac (tzset): No need for Emacs itself to check now.
      * lib/gettimeofday.c, lib/time.in.h, lib/time_rz.c, lib/utimens.c:
      * m4/gettimeofday.m4, m4/time_h.m4, m4/time_rz.m4: Copy from gnulib.
      * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
      * lib/localtime-buffer.c, lib/localtime-buffer.h:
      * m4/localtime-buffer.m4: New files, copied from gnulib.
      * src/editfns.c (init_editfns): Assume tzset is callable.
      634d0a90
  2. 28 Mar, 2017 1 commit
  3. 05 Mar, 2017 2 commits
  4. 03 Mar, 2017 1 commit
  5. 02 Mar, 2017 1 commit
    • Paul Eggert's avatar
      Restore XFLOATINT but with restricted args · 56aaaf9b
      Paul Eggert authored
      Turn instances of extract_float into XFLOAT_DATA when possible,
      and to a resurrected XFLOATINT when the arg is a number.
      The resurrected XFLOATINT is more like XFLOAT and XINT in
      that is valid only if its arg is a number.  This clarifies
      the ways in which floats can be extracted at the C level.
      * src/editfns.c (styled_format):
      * src/floatfns.c (extract_float, Fexpt):
      Use XFLOATINT rather than open-coding it.
      * src/fns.c (internal_equal):
      * src/image.c (imagemagick_load_image):
      * src/xdisp.c (resize_mini_window):
      Prefer XFLOAT_DATA to extract_float on values known to be floats.
      * src/frame.c (x_set_screen_gamma):
      * src/frame.h (NUMVAL):
      * src/image.c (x_edge_detection, compute_image_size):
      * src/lread.c (read_filtered_event):
      * src/window.c (Fset_window_vscroll):
      * src/xdisp.c (handle_single_display_spec, try_scrolling)
      (redisplay_window, calc_pixel_width_or_height, x_produce_glyphs)
      (on_hot_spot_p):
      Prefer XFLOATINT to extract_float on values known to be numbers.
      * src/lisp.h (XFLOATINT): Bring back this function, except
      it now assumes its argument is a number.
      56aaaf9b
  6. 01 Mar, 2017 1 commit
    • Paul Eggert's avatar
      Fix rounding error in ‘ceiling’ etc. · 207ee94b
      Paul Eggert authored
      Without this fix, (ceiling most-negative-fixnum -1.0) returns
      most-negative-fixnum instead of correctly signaling range-error,
      and similarly for floor, round, and truncate.
      * configure.ac (trunc): Add a check, since Gnulib’s doc says
      ‘trunc’ is missing from MSVC 9.  The Gnulib doc says ‘trunc’ is
      also missing from some other older operating systems like Solaris
      9 which I know we don’t care about any more, so MSVC is the only
      reason to worry about ‘trunc’ here.
      * src/editfns.c (styled_format): Formatting a float with %c is now an
      error.  The old code did not work in general, because FIXNUM_OVERFLOW_P
      had rounding errors.  Besides, the "if (FLOATP (...))" was in there
      only as a result of my misunderstanding old code that I introduced
      2011.  Although %d etc. is sometimes used on floats that represent
      huge UIDs or PIDs etc. that do not fit in fixnums, this cannot
      happen with characters.
      * src/floatfns.c (rounding_driver): Rework to do the right thing
      when the intermediate result equals 2.305843009213694e+18, i.e.,
      is exactly 1 greater than MOST_POSITIVE_FIXNUM on a 64-bit host.
      Simplify so that only one section of code checks for overflow,
      rather than two.
      (double_identity): Remove.  All uses changed to ...
      (emacs_trunc): ... this new function.  Add replacement for
      platforms that lack ‘trunc’.
      * src/lisp.h (FIXNUM_OVERFLOW_P, make_fixnum_or_float):
      Make it clear that the arg cannot be floating point.
      * test/src/editfns-tests.el (format-c-float): New test.
      * test/src/floatfns-tests.el: New file, to test for this bug.
      207ee94b
  7. 01 Feb, 2017 2 commits
    • Paul Eggert's avatar
      Revamp quitting and fix infloops · b01ac672
      Paul Eggert authored
      This fixes some infinite loops that cannot be quitted out of,
      e.g., (defun foo () (nth most-positive-fixnum '#1=(1 . #1#)))
      when byte-compiled and when run under X.  See:
      http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00577.html
      This also attempts to keep the performance improvements I recently
      added, as much as possible under the constraint that the infloops
      must be caught.  In some cases this fixes infloop bugs recently
      introduced when I removed immediate_quit.
      * src/alloc.c (Fmake_list):
      Use rarely_quit, not maybe_quit, for speed in the usual case.
      * src/bytecode.c (exec_byte_code):
      * src/editfns.c (Fcompare_buffer_substrings):
      * src/fns.c (Fnthcdr):
      * src/syntax.c (scan_words, skip_chars, skip_syntaxes)
      (Fbackward_prefix_chars):
      Use rarely_quit so that users can C-g out of long loops.
      * src/callproc.c (call_process_cleanup, call_process):
      * src/fileio.c (read_non_regular, Finsert_file_contents):
      * src/indent.c (compute_motion):
      * src/syntax.c (scan_words, Fforward_comment):
      Remove now-unnecessary maybe_quit calls.
      * src/callproc.c (call_process):
      * src/doc.c (get_doc_string, Fsnarf_documentation):
      * src/fileio.c (Fcopy_file, read_non_regular, Finsert_file_contents):
      * src/lread.c (safe_to_load_version):
      * src/sysdep.c (system_process_attributes) [GNU_LINUX]:
      Use emacs_read_quit instead of emacs_read in places where
      C-g handling is safe.
      * src/eval.c (maybe_quit): Move comment here from lisp.h.
      * src/fileio.c (Fcopy_file, e_write):
      Use emacs_write_quit instead of emacs_write_sig in places where
      C-g handling is safe.
      * src/filelock.c (create_lock_file): Use emacs_write, not
      plain write, as emacs_write no longer has a problem.
      (read_lock_data): Use emacs_read, not read, as emacs_read
      no longer has a problem.
      * src/fns.c (rarely_quit): Move to lisp.h and rename to
      incr_rarely_quit.  All uses changed..
      * src/fns.c (Fmemq, Fmemql, Fassq, Frassq, Fplist_put, Fplist_member):
      * src/indent.c (compute_motion):
      * src/syntax.c (find_defun_start, back_comment, forw_comment)
      (Fforward_comment, scan_lists, scan_sexps_forward):
      Use incr_rarely_quit so that users can C-g out of long loops.
      * src/fns.c (Fnconc): Move incr_rarely_quit call to within
      inner loop, so that it catches C-g there too.
      * src/keyboard.c (tty_read_avail_input): Remove commented-out
      and now-obsolete code dealing with interrupts.
      * src/lisp.h (rarely_quit, incr_rarely_quit): New functions,
      the latter moved here from fns.c and renamed from rarely_quit.
      (emacs_read_quit, emacs_write_quit): New decls.
      * src/search.c (find_newline, search_buffer, find_newline1):
      Add maybe_quit to catch C-g.
      * src/sysdep.c (get_child_status): Always invoke maybe_quit
      if interruptible, so that the caller need not bother.
      (emacs_nointr_read, emacs_read_quit, emacs_write_quit):
      New functions.
      (emacs_read): Rewrite in terms of emacs_nointr_read.
      Do not handle C-g or signals; that is now for emacs_read_quit.
      (emacs_full_write): Replace PROCESS_SIGNALS two-way arg
      with INTERRUPTIBLE three-way arg.  All uses changed.
      b01ac672
    • Paul Eggert's avatar
      Remove immediate_quit. · 33be5003
      Paul Eggert authored
      The old code that sets and clears immediate_quit was
      ineffective except when Emacs is running in terminal mode, and
      has problematic race conditions anyway, so remove it.  This
      will introduce some hangs when Emacs runs in terminal mode,
      and these hangs should be fixed in followup patches.
      * src/keyboard.c (immediate_quit): Remove.  All uses removed.
      33be5003
  8. 28 Jan, 2017 1 commit
    • Eli Zaretskii's avatar
      Improve documentation of 'format' conversions · c331f393
      Eli Zaretskii authored
      * src/editfns.c (Fformat): More accurate description of %g and
      effects of the various flags on it.  More accurate description of
      integer conversions.
      
      * doc/lispref/strings.texi (Formatting Strings): More accurate
      description of %g and effects of the various flags on it.  More
      accurate description of integer conversions.  (Bug#25557)
      c331f393
  9. 26 Jan, 2017 2 commits
    • Paul Eggert's avatar
      Replace QUIT with maybe_quit · b3a3ed52
      Paul Eggert authored
      There’s no longer need to have QUIT stand for a slug of C statements.
      Use the more-obvious function-call syntax instead.
      Also, use true and false when setting immediate_quit.
      These changes should not affect the generated machine code.
      * src/lisp.h (QUIT): Remove.  All uses replaced by maybe_quit.
      b3a3ed52
    • Paul Eggert's avatar
      A quicker check for quit · 1392ec74
      Paul Eggert authored
      On some microbenchmarks this lets Emacs run 60% faster on my
      platform (AMD Phenom II X4 910e, Fedora 25 x86-64).
      * src/atimer.c: Include keyboard.h, for pending_signals.
      * src/editfns.c (Fcompare_buffer_substrings):
      * src/fns.c (Fnthcdr, Fmemq, Fmemql, Fassq, Frassq, Fplist_put)
      (Fnconc, Fplist_member):
      Set and clear immediate_quit before and after loop instead of
      executing QUIT each time through the loop.  This is OK for loops
      that affect only locals.
      * src/eval.c (process_quit_flag): Now static.
      (maybe_quit): New function, containing QUIT’s old body.
      * src/fns.c (rarely_quit): New function.
      (Fmember, Fassoc, Frassoc, Fdelete, Fnreverse, Freverse)
      (Flax_plist_get, Flax_plist_put, internal_equal, Fnconc):
      Use it instead of QUIT, for
      speed in tight loops that might modify non-locals.
      * src/keyboard.h (pending_signals, process_pending_signals):
      These belong to keyboard.c, so move them here ...
      * src/lisp.h: ... from here.
      (QUIT): Redefine in terms of the new maybe_quit function, which
      contains this macro’s old definiens.  This works well with branch
      prediction on processors with return stack buffers, e.g., x86
      other than the original Pentium.
      1392ec74
  10. 01 Jan, 2017 1 commit
  11. 24 Dec, 2016 1 commit
    • Hong Xu's avatar
      Fix timezone detection of parse-iso8601-time-string · 25c9cb77
      Hong Xu authored
      * parse-time.el (parse-iso8601-time-string): Fix timezone
      parsing.  Add a doc string.  (Bug#25086)
      * editfns.c (Fdecode-time): Doc fix.
      * emacs-mime.texi (time-date): Add an example for
      parse-iso8601-time-string.
      * parse-time-tests.el (parse-time-tests): Add tests for
      parse-iso8601-time-string.
      25c9cb77
  12. 20 Nov, 2016 2 commits
  13. 18 Nov, 2016 1 commit
    • Eli Zaretskii's avatar
      Improve documentation of functions that accept time values · 36bafc9c
      Eli Zaretskii authored
      * doc/lispref/os.texi (Time Calculations): Mention the meaning of
      'nil' or a scalar number as the time-value argument.  Add a
      cross-reference to 'float-time' for computing a time difference as
      a scalar number of seconds.
      
      * src/editfns.c (Fformat_time_string, Ftime_less_p)
      (Ftime_subtract, Ftime_add, Fdecode_time, Fcurrent_time_string)
      (Fcurrent_time_zone): Mention in the doc strings the meaning of
      nil argument and the fact that a time value can be a scalar number
      of seconds since the epoch.
      (Ftime_subtract): Mention 'float-time'.
      36bafc9c
  14. 17 Oct, 2016 2 commits
  15. 03 Oct, 2016 1 commit
  16. 30 Sep, 2016 1 commit
    • Paul Eggert's avatar
      Limit <config.h>’s includes · f4eb8900
      Paul Eggert authored
      This follows up on recent problems with the fact that config.h
      includes stdlib.h etc.; some files need to include stdlib.h later.
      config.h generally should limit itself to includes that are
      universally safe; outside of MS-Windows, only stdbool.h makes
      the cut among the files currently included.  So, move the
      other includes to just the files that need them (Bug#24506).
      * configure.ac (config_opsysfile): Remove, as this generic hook
      is no longer needed.
      * lib-src/etags.c, src/unexmacosx.c, src/w32.c, src/w32notify.c:
      * src/w32proc.c (_GNU_SOURCE):
      Remove, as it’s OK for config.h to do this now.
      * src/conf_post.h: Include <ms-w32.h>, instead of the generic
      config_opsysfile, for simplicity as this old way of configuring is
      now done only for the MS-Windows port.  Do not include <ms-w32.h>
      if DEFER_MS_W32_H, for the benefit of the few files that want its
      effects later.  Do not include <alloca.h>, <string.h>, or
      <stdlib.h>.  Other files modified to include these headers as
      needed, or to not include headers that are no longer needed.
      * src/lisp.h: Include <alloca.h> and <string.h> here, since
      some of the inline functions need them.
      * src/regex.c: Include <alloca.h> if not emacs.  (If emacs,
      we can rely on SAFE_ALLOCA.)  There is no longer any need to
      worry about HAVE_ALLOCA_H.
      * src/unexmacosx.c: Rely on config.h not including stdlib.h.
      * src/w32.c, src/w32notify.c, src/w32proc.c (DEFER_MS_W32_H):
      Define before including <config.h> first, and include <ms-w32.h>
      after the troublesome headers.
      f4eb8900
  17. 24 Sep, 2016 1 commit
    • Paul Eggert's avatar
      Improve integer overflow handling a bit · b3e1b382
      Paul Eggert authored
      * src/charset.c (read_hex): Use INT_LEFT_SHIFT_OVERFLOW for clarity.
      The machine code is the same on my platform.
      * src/doprnt.c (doprnt):
      * src/emacs-module.c (module_funcall):
      * src/font.c (font_intern_prop):
      * src/keyboard.c (Frecursion_depth):
      * src/lread.c (read1):
      Use WRAPV macros instead of checking overflow by hand.
      * src/editfns.c (hi_time, time_arith, decode_time_components):
      * src/emacs-module.c (Fmodule_load):
      Simplify by using FIXNUM_OVERFLOW_P.
      * src/emacs-module.c: Include intprops.h.
      * src/xdisp.c (percent99): New function.
      (decode_mode_spec): Use it to simplify overflow avoidance and
      formatting of %p and %P.
      b3e1b382
  18. 23 Sep, 2016 1 commit
  19. 16 Sep, 2016 1 commit
  20. 31 Aug, 2016 2 commits
    • Paul Eggert's avatar
    • Paul Eggert's avatar
      Minor doc quoting fixes · 6f40b8b2
      Paul Eggert authored
      * doc/misc/htmlfontify.texi (Interactive):
      * lisp/htmlfontify.el (htmlfontify-buffer):
      Spell out character names, for clarity.  The old doc string
      generated the *Help* text ‘^L ([FF]) or ¤ (244)’, where ‘[FF]’
      stands for a form feed character; this was confusing.
      * lisp/electric.el (electric-quote-mode):
      * src/doc.c (syms_of_doc):
      * src/editfns.c (Fformat_message):
      Remove no-longer-necessary ‘\=’s in doc strings.
      6f40b8b2
  21. 20 Aug, 2016 1 commit
    • Philipp Stephani's avatar
      Some assorted documentation clarifications · 9b99772c
      Philipp Stephani authored
      * src/fileio.c (Fwrite_region): Clarify that END is ignored if
      START is nil.
      * src/editfns.c (Fbuffer_size): Add short discussion about
      narrowing.
      * src/callproc.c (Fcall_process_region): Discuss behavior when
      START and END are not buffer positions.
      9b99772c
  22. 23 Jul, 2016 1 commit
    • Noam Postavsky's avatar
      Adjust match data before calling after-change-funs · 66f95e0d
      Noam Postavsky authored
      It's important to adjust the match data in between calling
      before-change-functions and after-change-functions, so that buffer
      change hooks will always see match-data consistent with buffer content.
      (Bug #23917)
      
      * src/insdel.c (replace_range): Add new parameter ADJUST_MATCH_DATA, if
      true call update_search_regs.  Update all callers (except
      Freplace_match) to pass 0 for the new parameter.
      * src/search.c (update_search_regs): New function, extracted from
      Freplace_match.
      (Freplace_match): Remove match data adjustment code, pass 1 for
      ADJUST_MATCH_DATA to replace_range instead.
      66f95e0d
  23. 20 Jul, 2016 1 commit
    • Paul Eggert's avatar
      Fix lifetime bug in tzlookup · 852111f3
      Paul Eggert authored
      * src/editfns.c (tzlookup): Fix storage lifetime bug when
      INTEGERP (zone) && settz.  Problem found by Coverity Scan.
      852111f3
  24. 19 Jul, 2016 1 commit
    • Eli Zaretskii's avatar
      Fix 'transpose-regions' when LEAVE-MARKERS arg is non-nil · 00b66476
      Eli Zaretskii authored
      * src/insdel.c (adjust_markers_bytepos): New function.
      * src/lisp.h (adjust_markers_bytepos): Add prototype.
      * src/insdel.c (replace_range, replace_range_2):
      * src/editfns.c (Ftranspose_regions): Call
      adjust_markers_bytepos.  (Bug#5131)
      
      * test/src/editfns-tests.el (transpose-test-reverse-word)
      (transpose-test-get-byte-positions): New functions.
      (transpose-ascii-regions-test)
      (transpose-nonascii-regions-test-1)
      (transpose-nonascii-regions-test-2): New tests.
      00b66476
  25. 15 Jul, 2016 1 commit
  26. 09 Jul, 2016 1 commit
    • Eli Zaretskii's avatar
      Minor tweaks of copying text properties when padding strings · 0a2aedfe
      Eli Zaretskii authored
      * src/editfns.c (styled_format): Don't include padding on the left
      in the properties at the beginning of the string.  (Bug#23897)
      
      * test/src/editfns-tests.el (format-properties): Add tests for
      faces when the string is padded on the left or on the right.
      0a2aedfe
  27. 08 Jul, 2016 1 commit
    • Eli Zaretskii's avatar
      Yet another fix for copying properties by 'format' · d8a9c450
      Eli Zaretskii authored
      * src/textprop.c (extend_property_ranges): Accept an additional
      argument OLD_END, and only extend the end of a property range if
      its original end is at OLD_END; all the other ranges are left
      intact.  (Bug#23897)
      * src/editfns.c (styled_format): Pass the original length of the
      string to 'extend_property_ranges'.
      * src/intervals.h (extend_property_ranges): Adjust prototype.
      
      * test/src/editfns-tests.el (format-properties): Add tests for
      bug#23897.
      d8a9c450
  28. 13 Jun, 2016 1 commit
    • Paul Eggert's avatar
      Call tzset after setting TZ · 98162445
      Paul Eggert authored
      * src/editfns.c (tzlookup): Call tzset after setting TZ, so that
      the setting change propagates into Emacs local time (Bug#23600).
      (emacs_setenv_TZ): Clarify comments.
      98162445
  29. 09 Jun, 2016 1 commit
    • Eli Zaretskii's avatar
      Fix copying text properties by 'format' · 1c094238
      Eli Zaretskii authored
      * src/editfns.c (styled_format): Fix copying text properties from
      the format specification to the produced string representation.
      (Bug#23730)
      (Fformat) Doc fix.
      
      * doc/lispref/strings.texi (Formatting Strings): Document that
      text properties from the format specifiers are also copied to the
      produced string.
      1c094238
  30. 08 Jun, 2016 2 commits
  31. 10 May, 2016 1 commit
    • Paul Eggert's avatar
      'text-quoting-style' now affects only ` and ' · 433d366d
      Paul Eggert authored
      Change 'text-quoting-style' so that it no longer affects
      formatting of curved quotes in format arguments to functions like
      'message'.  In particular, when this variable's value is 'grave',
      all quotes in formats are output as-is.
      * doc/lispref/help.texi (Keys in Documentation):
      * doc/lispref/strings.texi (Formatting Strings):
      * doc/lispref/tips.texi (Documentation Tips):
      * etc/NEWS:
      * src/doc.c (syms_of_doc): Document this.
      * lisp/help-fns.el (describe-function-1):
      * src/doc.c (text_quoting_style, Fsubstitute_command_keys)
      (syms_of_doc):
      * src/editfns.c (styled_format): Omit now-unnecessary code.
      * src/lisp.h (LEAVE_QUOTING_STYLE): Remove.
      433d366d
  32. 09 May, 2016 1 commit
  33. 04 May, 2016 1 commit
    • Alan Mackenzie's avatar
      Allow `text-quoting-style' to be `leave', i.e. no translation of quotes. · 32f5bf0c
      Alan Mackenzie authored
      * lisp/help-fns.el (describe-function-1): Don't set coding system to UTF-8
      when text-quoting-style is `leave'.
      
      * src/lisp.h (enum text_quoting_style): Add identifier LEAVE_QUOTING_STYLE.
      
      * src/doc.c (syms_of_doc): New symbol "leave".  Amend doc string of
      `text_quoting_style'.
      (text_quoting_style): Handle `leave' by returning LEAVE_QUOTING_STYLE.
      (Fsubstitute_command_keys): Don't translate quotes when quoting_style is
      LEAVE_QUOTING_STYLE.
      
      * src/editfns.c (styled_format): Set quoting_style to -1 when
      text-quoting-style is `leave'.
      32f5bf0c