1. 08 Jun, 2018 2 commits
    • Paul Eggert's avatar
      Minor cleanup of save_excursion_restore · 0e1bfd38
      Paul Eggert authored
      * src/editfns.c (save_excursion_restore): Use clearer names
      for locals.  Free earlier, removing the need for a label and goto.
      0e1bfd38
    • Paul Eggert's avatar
      New function record_unwind_protect_excursion · a0aa1d4e
      Paul Eggert authored
      This simplifies callers a bit, and will simplify future changes.
      * src/eval.c (record_unwind_protect_excursion): New function.
      * src/buffer.c (Fkill_buffer):
      * src/bytecode.c (exec_byte_code):
      * src/editfns.c (Fsave_excursion, Freplace_buffer_contents):
      * src/lread.c (readevalloop, Feval_buffer):
      * src/window.c (scroll_command):
      Use it.
      a0aa1d4e
  2. 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)
      51ee8bc4
    • 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
      them.
      * test/src/editfns-tests.el (delete-region-undo-markers-1)
      (delete-region-undo-markers-2): New tests.
      
      (cherry picked from commit 96b8747d)
      daa60233
    • 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)
      7460840a
  3. 30 Mar, 2018 3 commits
    • Paul Eggert's avatar
      Centralize Bug#30931 fix · 6f66a43d
      Paul Eggert authored
      * src/marker.c (detach_marker): New function.
      * src/editfns.c (save_restriction_restore):
      * src/insdel.c (signal_before_change): Use it.
      6f66a43d
    • Noam Postavsky's avatar
      Fix another case of freed markers in the undo-list (Bug#30931) · 96b8747d
      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
      them.
      * test/src/editfns-tests.el (delete-region-undo-markers-1)
      (delete-region-undo-markers-2): New tests.
      96b8747d
    • Paul Eggert's avatar
      Fix CHECK_ALLOCATED_AND_LIVE abort during GC · 670f2ffa
      Paul Eggert authored
      * src/editfns.c (save_restriction_restore):
      Wait for the GC to free the temporary markers (Bug#30931).
      670f2ffa
  4. 19 Mar, 2018 3 commits
    • Paul Eggert's avatar
      Improve port to NetBSD tzalloc · 6d12e7af
      Paul Eggert authored
      Problem reported by Valery Ushakov (Bug#30738#22).
      * src/editfns.c (HAVE_TZALLOC_BUG): New macro.
      (tzlookup): Use it.  Compile on all platforms, not just on NetBSD.
      6d12e7af
    • Paul Eggert's avatar
      Tune time zone 0 · 7a7ee53d
      Paul Eggert authored
      * src/editfns.c (tzlookup): Treat time zone 0 like t, for speed.
      Suggested by Valery Ushakov (Bug#30738#19).
      7a7ee53d
    • Karl Fogel's avatar
      Revert move of interactive `transpose-regions' to Lisp · 6d2e8fdd
      Karl Fogel authored
      This reverts my commit 3a3aa0e0 of 2018-03-18 at 21:43:18 UTC.
      I thought consensus had been reached, but it had not: Eli Zaretskii
      felt the pre-3a3aa0e0 situation was fine and would not like to
      see it changed without at least further discussion.
      6d2e8fdd
  5. 18 Mar, 2018 1 commit
    • Karl Fogel's avatar
      Move interactive `transpose-regions' to Lisp · 3a3aa0e0
      Karl Fogel authored
      Define `transpose-regions' in Lisp, because its complex interactive
      spec was ungainly in C, and change the C version to non-interactive
      `transpose-regions-internal'.  The Lisp function is just a wrapper
      around the C function, which still does all the work.
      
      * lisp/simple.el (transpose-regions): New wrapper function, with
        interactive spec taken from old C `transpose-regions'.
      
      * src/editfns.c (Ftranspose_regions): Rename to...
        (Ftranspose_regions_internal): ...here, and remove interactive spec.
      
      Discussion on Emacs Devel:
      
        From: Karl Fogel
        To: Emacs Development
        Cc: Richard Copley, Charles A. Roelli
        Subject: Re: [Emacs-diffs] master b88e7c8b: \
                 Make transpose-regions interactive (Bug#30343)
        Date: Fri, 16 Mar 2018 10:23:31 -0500
        Message-ID: <87po44jb7w.fsf@red-bean.com>
      
        https://lists.gnu.org/archive/html/emacs-devel/2018-03/msg00555.html
      3a3aa0e0
  6. 15 Mar, 2018 1 commit
    • Paul Eggert's avatar
      Improve port to NetBSD tzalloc · 64a1da49
      Paul Eggert authored
      Problem reported by Valery Ushakov (Bug#30738#13).
      * src/editfns.c (tzlookup) [__NetBSD_Version__ < 700000000]:
      If tzalloc fails for any reason other than memory exhaustion,
      assume it’s because NetBSD 6 does not support tzalloc on
      POSIX-format TZ strings, and fall back on tzdb if possible.
      64a1da49
  7. 11 Mar, 2018 2 commits
    • Charles A. Roelli's avatar
      Make transpose-regions interactive (Bug#30343) · b88e7c8b
      Charles A. Roelli authored
      * doc/emacs/fixit.texi (Transpose): Mention and explain the new
      command.
      * editfns.c (Ftranspose_regions): Add an interactive calling
      specification, and add documentation for it.
      b88e7c8b
    • Paul Eggert's avatar
      Port to NetBSD tzalloc · d48f4c3b
      Paul Eggert authored
      Problem reported by Valery Ushakov (Bug#30738).
      * src/editfns.c (xtzalloc): Remove.
      (invalid_time_zone_specification): New function.
      (tzlookup): Port to NetBSD, where tzalloc can fail when the TZ
      string has an invalid value.
      d48f4c3b
  8. 09 Mar, 2018 1 commit
    • Paul Eggert's avatar
      Avoid losing info when formatting integers · 80e145fc
      Paul Eggert authored
      * doc/lispref/numbers.texi (Integer Basics): Clarify that
      out-of-range integers are treated as floating point only when the
      integers are decimal.
      * etc/NEWS: Mention changes.
      * src/editfns.c (styled_format): Use %.0f when formatting %d or %i
      values outside machine integer range, to avoid losing info.
      Signal an error for %o or %x values that are too large to be
      formatted, to avoid losing info.
      80e145fc
  9. 06 Jan, 2018 2 commits
  10. 01 Jan, 2018 1 commit
  11. 12 Dec, 2017 1 commit
    • Paul Eggert's avatar
      Narrow pointer bounds when appropriate · 4295050e
      Paul Eggert authored
      This typically occurs in a storage manager, where the caller
      is expected to access only the newly-allocated object,
      instead of using the returned value to access unrelated
      parts of the heap.
      * src/alloc.c (allocate_string, allocate_string_data)
      (compact_small_strings, find_string_data_in_pure)
      (sweep_strings, setup_on_free_list, allocate_vectorlike
      (pure_alloc):
      * src/bytecode.c (exec_byte_code):
      * src/callint.c (Fcall_interactively):
      * src/dispnew.c (scrolling):
      * src/editfns.c (styled_format):
      * src/frame.c (xrdb_get_resource, x_get_resource_string):
      * src/fringe.c (Fdefine_fringe_bitmap):
      * src/gmalloc.c (malloc, realloc, aligned_alloc):
      Narrow pointer bounds when appropriate.
      * src/alloc.c (SDATA_OF_STRING):
      * src/lisp.h (make_lisp_symbol) [__CHKP__]:
      Widen bounds here, though.
      * src/bytecode.c, src/callint.c, src/dispnew.c, src/editfns.c:
      * src/emacs.c, src/frame.c, src/fringe.c:
      Include ptr-bounds.h.
      * src/ptr-bounds.h (ptr_bounds_clip): New function.
      4295050e
  12. 08 Dec, 2017 2 commits
  13. 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.
      04e5b28f
  14. 22 Nov, 2017 1 commit
  15. 04 Nov, 2017 1 commit
    • Eli Zaretskii's avatar
      Allow 'make-string' callers force creation of multibyte strings · bd886c6f
      Eli Zaretskii authored
      * src/alloc.c (Fmake_string): Accept additional argument
      MULTIBYTE, and produce a multibyte string if it is non-nil.
      (make_event_array):
      * src/lread.c (read0):
      * src/editfns.c (Ftranslate_region_internal):
      * src/coding.c (Fdefine_coding_system_internal):
      * src/cmds.c (internal_self_insert):
      * src/xdisp.c (build_desired_tool_bar_string)
      (store_mode_line_string): All C callers changed.
      
      * doc/lispref/strings.texi (Creating Strings): Document the new
      optional argument.
      
      * etc/NEWS: Mention the new optional argument.
      
      * lisp/ruler-mode.el (ruler-mode-ruler): Call make-string with the
      3rd argument non-nil.
      bd886c6f
  16. 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.
      e6b4e5ff
  17. 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.
      8ca6fa58
  18. 06 Oct, 2017 1 commit
  19. 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.
      3db388b0
  20. 01 Oct, 2017 1 commit
  21. 27 Sep, 2017 1 commit
  22. 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.
      0e82fa34
  23. 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.
      541006c5
  24. 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.
      bc511a64
  25. 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)
      (cons_to_signed):
      * 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.
      d6312354
    • 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)
      (cons_to_signed):
      * 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.
      2b84c166
  26. 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.
      d6662694
  27. 22 Jun, 2017 1 commit
  28. 17 Jun, 2017 2 commits