1. 26 Jul, 2020 3 commits
    • Philipp Stephani's avatar
      Add another test for global module references · 73a2f510
      Philipp Stephani authored
      * test/src/emacs-module-tests.el (mod-test-globref-reordered): New
      unit test.
      * test/data/emacs-module/mod-test.c (Fmod_test_globref_reordered): New
      test module function.
      (emacs_module_init): Export it.
    • Philipp Stephani's avatar
      Backport: add another test case for module assertions. · 3838aeb7
      Philipp Stephani authored
      This backports commit 9f01ce63 from master.  Since the bug isn’t
      present on emacs-27, just backport the new test case.
      * test/data/emacs-module/mod-test.c (Fmod_test_globref_invalid_free):
      New test module function.
      (emacs_module_init): Export it.
      * test/src/emacs-module-tests.el
      (module--test-assertions--globref-invalid-free): New unit test.
    • Philipp Stephani's avatar
      Backport: Add module test for edge case. · bde5f5f8
      Philipp Stephani authored
      This backports commit 6355a3ec from master.  Since the bug isn’t
      present in emacs-27, just backport the test case.
      * test/data/emacs-module/mod-test.c
      (Fmod_test_invalid_store_copy): New test module function.
      (emacs_module_init): Export it.
      * test/src/emacs-module-tests.el
      New unit test.
  2. 25 Jul, 2020 2 commits
    • Philipp Stephani's avatar
      Make checking for liveness of global values more precise. · 9f01ce63
      Philipp Stephani authored
      We can't just use a hash lookup because a global and a local reference
      might refer to the same Lisp object.
      * src/emacs-module.c (module_free_global_ref): More precise check for
      global liveness.
      * test/data/emacs-module/mod-test.c (Fmod_test_globref_invalid_free):
      New test module function.
      (emacs_module_init): Export it.
      * test/src/emacs-module-tests.el
      (module--test-assertions--globref-invalid-free): New unit test.
    • Philipp Stephani's avatar
      Fix subtle bug when checking liveness of module values. · 6355a3ec
      Philipp Stephani authored
      We can't simply look up the Lisp object in the global reference table
      because an invalid local and a valid global reference might refer to
      the same object.  Instead, we have to test the address of the global
      reference against the stored references.
      * src/emacs-module.c (module_global_reference_p): New helper function.
      (value_to_lisp): Use it.
      * test/data/emacs-module/mod-test.c
      (Fmod_test_invalid_store_copy): New test module function.
      (emacs_module_init): Export it.
      * test/src/emacs-module-tests.el
      New unit test.
  3. 09 Jul, 2020 1 commit
  4. 29 Jun, 2020 2 commits
  5. 22 Jun, 2020 1 commit
    • Eli Zaretskii's avatar
      Minor improvements as followup to recent RGB string-parsing change · 30ff2433
      Eli Zaretskii authored
      * src/xfaces.c (Finternal_color_values_from_color_spec): Rename to...
      (Fcolor_values_from_color_spec): ...this.  Callers changed.
      Rename the argument to SPEC and improve the doc string.
      (parse_color_spec, parse_float_color_comp, parse_hex_color_comp):
      Improve commentary.
      (parse_color_spec): Rename the argument S to SPEC.
      * etc/NEWS: Mention 'color-values-from-color-spec'.
  6. 21 Jun, 2020 2 commits
    • Mattias Engdegård's avatar
      Consolidate #RGB string parsers · 9fe2bdb8
      Mattias Engdegård authored
      Use a single parser of color strings in the #RGB, rgb:R/G/B and
      rgbi:R/G/B formats, replacing four existing ones.  Previously,
      error-checking was spotty, handling of the rgbi: format not always
      present, and normalization of the result was sometimes incorrect.
      * src/dispextern.h: New prototype.
      * src/xfaces.c (parse_hex_color_comp, parse_float_color_comp)
      (parse_color_spec, Finternal-color_values_from_color_spec): New functions.
      * test/src/xfaces-tests.el (xfaces-internal-color-values-from-color-spec):
      New test.
      * lisp/term/tty-colors.el (tty-color-standard-values):
      Use internal-color-values-from-color-spec, replacing old parser.
      * src/nsterm.m (ns_get_color):
      * src/w32fns.c (x_to_w32_color):
      * src/xterm.c (x_parse_color): Use parse_color_spec, replacing old
      (HEX_COLOR_NAME_LENGTH): Remove #define.
    • Basil L. Contovounesios's avatar
      Silence some warnings in tests · 4cc6854c
      Basil L. Contovounesios authored
      * test/lisp/emacs-lisp/package-tests.el
      (package-test-suffix-matches): Evaluate lambda.
      * test/lisp/vc/vc-tests.el
      * test/src/undo-tests.el (undo-test-skip-invalidated-markers):
      Silence "unused local variable" warnings.
      * test/lisp/imenu-tests.el (imenu-simple-scan-deftest): Fix
      docstring.  Don't shadow global major-mode.
  7. 04 Jun, 2020 1 commit
  8. 03 Jun, 2020 2 commits
    • Mattias Engdegård's avatar
      Make color-distance symmetric and more accurate · 7e8c1a67
      Mattias Engdegård authored
      * src/xfaces.c (color_distance): Don't throw away the low 8 bits of
      the colours, and make the function symmetric (bug41544)
      (Fcolor_distance): Add caution about this not being a true metric.
      * test/src/xfaces-tests.el: New file.
    • Basil L. Contovounesios's avatar
      Silence some byte-compiler warnings in tests · 7d323f07
      Basil L. Contovounesios authored
      * test/lisp/emacs-lisp/cl-generic-tests.el:
      * test/lisp/progmodes/elisp-mode-tests.el: Declare functions
      referred to within macroexpansions.
      (xref-elisp-overloadable-separate-default): Prefix unused arguments
      with underscore.
      * test/lisp/international/ccl-tests.el:
      * test/lisp/wdired-tests.el:
      * test/lisp/emacs-lisp/package-tests.el: Declare functions used.
      (package-test-update-archives, package-test-signed): Use
      revert-buffer in place of its obsolete alias package-menu-refresh.
      * test/lisp/eshell/eshell-tests.el:
      * test/lisp/mail/footnote-tests.el:
      * test/src/buffer-tests.el: Require dependencies used.
      * test/lisp/image/exif-tests.el: Remove unneeded (require 'seq).
      (test-exit-direct-ascii-value): Actually perform the test.
      * test/lisp/progmodes/sql-tests.el (sql-test-add-existing-product):
      Fix typo.
      * test/lisp/simple-tests.el (with-shell-command-dont-erase-buffer):
      * test/src/data-tests.el (test-bool-vector-bv-from-hex-string)
      (test-bool-vector-apply-mock-op): Remove unused local variables.
  9. 18 May, 2020 1 commit
  10. 17 May, 2020 1 commit
    • Paul Eggert's avatar
      Don’t attempt to modify constant conses · c7bc28bf
      Paul Eggert authored
      From a patch privately suggested by Mattias Engdegård on 2020-05-11
      in a followup to Bug#40671.
      * admin/charsets/cp51932.awk:
      * admin/charsets/eucjp-ms.awk:
      Generate code that does not modify constant conses.
      * doc/misc/emacs-mime.texi (Encoding Customization):
      * lisp/emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops):
      * lisp/frameset.el (frameset-persistent-filter-alist):
      * lisp/gnus/gnus-sum.el (gnus-article-mode-line-format-alist):
      Use append instead of nconc.
      * lisp/language/japanese.el (japanese-ucs-cp932-to-jis-map)
      Use mapcar instead of mapc.
      * lisp/language/lao-util.el (lao-transcription-consonant-alist)
      * lisp/language/tibetan.el (tibetan-subjoined-transcription-alist):
      Use copy-sequence.
      * test/src/fns-tests.el (fns-tests-nreverse):
      (fns-tests-sort, fns-tests-collate-sort)
      (fns-tests-string-version-lessp, fns-tests-mapcan):
      Use copy-sequence, vector, and list.
  11. 24 Apr, 2020 1 commit
    • Stefan Kangas's avatar
      Use lexical-binding in most src tests · c52f8863
      Stefan Kangas authored
      * test/src/charset-tests.el:
      * test/src/chartab-tests.el:
      * test/src/cmds-tests.el:
      * test/src/coding-tests.el (top-level)
      (generate-ascii-file, generate-mostly-nonascii-file):
      * test/src/doc-tests.el:
      * test/src/floatfns-tests.el:
      * test/src/font-tests.el:
      * test/src/keymap-tests.el:
      * test/src/process-tests.el (top-level)
      (process-test-stderr-buffer, process-test-stderr-filter):
      * test/src/textprop-tests.el:
      * test/src/thread-tests.el:
      * test/src/timefns-tests.el:
      * test/src/undo-tests.el:
      * test/src/xml-tests.el: Use lexical-binding.
  12. 21 Apr, 2020 1 commit
    • Paul Eggert's avatar
      Fix string-to-multibyte overlong sequence bug · c88a3be8
      Paul Eggert authored
      Remove, replacing with ...
      (multibyte_length): ... this new function.  All callers changed.
      The new function rejects overlong multibyte forms.
      * test/src/buffer-tests.el (buffer-multibyte-overlong-sequences):
      New test.
  13. 18 Apr, 2020 1 commit
  14. 12 Apr, 2020 2 commits
  15. 09 Apr, 2020 4 commits
    • Mattias Engdegård's avatar
      Set last-coding-system-used upon ASCII conversion bypass (bug#40407) · e18c24b3
      Mattias Engdegård authored
      Spotted by Kazuhiro Ito.
      * src/coding.c (code_convert_string):
      Set Vlast_coding_system if appropriate.
      * test/src/coding-tests.el (coding-nocopy-ascii): Add test.
    • Mattias Engdegård's avatar
      Fix ASCII-only conversion logic (bug#40407) · d3e2c880
      Mattias Engdegård authored
      To sidestep conversion altogether when EOL conversion applies, we must
      either be encoding a string without NL, or decoding without CR.
      * src/coding.c (string_ascii_p): Revert to a pure predicate.
      (code_convert_string): Fix logic.  Don't use uninitialised
      ascii_p (removed).  Use memchr to detect CR or LF in string when needed.
      * test/src/coding-tests.el (coding-nocopy-ascii):
      Update tests to include encodings with explicit EOL conversions.
    • Mattias Engdegård's avatar
      Don't crash with invalid argument in check-coding-systems-region · 786887cf
      Mattias Engdegård authored
      * src/coding.c (Fcheck_coding_systems_region): Don't crash if
      the third arg contains something that isn't a coding system.
      * test/src/coding-tests.el (coding-check-coding-systems-region):
      New test.
    • Eli Zaretskii's avatar
      Fix decoding ASCII strings with embedded CR characters · faf996dc
      Eli Zaretskii authored
      * src/coding.c (string_ascii_p): Return a negative value if an
      all-ASCII string STR includes the CR character, otherwise a
      positive value.
      (code_convert_string): If the string is ASCII, but includes CR
      characters, use the fast path only if EOL doesn't need to be
      decoded.  (Bug#40519)
      * test/src/coding-tests.el (coding-nocopy-ascii): Add tests for
  16. 05 Apr, 2020 2 commits
    • Mattias Engdegård's avatar
      Avoid expensive recoding for ASCII identity cases (bug#40407) · 4ed39549
      Mattias Engdegård authored
      Optimise for the common case of encoding or decoding an ASCII-only
      string using an ASCII-compatible coding, for file names in particular.
      * src/coding.c (string_ascii_p): New function.
      (code_convert_string): Return the input string for ASCII-only inputs
      and ASCII-compatible codings.
      * test/src/coding-tests.el (coding-nocopy-ascii): New test.
    • Mattias Engdegård's avatar
      Fix inverted NOCOPY encode/decode parameter (bug#40407) · 962562cd
      Mattias Engdegård authored
      In {encode,decode}-coding-string, the NOCOPY parameter had the
      opposite effect to what was intended and documented.  This 18 year old
      bug (introduced in 4031e2bf) only affected calls with CODING-SYSTEM
      being nil.
      * src/coding.c (code_convert_string): Correct use of NOCOPY.
      * test/src/coding-tests.el (coding-nocopy-trivial): New test.
  17. 27 Mar, 2020 1 commit
    • Eli Zaretskii's avatar
      Port the 'module/async-pipe' test to MS-Windows · f98ee21c
      Eli Zaretskii authored
      These changes let the code compile and produce a valid DLL, but the
      test hangs.  It looks like the hang is in Fdelete_process, when it
      closes one of the descriptors of the pipe process.
      In addition, this use of the pipe process cannot currently work
      on MS-Windows, since make-pipe-process doesn't set up the reader
      thread to read from the Emacs's side of the pipe, so the select
      emulation doesn't know there's stuff to read from that pipe.
      * test/data/emacs-module/mod-test.c [WINDOWSNT]: Include
      (ALIGN_STACK) [!__x86_64__]: Define for 32-bit builds.
      (sleep_for_half_second): New function.
      (write_to_pipe): Declare return type differently for WINDOWSNT.
      Call sleep_for_half_second.
      (Fmod_test_async_pipe) [WINDOWSNT]: Use _beginthread as substitute
      for pthread_create.
      (invalid_finalizer): Replace non_ASCII character in a comment.
      * test/src/emacs-module-tests.el (module/async-pipe): Skip on
      MS-Windows, as the test fails and then hangs.
  18. 26 Mar, 2020 1 commit
    • Philipp Stephani's avatar
      Add a module function to open a file descriptor connected to a pipe. · d28b0047
      Philipp Stephani authored
      A common complaint about the module API is that modules can't
      communicate asynchronously with Emacs.  While it isn't possible to
      call arbitrary Emacs functions asynchronously, writing to a pipe
      should always be fine and is a pretty low-hanging fruit.
      This patch implements a function that adapts an existing pipe
      process.  That way, users can use familiar tools like process filters
      or 'accept-process-output'.
      * src/module-env-28.h: Add 'open_channel' module function.
      * src/emacs-module.c (module_open_channel): Provide definition for
      (initialize_environment): Use it.
      * src/process.c (open_channel_for_module): New helper function.
      (syms_of_process): Define necessary symbol.
      * test/src/emacs-module-tests.el (module/async-pipe): New unit test.
      * test/data/emacs-module/mod-test.c (signal_system_error): New helper
      (signal_errno): Use it.
      (write_to_pipe): New function running in the background.
      (Fmod_test_async_pipe): New test module function.
      (emacs_module_init): Export it.
      * doc/lispref/internals.texi (Module Misc): Document new module
      * doc/lispref/processes.texi (Asynchronous Processes): New anchor
      for pipe processes.
      * etc/NEWS: Document 'open_channel' function.
  19. 03 Mar, 2020 1 commit
    • Paul Eggert's avatar
      Fix rounding errors in time conversion · 5e229f88
      Paul Eggert authored
      * src/timefns.c (frac_to_double): Pass FLT_RADIX to mpz_sizeinbase
      instead of doing the radix calculation ourselves, not always
      correctly.  Fix off-by-one error in scale, which caused
      (decode_time_components): Use frac_to_double (via decode_ticks_hz)
      to fix double-rounding error that can occur even though
      intermediate results are long double.
      * test/src/timefns-tests.el (float-time-precision):
      Test the above fixes.
  20. 28 Feb, 2020 1 commit
    • Paul Eggert's avatar
      Port timestamp tests to odd timezones, (TICKS . HZ) · 8ab0e731
      Paul Eggert authored
      * test/src/timefns-tests.el:
      Don't assume local time can represent 2000-02-15 00:00:00,
      as there might be a DST jump over midnight.
      Work even when timestamps are of (TICKS . HZ) form.
      Simplify by avoiding need to call time-add.
  21. 27 Feb, 2020 2 commits
  22. 26 Feb, 2020 2 commits
  23. 20 Feb, 2020 1 commit
    • Mattias Engdegård's avatar
      Remove subsumed repetitions in regexps · 770f76f0
      Mattias Engdegård authored
      Make regexps smaller and faster by removing terms that are superfluous
      by virtue of standing next to another term that matches more.  See
      for details.
      * lisp/bs.el (bs--make-header-match-string):
      * lisp/gnus/deuglify.el (gnus-outlook-repair-attribution-block):
      * lisp/gnus/message.el (message-subject-trailing-was-ask-regexp)
      * lisp/informat.el (Info-validate):
      * lisp/net/browse-url.el (browse-url-button-regexp):
      * lisp/net/rcirc.el (rcirc-url-regexp):
      * lisp/org/ob-core.el (org-babel-remove-result):
      * lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
      * lisp/org/org-capture.el (org-capture-set-target-location):
      * lisp/org/org-table.el (org-table-expand-lhs-ranges):
      * lisp/org/org.el (org-maybe-keyword-time-regexp, org-ts-regexp)
      (org-ts-regexp-inactive, org-ts-regexp-both):
      * lisp/play/gametree.el (gametree-hack-file-layout):
      * lisp/progmodes/cc-mode.el (c-Java-defun-prompt-regexp):
      * lisp/progmodes/idlw-shell.el (idlwave-shell-halting-error):
      * lisp/progmodes/ruby-mode.el (ruby-mode-set-encoding):
      * lisp/progmodes/verilog-mode.el (verilog-error-font-lock-keywords)
      (verilog-verilint-off, verilog-case-indent-level)
      (verilog-within-translate-off, verilog-start-translate-off)
      (verilog-back-to-start-translate-off, verilog-end-translate-off)
      * lisp/term.el (term-control-seq-regexp):
      * lisp/textmodes/reftex-vars.el (featurep):
      * lisp/url/url-gw.el (url-open-telnet):
      * lisp/vc/ediff-ptch.el (ediff-context-diff-label-regexp):
      * lisp/vc/pcvs-parse.el (cvs-parse-status):
      * test/src/regex-emacs-tests.el (regex-tests-PCRE):
      Remove subsumed repetitions.
      * lisp/progmodes/sh-script.el (sh-syntax-propertize-function):
      Simplify repetition of a repetition.
  24. 14 Feb, 2020 1 commit
  25. 24 Jan, 2020 1 commit
    • Mattias Engdegård's avatar
      Remove (or double) redundant backslashes in string literals · 0c6c8aa0
      Mattias Engdegård authored
      See discussion at
      https://lists.gnu.org/archive/html/emacs-devel/2020-01/msg00749.html .
      * lisp/obsolete/iswitchb.el (iswitchb-summaries-to-end):
      * test/src/regex-emacs-tests.el (regex-tests-BOOST-frob-escapes):
      * test/lisp/help-fns-tests.el (help-fns-test-lisp-macro)
      (help-fns-test-lisp-defun, help-fns-test-lisp-defsubst)
      (help-fns-test-alias-to-defun, help-fns-test-bug23887):
      Double backslashes for desired effect.
      * lisp/org/ol.el (org-link-escape):
      * lisp/net/nsm.el (nsm-protocol-check--rsa-kx)
      (nsm-protocol-check--anon-kx, nsm-protocol-check--sha1-sig):
      * lisp/obsolete/old-whitespace.el (whitespace-buffer):
      * lisp/obsolete/rcompile.el (remote-compile-run-before):
      * lisp/obsolete/vi.el (vi-end-of-blank-delimited-word):
      * lisp/obsolete/vip.el (vip-current-major-mode)
      (vip-paren-match, vip-switch-to-buffer)
      (vip-switch-to-buffer-other-window, vip-kill-buffer)
      (vip-get-ex-token, ex-edit):
      * lisp/org/org-element.el (org-element--cache-sync-requests):
      * lisp/org/org.el (org-sparse-tree):
      * lisp/textmodes/reftex.el (reftex-report-bug):
      * test/lisp/ibuffer-tests.el (ibuffer-save-filters):
      * test/lisp/international/ucs-normalize-tests.el
      * test/lisp/simple-tests.el (undo-test-kill-c-a-then-undo):
      * test/lisp/textmodes/conf-mode-tests.el (conf-test-toml-mode):
      * test/src/regex-emacs-tests.el (regex-tests-compare):
      Remove redundant backslashes.
  26. 23 Jan, 2020 1 commit
    • Paul Eggert's avatar
      Fix crash when sending Gnus message (Bug#39207) · 6f580542
      Paul Eggert authored
      * src/alloc.c (resize_string_data): The string must be multibyte.
      When not bothering to reallocate, do bother to change the byte count.
      * test/src/alloc-tests.el (aset-nbytes-change) New test.
  27. 07 Jan, 2020 1 commit
    • Paul Eggert's avatar
      Fix sxhash-equal on bytecodes, markers, etc. · 724af767
      Paul Eggert authored
      Problem reported by Pip Cet (Bug#38912#14).
      * doc/lispref/objects.texi (Equality Predicates):
      Document better when ‘equal’ looks inside objects.
      * doc/lispref/windows.texi (Window Configurations):
      Don’t say that ‘equal’ looks inside window configurations.
      * etc/NEWS: Mention the change.
      * src/fns.c (internal_equal):
      Do not look inside window configurations.
      (sxhash_obj): Hash markers, byte-code function objects,
      char-tables, and font objects consistently with Fequal.
      * src/window.c (compare_window_configurations):
      Now static.  Remove last argument.  Caller changed.
      * test/lisp/ffap-tests.el (ffap-other-window--bug-25352):
      Use compare-window-configurations, not ‘equal’.
      * test/src/fns-tests.el (test-sxhash-equal): New test.