From: Eli Zaretskii Date: Sat, 9 Sep 2023 08:32:45 +0000 (-0400) Subject: Merge from origin/emacs-29 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0273914921833d2e2b6548cf69297c24a50cff74;p=emacs.git Merge from origin/emacs-29 bc56da92d8d ; Fix error in 'tex-recenter-output-buffer' d17c5adc057 Fix regexp for recognizing PBM images 9e9f61866e7 Improve wording in ELisp manual 7427efa033b Fix typo (Bug#65764) 59c66244080 ; * lisp/ido.el (ido-completion-buffer): Fix :type (bug#6... 4ec4b18c2a0 Fix libgccjit build on Haiku 80bdcf8f351 (regexp-tests-backtrack-optimization): Mark it as failing 8a9e653cc82 ; Add regression test for bug#65726 6fad73d7cc5 * src/regex-emacs.c (mutually_exclusive_p): Fix inf-loop ... 1d3d4196073 ; * lisp/files.el (save-some-buffers-functions): Doc fix ... 42b14c6e5bb Bump seq version to 2.24 ff5190a174f Add note on ELPA to admin/notes/bug-triage f1e4cbe72aa ; * etc/PROBLEMS: Minor wording fix. fd5593c7f25 * etc/PROBLEMS: Mention bug#65432 and its remedy. dd896ea1e62 Ignore errors when checking for object initializers (bug#... 3550f44c17c ; Fix typos 5b246b9b817 * CONTRIBUTE: Document making ChangeLogs with Magit. 0bd46619413 Doc fixes for obsolete functions and variables 524c0c34f24 ; * lisp/ffap.el (ffap-rfs-regexp): Fix :type (bug#65698). f48dccc4675 Merge branch 'emacs-29' of git.savannah.gnu.org:/srv/git/... 71a85e22668 A revision to the Widget manual dbbcf4a6599 Fix fontification of " in edit-kbd-macro # Conflicts: # test/src/regex-emacs-tests.el --- 0273914921833d2e2b6548cf69297c24a50cff74 diff --cc test/src/regex-emacs-tests.el index 4e2c0f67a44,195b3c9f8c0..60c19f1ab2d --- a/test/src/regex-emacs-tests.el +++ b/test/src/regex-emacs-tests.el @@@ -883,86 -884,8 +884,90 @@@ This evaluates the TESTS test cases fro (should (looking-at "x*\\(=\\|:\\)*")) (should (looking-at "x*=*?")))) +(ert-deftest regexp-tests-zero-width-assertion-repetition () + ;; Check compatibility behaviour with repetition operators after + ;; certain zero-width assertions (bug#64128). + + ;; This function is just to hide ugly regexps from relint so that it + ;; doesn't complain about them. + (cl-flet ((smatch (re str) (string-match re str))) + ;; Postfix operators after ^ and \` become literals, for historical + ;; compatibility. Only the first character of a lazy operator (like *?) + ;; becomes a literal. + (should (equal (smatch "^*a" "x\n*a") 2)) + (should (equal (smatch "^*?a" "x\n*a") 2)) + (should (equal (smatch "^*?a" "x\na") 2)) + (should (equal (smatch "^*?a" "x\n**a") nil)) + + (should (equal (smatch "\\`*a" "*a") 0)) + (should (equal (smatch "\\`*?a" "*a") 0)) + (should (equal (smatch "\\`*?a" "a") 0)) + (should (equal (smatch "\\`*?a" "**a") nil)) + + ;; Other zero-width assertions are treated as normal elements, so postfix + ;; operators apply to them alone (which is pointless but valid). + (should (equal (smatch "\\b*!" "*!") 1)) + (should (equal (smatch "!\\b+;" "!;") nil)) + (should (equal (smatch "!\\b+a" "!a") 0)) + + (should (equal (smatch "\\B*!" "*!") 1)) + (should (equal (smatch "!\\B+;" "!;") 0)) + (should (equal (smatch "!\\B+a" "!a") nil)) + + (should (equal (smatch "\\<*b" "*b") 1)) + (should (equal (smatch "a\\<*b" "ab") 0)) + (should (equal (smatch ";\\<*b" ";b") 0)) + (should (equal (smatch "a\\<+b" "ab") nil)) + (should (equal (smatch ";\\<+b" ";b") 0)) + + (should (equal (smatch "\\>*;" "*;") 1)) + (should (equal (smatch "a\\>*b" "ab") 0)) + (should (equal (smatch "a\\>*;" "a;") 0)) + (should (equal (smatch "a\\>+b" "ab") nil)) + (should (equal (smatch "a\\>+;" "a;") 0)) + + (should (equal (smatch "a\\'" "ab") nil)) + (should (equal (smatch "b\\'" "ab") 1)) + (should (equal (smatch "a\\'*b" "ab") 0)) + (should (equal (smatch "a\\'+" "ab") nil)) + (should (equal (smatch "b\\'+" "ab") 1)) + (should (equal (smatch "\\'+" "+") 1)) + + (should (equal (smatch "\\_<*b" "*b") 1)) + (should (equal (smatch "a\\_<*b" "ab") 0)) + (should (equal (smatch " \\_<*b" " b") 0)) + (should (equal (smatch "a\\_<+b" "ab") nil)) + (should (equal (smatch " \\_<+b" " b") 0)) + + (should (equal (smatch "\\_>*;" "*;") 1)) + (should (equal (smatch "a\\_>*b" "ab") 0)) + (should (equal (smatch "a\\_>* " "a ") 0)) + (should (equal (smatch "a\\_>+b" "ab") nil)) + (should (equal (smatch "a\\_>+ " "a ") 0)) + + (should (equal (smatch "\\=*b" "*b") 1)) + (should (equal (smatch "a\\=*b" "a*b") nil)) + (should (equal (smatch "a\\=*b" "ab") 0)) + )) + +(ert-deftest regex-emacs-syntax-properties () + ;; Verify absence of character class syntax property ghost matching bug. + (let ((re "\\s-[[:space:]]") + (s (concat "a" + (propertize "b" 'syntax-table '(0)) ; whitespace + "éz")) + (parse-sexp-lookup-properties t)) + ;; Test matching in a string... + (should (equal (string-match re s) nil)) + ;; ... and in a buffer. + (should (equal (with-temp-buffer + (insert s) + (goto-char (point-min)) + (re-search-forward re nil t)) + nil)))) + + (ert-deftest regex-tests-mutual-exclusive-inf-rec () + ;; Regression test for bug#65726, where this crashed Emacs. + (should (equal (string-match "a*\\(?:c\\|b*\\)*" "a") 0))) + ;;; regex-emacs-tests.el ends here