1. 30 Jun, 2018 1 commit
  2. 29 Jun, 2018 1 commit
    • Eli Zaretskii's avatar
      Speed up replace-buffer-contents · eec71ebd
      Eli Zaretskii authored
      * src/editfns.c (EXTRA_CONTEXT_FIELDS): Add a_unibyte and
      b_unibyte members.
      (rbc_quitcounter): New static variable.
      (Freplace_buffer_contents): Initialize a_unibyte, b_unibyte, and
      rbc_quitcounter.  Inhibit modification hooks if they were not
      already inhibited.  Use rarely_quit to allow user to quit, to
      avoid calling maybe_quit too frequently (which hurts performance).
      Remove redundant assertions (which hurt performance too much).
      Call signal_after_change and update_compositions after all the
      changes are done.
      (buffer_chars_equal): Remove redundant assertions (which hurt
      performance).  Avoid using BUF_FETCH_CHAR_AS_MULTIBYTE, which
      hurts performance by referencing Lisp symbols; instead, use
      lower-level macros with explicit tests to select which macro to
      use.  (Bug#31888)
  3. 23 Jun, 2018 2 commits
  4. 22 Jun, 2018 1 commit
  5. 15 Jun, 2018 1 commit
  6. 03 Jun, 2018 3 commits
    • Paul Eggert's avatar
      Centralize Bug#30931 fix · 51ee8bc4
      Paul Eggert authored
      * src/marker.c (detach_marker): New function.
      * src/editfns.c (save_restriction_restore):
      * src/insdel.c (signal_before_change): Use it.
      (cherry picked from commit 6f66a43d)
    • Noam Postavsky's avatar
      Fix another case of freed markers in the undo-list (Bug#30931) · daa60233
      Noam Postavsky authored
      * src/alloc.c (free_marker): Remove.
      * src/editfns.c (save_restriction_restore):
      * src/insdel.c (signal_before_change): Detach the markers from the
      buffer when we're done with them instead of calling free_marker on
      * test/src/editfns-tests.el (delete-region-undo-markers-1)
      (delete-region-undo-markers-2): New tests.
      (cherry picked from commit 96b8747d)
    • Paul Eggert's avatar
      Fix CHECK_ALLOCATED_AND_LIVE abort during GC · 7460840a
      Paul Eggert authored
      * src/editfns.c (save_restriction_restore):
      Wait for the GC to free the temporary markers (Bug#30931).
      (cherry picked from commit 670f2ffa)
  7. 06 Jan, 2018 1 commit
  8. 01 Jan, 2018 1 commit
  9. 03 Dec, 2017 1 commit
    • Paul Eggert's avatar
      Fix bug in i18n/l10n optimization · 04e5b28f
      Paul Eggert authored
      This fixes a off-by-one buffer overrun bug introduced in
      2017-06-04T15:39:37Z!eggert@cs.ucla.edu.  Problem uncovered by an
      experimental version of Emacs built with -fcheck-pointer-bounds
      and running on Intel MPX hardware.
      * src/editfns.c (styled_format): Avoid overrunning internal buffers.
  10. 22 Nov, 2017 1 commit
  11. 28 Oct, 2017 1 commit
    • Glenn Morris's avatar
      Fix some doc typos · e6b4e5ff
      Glenn Morris authored
      * lisp/calendar/todo-mode.el (todo-next-item)
      (todo-previous-item, todo-toggle-item-header):
      * lisp/window.el (move-to-window-group-line):
      * src/editfns.c (Fformat):
      * test/lisp/calendar/todo-mode-tests.el (todo-test-move-item05):
      Fix doc typos.
      ; And in some comments.
  12. 18 Oct, 2017 1 commit
    • Paul Eggert's avatar
      Improve format-time-string doc · 8ca6fa58
      Paul Eggert authored
      * doc/lispref/os.texi (Time Parsing): Fix some errors in the
      documentation for format-time-string.  Document ^, #, %s, and %z
      with colons.  Say that unrecognized sequences are output as-is.
      * src/editfns.c (Fformat_time_string): %S can stand for 60.
      Also mention unrecognized sequences.
  13. 06 Oct, 2017 1 commit
  14. 04 Oct, 2017 1 commit
    • Paul Eggert's avatar
      Speed up (format "%s" STRING) and the like · 3db388b0
      Paul Eggert authored
      Although the Lisp manual said that ‘format’ returns a
      newly-allocated string, this was not true for a few cases like
      (format "%s" ""), and fixing the documentation to allow reuse of
      arguments lets us improve performance in common cases like
      (format "foo") and (format "%s" "foo") (Bug#28625).
      * doc/lispref/strings.texi (Formatting Strings):
      * etc/NEWS:
      Say that the result of ‘format’ might not be newly allocated.
      * src/callint.c (Fcall_interactively):
      * src/dbusbind.c (XD_OBJECT_TO_STRING):
      * src/editfns.c (Fmessage, Fmessage_box):
      * src/xdisp.c (vadd_to_log, Ftrace_to_stderr):
      Just use Fformat or Fformat_message, as that’s simpler and no
      longer makes unnecessary copies.
      * src/editfns.c (styled_format): Remove last argument, as it
      is no longer needed: all callers now want it to behave as if it
      were true.  All remaining callers changed.  Make this function
      static again.  Simplify the function now that we no longer
      need to worry about whether the optimization is allowed.
  15. 27 Sep, 2017 1 commit
  16. 26 Sep, 2017 1 commit
    • Paul Eggert's avatar
      Avoid some unnecessary copying in Fformat etc. · 0e82fa34
      Paul Eggert authored
      This patch is just for performance; it should not affect behavior.
      On my platform, it made the microbenchmark (format "%S" load-path)
      run about 45% faster.  It should also speed up calls like (message
      "%s" STRING).
      * src/callint.c (Fcall_interactively):
      * src/dbusbind.c (XD_OBJECT_TO_STRING):
      * src/editfns.c (Fmessage, Fmessage_box):
      * src/xdisp.c (vadd_to_log, Ftrace_to_stderr):
      Use styled_format instead of Fformat or Fformat_message,
      to avoid unnecessary copying.
      * src/editfns.c (styled_format): New arg NEW_RESULT.
      All uses changed.  Reuse an input string if it has the
      right value and if !NEW_RESULT.
      * src/lisp.h (style_format): New decl.
  17. 18 Sep, 2017 1 commit
    • Paul Eggert's avatar
      Fix format-time-string %Z bug with negative tz · 541006c5
      Paul Eggert authored
      * src/editfns.c (tzlookup): Fix sign error in %Z when a purely
      numeric zone is negative (Bug#28746).
      * test/src/editfns-tests.el (format-time-string-with-zone):
      Add test for this bug.
  18. 13 Sep, 2017 1 commit
    • Paul Eggert's avatar
      Prefer HTTPS to FTP and HTTP in documentation · bc511a64
      Paul Eggert authored
      Most of this change is to boilerplate commentary such as license URLs.
      This change was prompted by ftp://ftp.gnu.org's going-away party,
      planned for November.  Change these FTP URLs to https://ftp.gnu.org
      instead.  Make similar changes for URLs to other organizations moving
      away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
      fsf.org when this works, as this will further help defend against
      man-in-the-middle attacks (for this part I omitted the MS-DOS and
      MS-Windows sources and the test tarballs to keep the workload down).
      HTTPS is not fully working to lists.gnu.org so I left those URLs alone
      for now.
  19. 09 Sep, 2017 2 commits
    • Paul Eggert's avatar
      Improve --enable-gcc-warnings for MinGW64 · d6312354
      Paul Eggert authored
      This partially reverts my 2016-05-30 patch.  Apparently MinGW64
      still requires pacifications that GCC 7.1.1 x86-64 (Fedora 26)
      does not.  Also, pacify tparam.c, which isn’t used on Fedora.
      * lib-src/etags.c (process_file_name, TeX_commands):
      * src/buffer.c (fix_overlays_before):
      * src/data.c (Fmake_variable_buffer_local, cons_to_unsigned)
      * src/editfns.c (Ftranslate_region_internal):
      Prefer UNINIT to some stray value, as this simplifies
      code-reading later.
      * src/eval.c (CACHEABLE): New macro.
      (internal_lisp_condition_case): Use it.
      * src/tparam.c (tparam1): Use FALLTHROUGH to pacify GCC.
    • Eli Zaretskii's avatar
      Fix compilation warnings in MinGW64 build using GCC 7 · 2b84c166
      Eli Zaretskii authored
      Reported by Richard Copley <rcopley@gmail.com>.
      * src/w32heap.c (init_heap): Declare enable_lfh only for
      mingw.org's MinGW build.
      * src/w32console.c (w32con_write_glyphs):
      * src/unexw32.c (get_section_info, COPY_CHUNK, unexec): Fix some
      mismatches of data type vs format spec.
      * src/w32fns.c (compute_tip_xy):
      * src/w32proc.c (stop_timer_thread):
      * src/w32notify.c (remove_watch):
      * src/eval.c (internal_lisp_condition_case):
      * src/editfns.c (Ftranslate_region_internal):
      * src/data.c (Fmake_variable_buffer_local, cons_to_unsigned)
      * src/buffer.c (fix_overlays_before): Initialize variables to
      avoid compiler warnings.
      * lib-src/etags.c (TeX_commands, process_file_name): Initialize
      variables to avoid compilation warnings.
  20. 06 Jul, 2017 1 commit
    • Paul Eggert's avatar
      Convert hex digits more systematically · d6662694
      Paul Eggert authored
      This makes the code a bit smaller and presumably faster, as
      it substitutes a single lookup for conditional jumps.
      * src/character.c (hexdigit): New constant.
      (syms_of_character) [HEXDIGIT_IS_CONST]: Initialize it.
      * src/character.h (HEXDIGIT_CONST, HEXDIGIT_IS_CONST): New macros.
      (hexdigit): New decl.
      (char_hexdigit): New inline function.
      * src/charset.c: Do not include c-ctype.h.
      * src/charset.c (read_hex):
      * src/editfns.c (styled_format):
      * src/image.c (xbm_scan):
      * src/lread.c (read_escape):
      * src/regex.c (ISXDIGIT) [emacs]:
      Use char_hexdigit insted of doing it by hand.
  21. 22 Jun, 2017 1 commit
  22. 17 Jun, 2017 3 commits
    • Eli Zaretskii's avatar
      Improve documentation of replace-buffer-contents · f8cc7a83
      Eli Zaretskii authored
      * etc/NEWS (replace-buffer-contents): Fix formatting.
      * src/editfns.c (Freplace_buffer_contents): Doc fix.
    • Philipp Stephani's avatar
      Remove unnecessary point motion · 5575db92
      Philipp Stephani authored
      * src/editfns.c (Freplace_buffer_contents): Remove unnecessary point
    • Philipp Stephani's avatar
      Add command to replace buffer contents · d682f0da
      Philipp Stephani authored
      Add a new command 'replace-buffer-contents' that uses the Myers diff
      algorithm to non-destructively replace the accessible portion of the
      current buffer.  The Myers algorithm is implemented in Gnulib.
      * src/editfns.c (Freplace_buffer_contents): New command.
      (set_bit, bit_is_set, buffer_chars_equal): New helper functions.
      (syms_of_editfns): Define new command.
      * test/src/editfns-tests.el (replace-buffer-contents-1)
      (replace-buffer-contents-2): New unit tests.
      * src/buffer.h (BUF_FETCH_CHAR_AS_MULTIBYTE): New helper macro.
      * admin/merge-gnulib (GNULIB_MODULES): Add diffseq.h and minmax.h.
  23. 04 Jun, 2017 1 commit
    • Paul Eggert's avatar
      Tune ‘format’ after recent fix · d5fcf9e4
      Paul Eggert authored
      * doc/lispref/strings.texi (Formatting Strings):
      * src/editfns.c (Fformat): Format field numbers no longer need
      to be unique, reverting the previous doc change since that has
      now been fixed.  Also, document that %% should not have modifiers.
      * src/editfns.c (styled_format): Improve performance.  Remove
      the need for the new prepass over the format string, by using
      a typically-more-generous bound for the info array size.
      Initialize the info array lazily.  Move string inspection to
      the same area to help caching.  Avoid the need for a
      converted_to_string bitfield by using EQ.  Cache arg in a
      local and avoid some potential aliasing issues to help the
      compiler.  Info array is now 0-origin, not 1-origin.
  24. 03 Jun, 2017 3 commits
    • Philipp Stephani's avatar
      ; Fix off-by-one error · e3b7eead
      Philipp Stephani authored
    • Philipp Stephani's avatar
      Fix a bug when using format field numbers · 7d413cb4
      Philipp Stephani authored
      Previously styled_format overwrite the argument vector.  This is no
      longer possible because there might be more than one specification per
      argument.  Use the existing auxiliary info array instead.
      * src/editfns.c (styled_format): Record arguments in the info
      structure instead of overwriting them.
      * test/src/editfns-tests.el (format-with-field): Add unit test.
    • Paul Eggert's avatar
      Document uniqueness limitation of ‘format’ · 0147cdd4
      Paul Eggert authored
      * doc/lispref/strings.texi (Formatting Strings):
      * src/editfns.c (Fformat):
      Document that field numbers should be unique within a format.
  25. 01 Jun, 2017 4 commits
    • Paul Eggert's avatar
      Limit format fields to more POSIX-like spec · 8de2581a
      Paul Eggert authored
      * doc/lispref/strings.texi (Formatting Strings):
      Don’t allow mixing numbered with unnumbered format specs.
      * src/editfns.c (styled_format): Don’t bother checking for field 0,
      since it doesn’t crash and the behavior is not specified.
      * test/src/editfns-tests.el (format-with-field): Adjust tests to
      match current doc.  Add more tests for out-of-range fields.
    • Paul Eggert's avatar
      Improve performance by avoiding strtoumax · 178d0cb5
      Paul Eggert authored
      This made (string-to-number "10") 20% faster on my old desktop,
      an AMD Phenom II X4 910e running Fedora 25 x86-64.
      * admin/merge-gnulib (GNULIB_MODULES): Remove strtoumax.
      * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
      * lib/strtoul.c, lib/strtoull.c, lib/strtoumax.c, m4/strtoull.m4:
      * m4/strtoumax.m4: Remove.
      * src/editfns.c (str2num): New function.
      (styled_format): Use it instead of strtoumax.  Use ptrdiff_t
      instead of uintmax_t.  Check for integer overflow.
      * src/lread.c (LEAD_INT, DOT_CHAR, TRAIL_INT, E_EXP):
      Move to private scope and make them enums.
      (string_to_number): Compute integer value directly during
      first pass instead of revisiting it with strtoumax later.
    • Paul Eggert's avatar
      Minor improvements to format field numbers · 53247108
      Paul Eggert authored
      * src/editfns.c (styled_format): Allow field numbers in a %% spec.
      No need for a special diagnostic for field numbers greater than
      PTRDIFF_MAX.  Reword diagnostic for field 0.
      * test/src/editfns-tests.el (format-with-field): Adjust to match.
    • Philipp Stephani's avatar
      Implement field numbers in format strings · 0dd1bbb0
      Philipp Stephani authored
      A field number explicitly specifies the argument to be formatted.
      This is especially important for potential localization work, since
      grammars of various languages dictate different word orders.
      * src/editfns.c (Fformat): Update documentation.
      (styled_format): Implement field numbers.
      * doc/lispref/strings.texi (Formatting Strings): Document field numbers.
      * lisp/emacs-lisp/bytecomp.el (byte-compile-format-warn): Adapt.
      * test/src/editfns-tests.el (format-with-field): New unit test.
  26. 31 May, 2017 2 commits
  27. 16 May, 2017 2 commits
    • Paul Eggert's avatar
      Fix minor timezone memory leak · f7c07930
      Paul Eggert authored
      * src/editfns.c (wall_clock_tz): Remove; unused.
    • Paul Eggert's avatar
      Merge with gnulib, pacifying GCC 7 · 2e1bebe2
      Paul Eggert authored
      This incorporates:
      2017-05-16 manywarnings: update for GCC 7
      2017-05-15 sys_select: Avoid "was expanded before it was required"
      * configure.ac (nw): Suppress GCC 7’s new -Wduplicated-branches and
      -Wformat-overflow=2 options, due to too many false alarms.
      * doc/misc/texinfo.tex, lib/strftime.c, m4/manywarnings.m4:
      Copy from gnulib.
      * m4/gnulib-comp.m4: Regenerate.
      * src/coding.c (decode_coding_iso_2022):
      Fix bug uncovered by -Wimplicit-fallthrough.
      * src/conf_post.h (FALLTHROUGH): New macro.
      Use it to mark all switch cases that fall through.
      * src/editfns.c (styled_format): Use !, not ~, on bool.
      * src/gtkutil.c (xg_check_special_colors):
      When using sprintf, don’t trust Gtk to output colors in [0, 1] range.
      (xg_update_scrollbar_pos): Avoid use of possibly-uninitialized bool;
      this bug was actually caught by Clang.
      * src/search.c (boyer_moore):
      Tell GCC that CHAR_BASE, if nonzero, must be a non-ASCII character.
      * src/xterm.c (x_draw_glyphless_glyph_string_foreground):
      Tell GCC that glyph->u.glyphless.ch must be a character.