1. 09 Aug, 2019 2 commits
  2. 07 Aug, 2019 1 commit
    • Paul Eggert's avatar
      Re-port dump_bitset_clear to -fsanitize=undefined · 220f16ca
      Paul Eggert authored
      * src/pdumper.c (dump_bitset_clear): Skip the memset if the
      size is zero, because in that case the destination might be NULL.
      This fixes a bug introduced in 2019-07-26T06:17:52Zeggert@cs.ucla.edu.
      Add a comment to make the bug less likely to reoccur.
  3. 06 Aug, 2019 3 commits
    • Eli Zaretskii's avatar
      Fix minor compilation problems on MS-Windows · 96e67236
      Eli Zaretskii authored
      * src/w32fns.c (Fdefault_printer_name): Fix size of local
      * src/image.c [WINDOWSNT]: Test __MINGW_MAJOR_VERSION as well
      to shut up compiler warnings.
    • Paul Eggert's avatar
      decode-time now returns subsec too · b06917a4
      Paul Eggert authored
      The list that decode-time returns now contains an extra
      trailing component that counts the subseconds part of the
      original timestamp (Bug#36549).
      This builds on a suggestion by Lars Ingebrigtsen in:
      * doc/lispref/os.texi (Time Conversion):
      * doc/misc/emacs-mime.texi (time-date):
      * etc/NEWS: Document this.
      * lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
      * lisp/calendar/iso8601.el (iso8601-parse)
      (iso8601-parse-time, iso8601-parse-duration)
      * lisp/calendar/parse-time.el (parse-time-string):
      * lisp/calendar/time-date.el (make-decoded-time)
      * lisp/org/org.el (org-fix-decoded-time)
      * src/timefns.c (Fdecode_time):
      Generate subsec member for decoded time.
      * lisp/calendar/time-date.el (decoded-time-add)
      Add the decoded subsec too.
      * lisp/simple.el (decoded-time): New subsec member.
      * src/data.c (Frem): Simplify zero-check to match that of new Fmod.
      (integer_mod): New function, with most of the guts of the old Fmod.
      Remove redundant zero-check.
      (Fmod): Use it.
      * src/timefns.c (Fencode_time): Handle new subsec member
      or (with the obsolescent calling convention) subsec arg.
      It defaults to 0.
      * test/lisp/calendar/icalendar-tests.el:
      * test/lisp/calendar/iso8601-tests.el (test-iso8601-date-years)
      (test-iso8601-date-dates, test-iso8601-date-obsolete)
      (test-iso8601-date-weeks, test-iso8601-date-ordinals)
      (test-iso8601-time, test-iso8601-combined)
      (test-iso8601-duration, test-iso8601-intervals)
      (standard-test-dates, standard-test-time-of-day-fractions)
      (standard-test-date-and-time-of-day, standard-test-interval):
      * test/lisp/calendar/parse-time-tests.el (parse-time-tests):
      * test/src/timefns-tests.el (format-time-string-with-zone)
      Adjust to match new behavior.
    • Paul Eggert's avatar
      New function time-convert · 89c63b35
      Paul Eggert authored
      This replaces the awkward reuse of encode-time to both convert
      calendrical timestamps to Lisp timestamps, and to convert Lisp
      timestamps to other forms.  Now, encode-time does just the
      former and the new function does just the latter.
      The new function builds on a suggestion by Lars Ingebrigtsen in:
      and refined by Stefan Monnier in:
      * doc/lispref/os.texi (Time of Day, Time Conversion):
      * doc/misc/emacs-mime.texi (time-date):
      * etc/NEWS: Update documentation.
      * lisp/calendar/cal-dst.el (calendar-next-time-zone-transition):
      * lisp/calendar/time-date.el (seconds-to-time, days-to-time):
      * lisp/calendar/timeclock.el (timeclock-seconds-to-time):
      * lisp/cedet/ede/detect.el (ede-detect-qtest):
      * lisp/completion.el (cmpl-hours-since-origin):
      * lisp/ecomplete.el (ecomplete-add-item):
      * lisp/emacs-lisp/cl-extra.el (cl--random-time):
      * lisp/emacs-lisp/timer.el (timer--time-setter)
      * lisp/find-lisp.el (find-lisp-format-time):
      * lisp/gnus/gnus-diary.el (gnus-user-format-function-d):
      * lisp/gnus/gnus-group.el (gnus-group-set-timestamp):
      * lisp/gnus/gnus-icalendar.el (gnus-icalendar-show-org-agenda):
      * lisp/gnus/nnrss.el (nnrss-normalize-date):
      * lisp/gnus/nnspool.el (nnspool-request-newgroups):
      * lisp/net/ntlm.el (ntlm-compute-timestamp):
      * lisp/net/pop3.el (pop3-uidl-dele):
      * lisp/obsolete/vc-arch.el (vc-arch-add-tagline):
      * lisp/org/org-clock.el (org-clock-get-clocked-time)
      (org-clock-resolve, org-resolve-clocks, org-clock-in)
      (org-clock-out, org-clock-sum):
      * lisp/org/org-id.el (org-id-uuid, org-id-time-to-b36):
      * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
      * lisp/proced.el (proced-format-time):
      * lisp/progmodes/cc-cmds.el (c-progress-init)
      * lisp/progmodes/cperl-mode.el (cperl-time-fontification):
      * lisp/progmodes/flymake.el (flymake--schedule-timer-maybe):
      * lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
      * lisp/tar-mode.el (tar-octal-time):
      * lisp/time.el (emacs-uptime):
      * lisp/url/url-auth.el (url-digest-auth-make-cnonce):
      * lisp/url/url-util.el (url-lazy-message):
      * lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
      * lisp/vc/vc-hg.el (vc-hg-state-fast):
      * lisp/xt-mouse.el (xterm-mouse-event):
      * test/lisp/emacs-lisp/timer-tests.el:
      Use time-convert, not encode-time.
      * lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
      Don’t use now-removed FORM argument for encode-time.
      It wasn’t crucial anyway.
      * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add time-convert.
      * lisp/emacs-lisp/elint.el (elint-unknown-builtin-args):
      Update encode-time signature to match current arg set.
      * lisp/emacs-lisp/timer.el (timer-next-integral-multiple-of-time):
      Use timer-convert with t rather than doing it by hand.
      * src/timefns.c (time_hz_ticks, time_form_stamp, lisp_time_form_stamp):
      Remove; no longer needed.
      (decode_lisp_time): Rturn the form instead of having a *PFORM arg.
      All uses changed.
      (time_arith): Just return TICKS if HZ is 1.
      (Fencode_time): Remove argument FORM.  All callers changed.
      Do not attempt to encode time values; just encode
      decoded (calendrical) times.
      Unless CURRENT_TIME_LIST, just return VALUE since HZ is 1.
      (Ftime_convert): New function, which does the time value
      conversion that bleeding-edge encode-time formerly did.
      Return TIME if it is easy to see that it is already
      of the correct form.
      (Fcurrent_time): Mention in doc that the form is planned to change.
      * test/src/timefns-tests.el (decode-then-encode-time):
      Don’t use (encode-time nil).
  4. 05 Aug, 2019 3 commits
  5. 04 Aug, 2019 5 commits
    • Paul Eggert's avatar
      Tweak time arithmetic performance · 7748ef21
      Paul Eggert authored
      * src/timefns.c (lispint_arith): New function, which
      should be a bit faster if B is 0, or if A is a bignum
      and B a fixnum with absolute value in unsigned long range.
      (time_arith): Use it.
    • Eli Zaretskii's avatar
      Fix the MS-Windows build broken by recent changes · f01597a4
      Eli Zaretskii authored
      * src/inotify.c (syms_of_inotify) <Qignored>: Don't define here...
      * src/coding.c (syms_of_coding) <Qignored>: ...define it here,
      because it is needed also on platforms that don't compile
    • Paul Eggert's avatar
      Minor fix to recent coding.c change · 3c459e3b
      Paul Eggert authored
      * src/coding.c (get_buffer_gap_address):
      Don’t assume string or buffer length fits in int.
      Also, improve wording of comments.
    • K. Handa's avatar
      Add Unicode-safe UTF-8 converter · a8026dfd
      K. Handa authored
      * src/coding.c (encode_string_utf_8, decode_string_utf_8): New functions.
      * src/coding.h (encode_string_utf_8, decode_string_utf_8): Extern them.
    • Martin Rudalics's avatar
      Fix two mouse drag and drop issues (Bug#28620, Bug#36269) · 5ec3f705
      Martin Rudalics authored
      Allow 'mouse-drag-and-drop-region' to move/copy text from one
      frame to another (Bug#28620).  Prevent mouse avoidance mode from
      interfering with 'mouse-drag-and-drop-region' (Bug#36269).
      * lisp/avoid.el (mouse-avoidance-ignore-p): Suspend avoidance
      when 'track-mouse' equals 'dropping'.
      * lisp/mouse.el (mouse-drag-and-drop-region): Set
      'track-mouse' to 'dropping'.  Continue reading events also
      when switching frames.
      * src/keyboard.c (Finternal_track_mouse): Rename from
      (some_mouse_moved): Return NULL also when mouse is not tracked.
      (show_help_echo, readable_events, kbd_buffer_get_event): Don't
      check whether mouse is tracked, some_mouse_moved does it now.
      (track_mouse): Rename variable from do_mouse_tracking.  Adjust
      all users.  In doc-string explain meanings of special values
      'dragging' and 'dropping'.
      * src/nsterm.m (ns_mouse_position): During drag and drop
      consider last mouse frame only when there is no currently
      focused frame.
      * src/w32fns.c (w32_wnd_proc): Don't set mouse capture during a
      drag and drop operation.
      * src/w32term.c (w32_mouse_position): Track frame under mouse
      during mouse drag and drop.
      (mouse_or_wdesc_frame): New function.
      (w32_read_socket): Call mouse_or_wdesc_frame on mouse events.
      * src/xdisp.c (define_frame_cursor1): Don't change mouse cursor
      shape during mouse drag and drop.
      (syms_of_xdisp): New symbol Qdropping.
      * src/xterm.c (XTmouse_position): Allow mouse drag and drop move
      to another frame
      (mouse_or_wdesc_frame): New function.
      (handle_one_xevent): Use mouse_or_wdesc_frame for mouse events.
  6. 03 Aug, 2019 4 commits
    • Paul Eggert's avatar
      Remove stale .pdmp files with ‘make clean’ · da03988d
      Paul Eggert authored
      Problem reported by Sven Joachim (Bug#36907).
      * admin/make-emacs: Simplify, now that clean does versionclean.
      * src/Makefile.in ($(etc)/DOC, versionclean, extraclean):
      Don’t ignore rm -f failures.
      (versionclean): Also remove emacs-*.*.*[0-9].pdmp and ../etc/DOC*.
      (clean): Depend on versionclean and simplify.
    • Paul Eggert's avatar
      Fix rare undefined behaviors in replace-match · 13fe8a27
      Paul Eggert authored
      * src/search.c (Freplace_match): Simplify by caching search_regs
      components.  Fix sanity check for out-of-range subscripts;
      it incorrectly allowed negative subscripts, subscripts
      equal to search_regs.num_regs, and it had undefined
      behavior for subscripts outside ptrdiff_t range.
      Improve wording of newly-introduced replace-match diagnostic.
      Rework use of opoint, to avoid setting point to an out-of-range value
      in rare cases involving modification hooks.
    • Lars Ingebrigtsen's avatar
      Fix error message in replace-match for subexpressions · 18e163fd
      Lars Ingebrigtsen authored
      * src/search.c (Freplace_match): Output a more understandable
      error message when replacing a subexpression (bug#19208).
    • Lars Ingebrigtsen's avatar
      Clarify Freplace_match logic · f77a3951
      Lars Ingebrigtsen authored
      * src/search.c (Freplace_match): Add some doc strings to clarify
      the logic and do a minor clean up (bug#19208).
  7. 01 Aug, 2019 1 commit
  8. 31 Jul, 2019 4 commits
    • Paul Eggert's avatar
      Avoid intern calls for builtin syms · 82f13f83
      Paul Eggert authored
      * src/casefiddle.c (Fdowncase_region):
      * src/eval.c (Fdefvaralias):
      Use builtin symbol rather than calling intern.
    • Paul Eggert's avatar
      Fix Fload infile problem · 3018f6d8
      Paul Eggert authored
      * src/lread.c (Fload): Close window of vulnerability
      where the wrong stream could have been closed.
    • Stefan Monnier's avatar
    • Stefan Monnier's avatar
      * src/lread.c (infile): Set/reset it like a dynamically scoped variable · bedcc2d8
      Stefan Monnier authored
      I've seen segfaults where `infile` is nil when we get to
      readbyte_from_file, presumably because Fload set it to NULL (via
      close_infile_unwind) just before returning to its caller which was
      probably itself within another read/load and for some reason
      readevalloop didn't get to re-set `infile` like it used to do at every
      iteration.  I was not able to really track down the bug, but the way
      `infile` was set/reset seemed fragile and managing it like a standard
      dynamically-scoped var seems both safer (and more efficient since we
      don't need readevalloop to constantly re-set it).
      (readchar): Assert that `infile` is set if using a function the depends on it.
      (readbyte_from_file): Assert that `infile` is set.
      (close_infile_unwind): Reset `infile` to its previous value rather than
      to NULL.
      (Fload): Remember the previous value of `infile` before chaning it.
      (readevalloop): Don't set `infile` any more.
  9. 29 Jul, 2019 1 commit
    • Lars Ingebrigtsen's avatar
      Add support for dealing with decoded time structures · 6cfda69d
      Lars Ingebrigtsen authored
      * doc/lispref/os.texi (Time Conversion): Document the new
      functions that work on decoded time.
      (Time Calculations): Document new date/time functions.
      * lisp/simple.el (decoded-time-second, decoded-time-minute)
      (decoded-time-hour, decoded-time-day, decoded-time-month)
      (decoded-time-year, decoded-time-weekday, decoded-time-dst)
      (decoded-time-zone): New accessor functions for decoded time values.
      * lisp/calendar/time-date.el (date-days-in-month)
      (date-ordinal-to-time): New functions.
      (decoded-time--alter-month, decoded-time--alter-day)
      (decoded-time--alter-second, make-decoded-time): New functions
      added to manipulate decoded time structures.
      * src/timefns.c (Fdecode_time): Mention the new accessors.
      * test/lisp/calendar/time-date-tests.el: New file to test the
      decoded time functions and the other new functions.
  10. 28 Jul, 2019 1 commit
  11. 27 Jul, 2019 3 commits
    • Alan Third's avatar
      Fix stretch glyphs overlap with line above (bug#36633) · 37db78c4
      Alan Third authored
      * src/nsterm.m (ns_dumpglyphs_stretch): Move overwriting of the
      clipping rectangle to after performing clipping.
    • Paul Eggert's avatar
      Fix arithmetic overflow in GC consing count · c26469da
      Paul Eggert authored
      * src/alloc.c (allow_garbage_collection):
      Redo expression to avoid signed arithmetic overflow
      in an intermediate expression when CONSING is negative.
    • Pip Cet's avatar
      Use the CSS convention for #RGB colors (bug#36304) · 35739901
      Pip Cet authored
      * src/xterm.c (x_parse_color): Change interpretation of #RGB color
      triplets to match CSS rather than X conventions.
      * lisp/term/tty-colors.el (tty-color-standard-values): Change
      interpretation of #RGB color triplets to match CSS rather than X
      conventions.  Allow upper-case digits.  Fix rgb:R/G/B
      * doc/emacs/display.texi (Colors): Specify the convention used for
      "#RGB" color triplets.
      * test/lisp/tty-colors-tests.el: New file.
      * etc/NEWS: Mention the change.
  12. 26 Jul, 2019 9 commits
    • Noam Postavsky's avatar
      Clarify docstring of last-command-event. · d04b0ae7
      Noam Postavsky authored
      * src/keyboard.c (syms_of_keyboard) <last-command-event>: Reword docstring.
    • Stefan Monnier's avatar
      Adjust remaining uses of `NILP (HASH_HASH)`. · 0f09808e
      Stefan Monnier authored
      * src/json.c (lisp_to_json_toplevel_1):
      * src/pdumper.c (dump_hash_table_stable_p, hash_table_contents):
      * src/print.c (print, print_vectorlike):
      * src/minibuf.c (Ftry_completion, Fall_completions, Ftest_completion):
      Use `EQ (HASH_KEY, Qunbound)` instead of `NILP (HASH_HASH)`.
    • Stefan Monnier's avatar
      Don't dump the `hash` vector if it will need to be recomputed anyway · 0dc5a85a
      Stefan Monnier authored
      * src/fns.c (hash_table_rehash): Only set `hash` field at the end.
      (sweep_weak_table): Only set slot of `hash` vector when that vector exists.
      (Fhash_table_count): No need to hash_rehash_if_needed any more.
      * src/lisp.h (hash_rehash_needed_p): Test the presence of `hash` instead.
      * src/pdumper.c (check_hash_table_rehash, dump_hash_table):
      Set `hash` to nil to indicate that the table needs to be rehashed.
    • Stefan Monnier's avatar
      * src/fns.c: Use `EQ (key, Qunbound)` to check if a slot is in use · c74da403
      Stefan Monnier authored
      (make_hash_table): Use Qunbound for the key_and_value table.
      (maybe_resize_hash_table): Set new key_and_value slots to Qunbound.
      (hash_table_rehash): Don't bother copying the old table of hashes since
      we're recomputing it completely.
      (hash_table_rehash): Use hash_rehash_needed_p more.
      (hash_put): Add assertion that the slot was indeed considered empty.
      (hash_remove_from_table, hash_clear, sweep_weak_table): Set empty
      slot's key to Qunbound.
      (Fmaphash): Use `EQ (key, Qunbound)` to check if a slot is in use.
      * src/lisp.h (struct Lisp_Hash_Table): Update comments.
    • Stefan Monnier's avatar
      * src/fns.c (hash_index_size): New function, extracted from make_hash_table · bbff294b
      Stefan Monnier authored
      (make_hash_table, maybe_resize_hash_table): Use it.
      * src/pdumper.c (check_hash_table_rehash): Use hash_rehash_needed_p.
    • Stefan Monnier's avatar
    • Paul Eggert's avatar
      Fix recently-introduced file-name-absolute-p typo · e3575ee4
      Paul Eggert authored
      Fix a bug introduced in 2019-07-24T21:28:13!eggert@cs.ucla.edu.
      * src/fileio.c (file_name_absolute_p):
      ~/foo is also absolute (Bug#36809).
      * test/src/fileio-tests.el (fileio-tests--file-name-absolute-p):
      Rename from fileio-tests--no-such-user and add more tests.
    • Lars Ingebrigtsen's avatar
      Clarify last-command-event doc string · 1573cf98
      Lars Ingebrigtsen authored
      * src/keyboard.c (syms_of_keyboard): Clarify the doc string
    • Paul Eggert's avatar
      Minor pdumper tweaks · 62047917
      Paul Eggert authored
      * src/pdumper.c (dump_hash_table_stable_p):
      Bool vectors and bignums are also stable keys.
      (decode_emacs_reloc, drain_reloc_list, Fdump_emacs_portable):
      (dump_bitset_clear): Simplify use of memset.
  13. 25 Jul, 2019 3 commits
    • Noam Postavsky's avatar
      Fix subproc listening when setting filter to non-t (Bug#36591) · b3e20737
      Noam Postavsky authored
      * src/process.c (Fset_process_filter): Call add_process_read_fd
      according to the state of process filter before it's updated.  This
      restores the correct functioning as it was before 2016-02-16 "Allow
      setting the filter masks later".  Inline the set_process_filter_masks
      call instead of fixing it that function, because it is also called
      from connect_network_socket, and we don't want to change the behavior
      of that function so close to release.
      * test/src/process-tests.el (set-process-filter-t): New test.
    • Paul Eggert's avatar
      Don't crash when parsing bad SVG data · 263b9680
      Paul Eggert authored
      Derived from a patch by Pip Cet (Bug#36773#47).
      * src/image.c (svg_load_image): Work around librsvg 2.40.13 bug.
    • Eli Zaretskii's avatar
      Fix HarfBuzz support on MS-Windows · 28d231db
      Eli Zaretskii authored
      * src/w32uniscribe.c [HAVE_HARFBUZZ]: Include hb-ot.h.
      (fn_hb_ot_font_set_funcs, hb_ot_font_set_funcs): Define.
      (w32hb_get_font): Call hb_ot_font_set_funcs after creating the
      hb_font_t object, to make the code work with versions of
      HarfBuzz before 2.0.0.  Problem reported by Stephen Leake
      <stephen_leake@stephe-leake.org>.  Solution suggested by
      Khaled Hosny <dr.khaled.hosny@gmail.com> in