From 17a3f6bf99382cdf5f982dade86d902ec6427db7 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 22 Mar 2026 16:03:16 +0000 Subject: * lisp/subr.el (member-if): Fix compiler macro multiple evaluation. Problem reported by Pip Cet . --- test/lisp/subr-tests.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 3d4f524d630..81d44b76606 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -1725,7 +1725,11 @@ The argument names are important." (let ((xs (number-sequence 0 4))) (dotimes (x (1+ (length xs))) (should (eq (subr-tests--any-memql x xs) - (memql x xs)))))) + (memql x xs))))) + (let ((n 0)) + (any (prog1 (lambda (x) (eq x 5)) (incf n)) + (number-sequence 0 4)) + (should (eq n 1)))) (ert-deftest total-line-spacing () (progn -- cgit v1.2.1 From c9676d68a25b5356d98608ab75b44b7062095637 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 23 Mar 2026 12:23:26 +0000 Subject: ; Update tests to match rename of 'any' to 'member-if'. --- test/lisp/subr-tests.el | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'test') diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 81d44b76606..791b06f9edf 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -1700,35 +1700,37 @@ final or penultimate step during initialization.")) (should (equal (funcall (subr--identity #'all) #'plusp ls) nil)) (should (equal (funcall (subr--identity #'all) #'numberp ls) t)))) -(ert-deftest subr-any () - (should (equal (any #'hash-table-p nil) nil)) +(ert-deftest subr-member-if () + (should (equal (member-if #'hash-table-p nil) nil)) (let ((ls (append '(3 2 1) '(0) '(-1 -2 -3)))) - (should (equal (any #'numberp ls) ls)) - (should (equal (any (lambda (x) (numberp x)) ls) ls)) - (should (equal (any #'plusp ls) ls)) - (should (equal (any #'zerop ls) '(0 -1 -2 -3))) - (should (equal (any #'bufferp ls) nil)) + (should (equal (member-if #'numberp ls) ls)) + (should (equal (member-if (lambda (x) (numberp x)) ls) ls)) + (should (equal (member-if #'plusp ls) ls)) + (should (equal (member-if #'zerop ls) '(0 -1 -2 -3))) + (should (equal (member-if #'bufferp ls) nil)) (let ((z 9)) - (should (equal (any (lambda (x) (< x z)) ls) ls)) - (should (equal (any (lambda (x) (< x (- z 9))) ls) '(-1 -2 -3))) - (should (equal (any (lambda (x) (> x z)) ls) nil))) - (should (equal (funcall (subr--identity #'any) #'minusp ls) '(-1 -2 -3))) - (should (equal (funcall (subr--identity #'any) #'stringp ls) nil)))) - -(defun subr-tests--any-memql (x xs) - "Like `memql', but exercising the `compiler-macro' of `any'. + (should (equal (member-if (lambda (x) (< x z)) ls) ls)) + (should (equal (member-if (lambda (x) (< x (- z 9))) ls) + '(-1 -2 -3))) + (should (equal (member-if (lambda (x) (> x z)) ls) nil))) + (should (equal (funcall (subr--identity #'member-if) #'minusp ls) + '(-1 -2 -3))) + (should (equal (funcall (subr--identity #'member-if) #'stringp ls) nil)))) + +(defun subr-tests--member-if-memql (x xs) + "Like `memql', but exercising the `compiler-macro' of `member-if'. The argument names are important." - (any (lambda (y) (eql x y)) xs)) + (member-if (lambda (y) (eql x y)) xs)) -(ert-deftest subr-any-compiler-macro () - "Test `compiler-macro' of `any'." +(ert-deftest subr-member-if-compiler-macro () + "Test `compiler-macro' of `member-if'." (let ((xs (number-sequence 0 4))) (dotimes (x (1+ (length xs))) - (should (eq (subr-tests--any-memql x xs) + (should (eq (subr-tests--member-if-memql x xs) (memql x xs))))) (let ((n 0)) - (any (prog1 (lambda (x) (eq x 5)) (incf n)) - (number-sequence 0 4)) + (member-if (prog1 (lambda (x) (eq x 5)) (incf n)) + (number-sequence 0 4)) (should (eq n 1)))) (ert-deftest total-line-spacing () -- cgit v1.2.1 From 7b8a38e05383166a088d59cb45d6569d0c4c022d Mon Sep 17 00:00:00 2001 From: F. Jason Park Date: Sun, 22 Mar 2026 21:56:23 -0700 Subject: Add tests for erc-track-faces-normal-list regression * test/lisp/erc/erc-track-tests.el (erc-track-tests--modified-channels/baseline): Update assertion to expect an unchanged mode line segment if `erc-track-faces-normal-list' lacks a ranked face in the latest inserted message. (erc-track-modified-channels/baseline/nonotice) (erc-track-modified-channels/priority-only-all/baseline/nonotice): New tests. (Bug#80659) --- test/lisp/erc/erc-track-tests.el | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/lisp/erc/erc-track-tests.el b/test/lisp/erc/erc-track-tests.el index da4a4d0fad7..cce28360eff 100644 --- a/test/lisp/erc/erc-track-tests.el +++ b/test/lisp/erc/erc-track-tests.el @@ -478,12 +478,28 @@ (funcall set-faces '(erc-notice-face)) (erc-track-modified-channels) (should (equal (alist-get (current-buffer) erc-modified-channels-alist) - '(5 . erc-notice-face)))) + (if (gethash 'erc-notice-face erc-track--normal-faces) + '(5 . erc-notice-face) + '(5 erc-button-nick-default-face erc-nick-default-face))))) (ert-deftest erc-track-modified-channels/baseline () (erc-tests-common-track-modified-channels #'erc-track-tests--modified-channels/baseline)) +;; This "baseline" variant simulates `erc-notice-face' being absent from +;; `erc-track-faces-normal-list' by removing it from the cached local +;; copy in `erc-track--normal-faces'. When absent and a message +;; highlighted in `erc-notice-face' is inserted, the mode line should +;; not change if it's currently showing a face ranked higher in +;; `erc-track-faces-priority-list'. ERC 5.6 and 5.6.1 featured a +;; regression that caused the mode line to keep alternating regardless. +;; See Bug#80659: erc: Faces not being updated correctly. +(ert-deftest erc-track-modified-channels/baseline/nonotice () + (erc-tests-common-track-modified-channels + (lambda (set-faces) + (remhash 'erc-notice-face erc-track--normal-faces) + (funcall #'erc-track-tests--modified-channels/baseline set-faces)))) + (ert-deftest erc-track-modified-channels/baseline/mention () (erc-tests-common-track-modified-channels (lambda (set-faces) @@ -613,6 +629,15 @@ (erc-tests-common-track-modified-channels #'erc-track-tests--modified-channels/baseline))) +;; Option `erc-track-priority-faces-only' does not affect Bug#80659 (see +;; baseline test without the option above). +(ert-deftest erc-track-modified-channels/priority-only-all/baseline/nonotice () + (let ((erc-track-priority-faces-only 'all)) + (erc-tests-common-track-modified-channels + (lambda (set-faces) + (remhash 'erc-notice-face erc-track--normal-faces) + (funcall #'erc-track-tests--modified-channels/baseline set-faces))))) + ;; This test simulates a common configuration that combines an ;; `erc-track-faces-priority-list' removed of `erc-notice-face' with ;; `erc-track-priority-faces-only' being `all'. It also features in the -- cgit v1.2.1 From bb0a5dd6e7df2c7f46c39283d7e0faea54d9ee76 Mon Sep 17 00:00:00 2001 From: Vincent Belaïche Date: Tue, 24 Mar 2026 18:12:38 +0100 Subject: Fix SES tests indentation. * test/lisp/ses-tests.el (ses-jump-B2-lowcase) (ses-jump-B2-lowcase-keys): Fix indentation. --- test/lisp/ses-tests.el | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el index 73f7be3145d..e406f5962e9 100644 --- a/test/lisp/ses-tests.el +++ b/test/lisp/ses-tests.el @@ -202,23 +202,23 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to (ert-deftest ses-jump-B2-lowcase () "Test jumping to cell B2 by use of lowercase cell name string" - (let ((ses-initial-size '(3 . 3)) - ses-after-entry-functions) - (with-temp-buffer - (ses-mode) - (funcall-interactively 'ses-jump "b2") - (ses-command-hook) - (should (eq (ses--cell-at-pos (point)) 'B2))))) + (let ((ses-initial-size '(3 . 3)) + ses-after-entry-functions) + (with-temp-buffer + (ses-mode) + (funcall-interactively 'ses-jump "b2") + (ses-command-hook) + (should (eq (ses--cell-at-pos (point)) 'B2))))) (ert-deftest ses-jump-B2-lowcase-keys () "Test jumping to cell B2 by use of lowercase cell name string with simulating keys" - (let ((ses-initial-size '(3 . 3)) - ses-after-entry-functions) - (with-temp-buffer - (ses-mode) - (ert-simulate-keys [ ?b ?2 return] (ses-jump)) - (ses-command-hook) - (should (eq (ses--cell-at-pos (point)) 'B2))))) + (let ((ses-initial-size '(3 . 3)) + ses-after-entry-functions) + (with-temp-buffer + (ses-mode) + (ert-simulate-keys [ ?b ?2 return] (ses-jump)) + (ses-command-hook) + (should (eq (ses--cell-at-pos (point)) 'B2))))) (ert-deftest ses-jump-B2-symbol () "Test jumping to cell B2 by use of cell name symbol" -- cgit v1.2.1 From b677a9030354ffd4d0a3dc74f8e5e5fe1946687f Mon Sep 17 00:00:00 2001 From: Vincent Belaïche Date: Tue, 24 Mar 2026 17:57:18 +0100 Subject: Rename ses tests with prefix ses-tests-... --- test/lisp/ses-tests.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el index e406f5962e9..b7133ce4d53 100644 --- a/test/lisp/ses-tests.el +++ b/test/lisp/ses-tests.el @@ -188,7 +188,7 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to ;; JUMP tests ;; ====================================================================== -(ert-deftest ses-jump-B2-prefix-arg () +(ert-deftest ses-tests-jump-B2-prefix-arg () "Test jumping to cell B2 by use of prefix argument" (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) @@ -200,7 +200,7 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to (should (eq (ses--cell-at-pos (point)) 'B2))))) -(ert-deftest ses-jump-B2-lowcase () +(ert-deftest ses-tests-jump-B2-lowcase () "Test jumping to cell B2 by use of lowercase cell name string" (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) @@ -210,7 +210,7 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to (ses-command-hook) (should (eq (ses--cell-at-pos (point)) 'B2))))) -(ert-deftest ses-jump-B2-lowcase-keys () +(ert-deftest ses-tests-jump-B2-lowcase-keys () "Test jumping to cell B2 by use of lowercase cell name string with simulating keys" (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) @@ -220,7 +220,7 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to (ses-command-hook) (should (eq (ses--cell-at-pos (point)) 'B2))))) -(ert-deftest ses-jump-B2-symbol () +(ert-deftest ses-tests-jump-B2-symbol () "Test jumping to cell B2 by use of cell name symbol" (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) @@ -230,7 +230,7 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to (ses-command-hook) (should (eq (ses--cell-at-pos (point)) 'B2))))) -(ert-deftest ses-jump-B2-renamed () +(ert-deftest ses-tests-jump-B2-renamed () "Test jumping to cell B2 after renaming it `ses--toto'." (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) @@ -241,7 +241,7 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to (ses-command-hook) (should (eq (ses--cell-at-pos (point)) 'ses--toto))))) -(ert-deftest ses-set-formula-write-cells-with-changed-references () +(ert-deftest ses-tests-set-formula-write-cells-with-changed-references () "Test fix of bug#5852. When setting a formula has some cell with changed references, this cell has to be rewritten to data area." -- cgit v1.2.1 From ebd982db332d7597d129b854a6688c415b3d947b Mon Sep 17 00:00:00 2001 From: Vincent Belaïche Date: Tue, 24 Mar 2026 18:00:14 +0100 Subject: Check all SES local variables are always set locally. --- test/lisp/ses-tests.el | 69 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el index b7133ce4d53..c1afa197c64 100644 --- a/test/lisp/ses-tests.el +++ b/test/lisp/ses-tests.el @@ -41,6 +41,19 @@ (defvar B2) (defvar ses--toto)) +;; Check no border effects +;; ====================================================================== +(defun ses-tests-check-no-border-effect () + (dolist (symb ses-localvars) + (when (consp symb) (setq symb (car symb))) + (when (string-match "\\`ses--" (symbol-name symb)) + (should (null (boundp symb)))))) + +(defun ses-tests-unbind-local-vars () + (dolist (symb ses-localvars) + (when (consp symb) (setq symb (car symb))) + (when (string-match "\\`ses--" (symbol-name symb)) (makunbound symb)))) + ;; PLAIN FORMULA TESTS ;; ====================================================================== @@ -48,24 +61,28 @@ "Check that setting A1 to 1 and A2 to (1+ A1), makes A2 value equal to 2. This is done with low level functions calls, not like interactively." + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(2 . 1))) (with-temp-buffer (ses-mode) (dolist (c '((0 0 1) (1 0 (1+ A1)))) (apply 'ses-cell-set-formula c) (apply 'ses-calculate-cell (list (car c) (cadr c) nil))) - (should (eq (bound-and-true-p A2) 2))))) + (should (eq (bound-and-true-p A2) 2)))) + (ses-tests-check-no-border-effect)) (ert-deftest ses-tests-plain-formula () "Check that setting A1 to 1 and A2 to (1+ A1), makes A2 value equal to 2. This is done using interactive calls." + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(2 . 1))) (with-temp-buffer (ses-mode) (dolist (c '((0 0 1) (1 0 (1+ A1)))) (apply 'funcall-interactively 'ses-edit-cell c)) (ses-command-hook) - (should (eq (bound-and-true-p A2) 2))))) + (should (eq (bound-and-true-p A2) 2)))) + (ses-tests-check-no-border-effect)) ;; PLAIN CELL RENAMING TESTS ;; ====================================================================== @@ -75,6 +92,7 @@ equal to 2. This is done using interactive calls." This is done using low level functions, `ses-rename-cell' is not called but instead we use text replacement in the buffer previously passed in text mode." + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(2 . 1))) (with-temp-buffer (ses-mode) @@ -90,11 +108,13 @@ previously passed in text mode." (should-not (local-variable-p 'A1)) (should (eq ses--foo 1)) (should (equal (ses-cell-formula 1 0) '(ses-safe-formula (1+ ses--foo)))) - (should (eq (bound-and-true-p A2) 2))))) + (should (eq (bound-and-true-p A2) 2)))) + (ses-tests-check-no-border-effect)) (ert-deftest ses-tests-renamed-cell () "Check that renaming A1 to `ses--foo' and setting `ses--foo' to 1 and A2 to (1+ ses--foo), makes A2 value equal to 2." + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(2 . 1))) (with-temp-buffer (ses-mode) @@ -105,11 +125,13 @@ to (1+ ses--foo), makes A2 value equal to 2." (should-not (local-variable-p 'A1)) (should (eq ses--foo 1)) (should (equal (ses-cell-formula 1 0) '(1+ ses--foo))) - (should (eq (bound-and-true-p A2) 2))))) + (should (eq (bound-and-true-p A2) 2)))) + (ses-tests-check-no-border-effect)) (ert-deftest ses-tests-renamed-cell-after-setting () "Check that setting A1 to 1 and A2 to (1+ A1), and then renaming A1 to `ses--foo' makes `ses--foo' value equal to 2." + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(2 . 1))) (with-temp-buffer (ses-mode) @@ -120,12 +142,14 @@ renaming A1 to `ses--foo' makes `ses--foo' value equal to 2." (should-not (local-variable-p 'A1)) (should (eq ses--foo 1)) (should (equal (ses-cell-formula 1 0) '(1+ ses--foo))) - (should (eq (bound-and-true-p A2) 2))))) + (should (eq (bound-and-true-p A2) 2)))) + (ses-tests-check-no-border-effect)) (ert-deftest ses-tests-renaming-cell-with-one-symbol-formula () "Check that setting A1 to 1 and A2 to A1, and then renaming A1 to `ses--foo' makes `ses--foo' value equal to 1. Then set A1 to 2 and check that `ses--foo' becomes 2." + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(3 . 1))) (with-temp-buffer (ses-mode) @@ -141,7 +165,8 @@ that `ses--foo' becomes 2." (funcall-interactively 'ses-edit-cell 0 0 2) (ses-command-hook); deferred recalc (should (eq (bound-and-true-p A2) 2)) - (should (eq ses--foo 2))))) + (should (eq ses--foo 2)))) + (ses-tests-check-no-border-effect)) ;; ROW INSERTION TESTS @@ -151,6 +176,7 @@ that `ses--foo' becomes 2." "Check that setting A1 to 1 and A2 to (1+ A1), and then jumping to A2 and inserting a row, makes A2 value empty, and A3 equal to 2." + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(2 . 1))) (with-temp-buffer (ses-mode) @@ -161,13 +187,15 @@ to A2 and inserting a row, makes A2 value empty, and A3 equal to (ses-insert-row 1) (ses-command-hook) (should-not (bound-and-true-p A2)) - (should (eq (bound-and-true-p A3) 2))))) + (should (eq (bound-and-true-p A3) 2)))) + (ses-tests-check-no-border-effect)) (ert-deftest ses-tests-renamed-cells-row-insertion () "Check that setting A1 to 1 and A2 to (1+ A1), and then renaming A1 to `ses--foo' and A2 to `ses--bar' jumping to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to 2." + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(2 . 1))) (with-temp-buffer (ses-mode) @@ -183,13 +211,15 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to (ses-insert-row 1) (ses-command-hook) (should-not (bound-and-true-p A2)) - (should (eq ses--bar 2))))) + (should (eq ses--bar 2)))) + (ses-tests-check-no-border-effect)) ;; JUMP tests ;; ====================================================================== (ert-deftest ses-tests-jump-B2-prefix-arg () "Test jumping to cell B2 by use of prefix argument" + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) (with-temp-buffer @@ -197,41 +227,49 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to ;; C-u 4 M-x ses-jump (let ((current-prefix-arg 4)) (call-interactively 'ses-jump)) - (should (eq (ses--cell-at-pos (point)) 'B2))))) + (should (eq (ses--cell-at-pos (point)) 'B2)))) + (ses-tests-check-no-border-effect)) (ert-deftest ses-tests-jump-B2-lowcase () "Test jumping to cell B2 by use of lowercase cell name string" + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) (with-temp-buffer (ses-mode) (funcall-interactively 'ses-jump "b2") (ses-command-hook) - (should (eq (ses--cell-at-pos (point)) 'B2))))) + (should (eq (ses--cell-at-pos (point)) 'B2)))) + (ses-tests-check-no-border-effect)) (ert-deftest ses-tests-jump-B2-lowcase-keys () "Test jumping to cell B2 by use of lowercase cell name string with simulating keys" + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) (with-temp-buffer (ses-mode) (ert-simulate-keys [ ?b ?2 return] (ses-jump)) (ses-command-hook) - (should (eq (ses--cell-at-pos (point)) 'B2))))) + (should (eq (ses--cell-at-pos (point)) 'B2)))) + (ses-tests-check-no-border-effect)) (ert-deftest ses-tests-jump-B2-symbol () "Test jumping to cell B2 by use of cell name symbol" + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) (with-temp-buffer (ses-mode) (funcall-interactively 'ses-jump 'B2) (ses-command-hook) - (should (eq (ses--cell-at-pos (point)) 'B2))))) + (should (eq (ses--cell-at-pos (point)) 'B2)))) + (ses-tests-check-no-border-effect)) (ert-deftest ses-tests-jump-B2-renamed () "Test jumping to cell B2 after renaming it `ses--toto'." + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(3 . 3)) ses-after-entry-functions) (with-temp-buffer @@ -239,12 +277,14 @@ to `ses--bar' and inserting a row, makes A2 value empty, and `ses--bar' equal to (ses-rename-cell 'ses--toto (ses-get-cell 1 1)) (ses-jump 'ses--toto) (ses-command-hook) - (should (eq (ses--cell-at-pos (point)) 'ses--toto))))) + (should (eq (ses--cell-at-pos (point)) 'ses--toto)))) + (ses-tests-check-no-border-effect)) (ert-deftest ses-tests-set-formula-write-cells-with-changed-references () "Test fix of bug#5852. When setting a formula has some cell with changed references, this cell has to be rewritten to data area." + (ses-tests-unbind-local-vars) (let ((ses-initial-size '(4 . 3)) (ses-after-entry-functions nil)) (with-temp-buffer @@ -261,7 +301,8 @@ cell has to be rewritten to data area." (ses-command-hook) (should (equal (ses-cell-references 1 1) '(B3))) (ses-mode) - (should (equal (ses-cell-references 1 1) '(B3)))))) + (should (equal (ses-cell-references 1 1) '(B3))))) + (ses-tests-check-no-border-effect)) (provide 'ses-tests) -- cgit v1.2.1 From f2b9b827c977dee0031e44901cbf3e1111e1cc09 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Wed, 25 Mar 2026 20:45:44 +0100 Subject: Fix Dired check for newlines in file names Ensure that Dired does not treat the sequence "\\n" within a file name as a newline (bug#80608). * lisp/dired.el (dired--filename-with-newline-p): Rewrite using 'directory-files' with match for regexp "\n". * test/lisp/dired-tests.el (dired-test--filename-with-backslash-n): New function. (dired-test-filename-with-backslash-n): New test. --- test/lisp/dired-tests.el | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test') diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 7d0ea1692ff..559e113a24c 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -658,5 +658,45 @@ The current directory at call time should not affect the result (Bug#50630)." (let ((default-directory test-dir-other)) (files-tests--insert-directory-shows-given-free test-dir))))) +(defun dired-test--filename-with-backslash-n () + "Core of test `dired-test-filename-with-backslash-n'." + (let* ((dir (ert-resource-file + (file-name-as-directory "filename-with-backslash"))) + (file (concat dir "C:\\nppdf32log\\debuglog.txt")) + (buf (progn (make-empty-file file t) + (dired-noselect (file-name-directory file)))) + (warnbuf (get-buffer "*Warnings*"))) + (with-current-buffer buf + (should-not (dired--filename-with-newline-p)) + (dired--toggle-b-switch) + (should-not (dired--filename-with-newline-p)) + (let ((fn (car (directory-files dir t + directory-files-no-dot-files-regexp)))) + (should (equal fn file)))) + (if noninteractive + (with-current-buffer "*Messages*" + (goto-char (point-min)) + (should-error (search-forward + "Warning (dired): Literal newline in file name."))) + (should-not (get-buffer "*Warnings*"))) + (kill-buffer buf) + (kill-buffer warnbuf) + (delete-directory dir t))) + +(ert-deftest dired-test-filename-with-backslash-n () ; bug#80608 + "Test file name containing literal backslash-n sequence. +Dired should not treat this sequence as a newline character, regardless +of the value of `dired-auto-toggle-b-switch'." + (with-current-buffer "*Messages*" + (let ((inhibit-read-only t)) + (erase-buffer))) + (let ((dired-auto-toggle-b-switch nil)) + (dired-test--filename-with-backslash-n)) + (with-current-buffer "*Messages*" + (let ((inhibit-read-only t)) + (erase-buffer))) + (let ((dired-auto-toggle-b-switch nil)) + (dired-test--filename-with-backslash-n))) + (provide 'dired-tests) ;;; dired-tests.el ends here -- cgit v1.2.1 From 55c752d631bcadd53e78b0798b813f50f90aefa9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 26 Mar 2026 08:10:06 +0200 Subject: ; Fix dired-tests on MS-Windows * test/lisp/dired-tests.el (dired-test-filename-with-backslash-n): Skip this test on MS-Windows and MS-DOS. --- test/lisp/dired-tests.el | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 559e113a24c..671a6c89d96 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -687,6 +687,8 @@ The current directory at call time should not affect the result (Bug#50630)." "Test file name containing literal backslash-n sequence. Dired should not treat this sequence as a newline character, regardless of the value of `dired-auto-toggle-b-switch'." + ;; File names with backslashes in basename are not allowed on MS systems. + (skip-when (memq system-type '(windows-nt ms-dos))) (with-current-buffer "*Messages*" (let ((inhibit-read-only t)) (erase-buffer))) -- cgit v1.2.1 From b5f6bc0072e59ab9ba39ed2bdd83a324b7c6ad4a Mon Sep 17 00:00:00 2001 From: Basil L. Contovounesios Date: Thu, 26 Mar 2026 15:05:22 +0100 Subject: Improve last change to auth-source-pass * lisp/auth-source-pass.el (auth-source-pass-search): Remove redundant expand-file-name. * test/lisp/auth-source-pass-tests.el (auth-source-pass--with-store): Bind auth-source-pass-filename to an existing directory to satisfy the new guard in auth-source-pass-search (bug#76323). --- test/lisp/auth-source-pass-tests.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/lisp/auth-source-pass-tests.el b/test/lisp/auth-source-pass-tests.el index 15fd9ed7007..2afd803240e 100644 --- a/test/lisp/auth-source-pass-tests.el +++ b/test/lisp/auth-source-pass-tests.el @@ -91,7 +91,10 @@ This function is intended to be set to `auth-source-debug'." ((symbol-function 'auth-source-pass-entries) (lambda () (mapcar #'car ,store)))) (let ((auth-source-debug #'auth-source-pass--debug) (auth-source-pass--debug-log nil) - (auth-source-pass--parse-log nil)) + (auth-source-pass--parse-log nil) + ;; Any existing directory will do, since we shouldn't do I/O + ;; except for the guard in `auth-source-pass-search'. + (auth-source-pass-filename default-directory)) ,@body))) (defun auth-source-pass--explain-match-entry-p (entry hostname &optional user port) -- cgit v1.2.1 From d78000728351986b0083013728dc3ef366112c0b Mon Sep 17 00:00:00 2001 From: Basil L. Contovounesios Date: Wed, 18 Mar 2026 12:42:28 +0100 Subject: Add predicate for initial_terminal This introduces the predicate frame-initial-p, which uses struct frame.output_method or struct terminal.type to detect initial_terminal without relying on its name (bug#80629). For some prior discussion, see: https://lists.gnu.org/r/emacs-devel/2019-12/msg00480.html https://lists.gnu.org/r/emacs-devel/2020-01/msg00120.html * doc/lispref/frames.texi (Frames): Document frame-initial-p. (Finding All Frames): Fix grammar. * etc/NEWS (Lisp Changes in Emacs 31.1): Announce frame-initial-p. * lisp/desktop.el (desktop--check-dont-save): * lisp/emacs-lisp/debug.el (debug): * lisp/frameset.el (frameset-restore): * lisp/menu-bar.el (menu-bar-update-buffers): * lisp/xt-mouse.el (turn-on-xterm-mouse-tracking-on-terminal): Use frame-initial-p instead of checking the "initial_terminal" name. * lisp/emacs-lisp/byte-opt.el: Mark frame-initial-p as error-free. * src/pgtkterm.c (pgtk_focus_changed): Use IS_DAEMON in place of Fdaemonp, thus also accepting a named daemon session. * src/terminal.c (decode_tty_terminal): Clarify commentary. (Fframe_initial_p): New function. (syms_of_terminal): Expose it. (init_initial_terminal): Update commentary now that menu-bar-update-buffers uses frame-initial-p (bug#53740). * test/lisp/xt-mouse-tests.el (with-xterm-mouse-mode): Simulate the lack of an initial terminal by overriding frame-initial-p now that turn-on-xterm-mouse-tracking-on-terminal uses it. * test/src/terminal-tests.el: New file. --- test/lisp/xt-mouse-tests.el | 3 +-- test/src/terminal-tests.el | 55 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 test/src/terminal-tests.el (limited to 'test') diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el index 26fe5002b68..b065fda5eed 100644 --- a/test/lisp/xt-mouse-tests.el +++ b/test/lisp/xt-mouse-tests.el @@ -50,8 +50,7 @@ ;; `xterm-mouse-mode' doesn't work in the initial ;; terminal. Since we can't create a second ;; terminal in batch mode, fake it temporarily. - (cl-letf (((symbol-function 'terminal-name) - (lambda (&optional _terminal) "fake-terminal"))) + (cl-letf (((symbol-function 'frame-initial-p) #'ignore)) (xterm-mouse-mode 1)) ,@body) (xterm-mouse-mode 0)))) diff --git a/test/src/terminal-tests.el b/test/src/terminal-tests.el new file mode 100644 index 00000000000..85c4fa04efc --- /dev/null +++ b/test/src/terminal-tests.el @@ -0,0 +1,55 @@ +;;; terminal-tests.el --- tests for terminal.c -*- lexical-binding: t -*- + +;; Copyright (C) 2026 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) + +(ert-deftest frame-initial-p () + "Test `frame-initial-p' behavior." + (should-not (frame-initial-p t)) + (should-not (frame-initial-p (current-buffer))) + (should-not (frame-initial-p (selected-window))) + ;; "Initial frame" implies "initial terminal", and + ;; no other terminal can have the initial frame. + (should-not (xor (equal (terminal-name) "initial_terminal") + (frame-initial-p))) + ;; Initial frame implies its terminal is a termcap-like + ;; text-mode terminal. + (should (or (not (frame-initial-p)) + (eq (terminal-live-p nil) t))) + ;; It similarly implies a termcap-like text-mode frame. + (should (or (not (frame-initial-p)) + (eq (frame-live-p (selected-frame)) t))) + (dolist (ft (append '(nil) (frame-list) (terminal-list))) + (ert-info ((prin1-to-string ft) :prefix "Argument: ") + (should-not (xor (equal (terminal-name ft) "initial_terminal") + (frame-initial-p ft))) + (should (or (not (frame-initial-p ft)) + (eq (terminal-live-p ft) t))))) + (cond (noninteractive + ;; Batch mode should have an initial frame. + (should (any #'frame-initial-p (frame-list))) + (should (any #'frame-initial-p (terminal-list)))) + ((not (daemonp)) + ;; Non-daemon interactive mode should have none. + (should-not (any #'frame-initial-p (frame-list))) + (should-not (any #'frame-initial-p (terminal-list)))))) + +;;; terminal-tests.el ends here -- cgit v1.2.1 From 3b7d9e37ce0c27d942ee583526bd5c96cbdd6f1e Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Fri, 27 Mar 2026 16:36:16 +0100 Subject: Implement new Dired handling of errors from 'ls' The error messages are now displayed in a popped up buffer instead of being output in the Dired buffer and signalling an error. The file name bounds in Dired entries are now determined solely by the offsets calculated by 'ls' with the --dired option and consequently Dired now reliably recognizes file names that contain a newline (bug#80499). * etc/NEWS: Announce new Dired handling of errors from 'ls'. * lisp/dired.el (dired-internal-noselect): Check Dired buffer for file entries and if there are none kill the buffer to prevent displaying a Dired buffer with no file entries. (dired--ls-error-buffer): New variable. (dired--display-ls-error): New function. (dired, dired-other-window, dired-other-frame, dired-other-tab): Use it to pop up buffer with error message emitted by 'ls'. * lisp/files.el (insert-directory-clean): Remove the code that treats lines beginning at column 0 in a Dired buffer as error lines and consequently also remove the code using these lines to adjust the offsets specifying the bounds of the file name in the Dired entries. If the buffer contains a //DIRED-OPTIONS// line output by --dired, delete this line even when it is at BOB. (insert-directory): Remove the code that checks the return value of 'ls' and signals an error based on that value. Write any error message emitted by 'ls' to a temporary file and insert its content into a buffer, which will be popped when invoking a Dired command results in the 'ls' error. Adjust the comment above this function to accommodate file names containing a newline in Dired entries. (insert-directory-adj-pos): Remove this now unused function. * test/lisp/dired-tests.el (dired-test-filename-with-newline-1) (dired-test-filename-with-newline-2) (dired-test-ls-error-message): New tests. * test/lisp/files-tests.el (files-tests-file-name-non-special-insert-directory): Adjust test to use of 'ls' error buffer instead of signaling an error. --- test/lisp/dired-tests.el | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ test/lisp/files-tests.el | 12 ++++++- 2 files changed, 93 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 671a6c89d96..8456ddb76e0 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -658,6 +658,88 @@ The current directory at call time should not affect the result (Bug#50630)." (let ((default-directory test-dir-other)) (files-tests--insert-directory-shows-given-free test-dir))))) +(ert-deftest dired-test-filename-with-newline-1 () ; bug#79528, bug#80499 + "Test handling of file name with literal embedded newline." + (with-current-buffer "*Messages*" + (let ((inhibit-read-only t)) + (erase-buffer))) + (let* ((dired-auto-toggle-b-switch nil) + (dir (ert-resource-file + (file-name-as-directory "filename-with-newline"))) + (file (concat dir "filename\nwith newline")) + (buf (progn (make-empty-file file t) + (dired (file-name-directory file)))) + (warnbuf (get-buffer "*Warnings*"))) + (should (dired--filename-with-newline-p)) + (let ((beg (point)) ; beginning of file name + (end (dired-move-to-end-of-filename))) + (should (search-backward "with newline")) ; literal space in file name + (should (search-backward "\n" beg))) ; literal newline in file name + (if noninteractive + (with-current-buffer "*Messages*" + (goto-char (point-min)) + (should (search-forward + "Warning (dired): Literal newline in file name."))) + (should (get-buffer-window warnbuf)) + (with-current-buffer warnbuf + (goto-char (point-min)) + (should (string-match + (regexp-quote "Warning (dired): Literal newline in file name.") + (buffer-substring (pos-bol) (pos-eol)))))) + (kill-buffer buf) + (kill-buffer warnbuf) + (delete-directory dir t))) + +(ert-deftest dired-test-filename-with-newline-2 () ; bug#79528, bug#80499 + "Test handling of file name with embedded newline using `b' switch." + (with-current-buffer "*Messages*" + (let ((inhibit-read-only t)) + (erase-buffer))) + (let* ((dired-auto-toggle-b-switch t) + (dir (ert-resource-file + (file-name-as-directory "filename-with-newline"))) + (file (concat dir "filename\nwith newline")) + (buf (progn (make-empty-file file t) + (dired-noselect (file-name-directory file)))) + (warnbuf (get-buffer "*Warnings*"))) + (with-current-buffer buf + (should (dired--filename-with-newline-p)) + (dired--toggle-b-switch) + (let ((beg (point)) ; beginning of file name + (end (dired-move-to-end-of-filename))) + (should (search-backward "with\\ newline")) ; result of ls -b switch + (should (search-backward "\\n" beg)))) ; result of ls -b switch + (if noninteractive + (with-current-buffer "*Messages*" + (goto-char (point-min)) + (should-error (search-forward + "Warning (dired): Literal newline in file name."))) + (should-not (get-buffer "*Warnings*"))) + (kill-buffer buf) + (kill-buffer warnbuf) + (delete-directory dir t))) + +(ert-deftest dired-test-ls-error-message () ; bug#80499 + "Test invoking `dired' on a nonexisting file. +A buffer should pop up containing the error emitted by ls. The buffer +visiting the nonexisting file should killed before `dired' returns, +hence another buffer should be returned." + (let* ((dir (ert-resource-file (file-name-as-directory "empty-dir"))) + (name (concat dir "bla")) + (buf (progn (make-directory dir) + (dired name)))) + (let ((errbuf (get-buffer "*ls error*"))) + (should (get-buffer-window errbuf)) + (should-not (equal (buffer-name buf) (file-name-nondirectory name))) + (with-current-buffer errbuf + (should (equal (buffer-string) + (concat "ls: cannot access '" + (file-name-nondirectory name) + "': No such file or directory\n")))) + (kill-buffer errbuf)) + (delete-directory dir t))) + + (defun dired-test--filename-with-backslash-n () "Core of test `dired-test-filename-with-backslash-n'." (let* ((dir (ert-resource-file diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index e6b2a0eb078..ae40bb8c385 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1027,7 +1027,17 @@ unquoted file names." (buffer-string))))) (files-tests--with-temp-non-special-and-file-name-handler (tmpdir nospecial-dir t) - (should-error (with-temp-buffer (insert-directory nospecial-dir ""))))) + (with-temp-buffer (insert-directory nospecial-dir "")) + (let ((errbuf (get-buffer "*ls error*")) + ;; By the time `ls' is called in `insert-directory', the + ;; handler prefix has been removed. + (nospecial-dir (string-remove-prefix "/:" nospecial-dir))) + (should errbuf) + (with-current-buffer errbuf + (should (equal (buffer-string) + (concat "ls: cannot access '" nospecial-dir + "': No such file or directory\n")))) + (kill-buffer errbuf)))) (ert-deftest files-tests-file-name-non-special-insert-file-contents () (files-tests--with-temp-non-special (tmpfile nospecial) -- cgit v1.2.1 From af0f9b3188bedbe82c7399062c2f70d6c1c3ff8d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Mar 2026 09:18:38 +0300 Subject: ; Fix files-tests and dired-tests on MS-Windows * test/lisp/files-tests.el (files-tests-file-name-non-special-insert-directory): Fix for MS-Windows and MS-DOS. * test/lisp/dired-tests.el (dired-test-filename-with-newline-1) (dired-test-filename-with-newline-2): Skip on MS-Windows/DOS. Remove unused variable 'end'. (dired-test-ls-error-message): Special testing for MS-Windows and MS-DOS when they use 'ls-lisp'. (Bug#80499) --- test/lisp/dired-tests.el | 52 ++++++++++++++++++++++++++++++++++-------------- test/lisp/files-tests.el | 24 ++++++++++++---------- 2 files changed, 50 insertions(+), 26 deletions(-) (limited to 'test') diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 8456ddb76e0..407f2545745 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -660,6 +660,9 @@ The current directory at call time should not affect the result (Bug#50630)." (ert-deftest dired-test-filename-with-newline-1 () ; bug#79528, bug#80499 "Test handling of file name with literal embedded newline." + ;; File names with embedded newlines are not allowed on MS-Windows and + ;; MS-DOS. + (skip-when (memq system-type '(windows-nt ms-dos))) (with-current-buffer "*Messages*" (let ((inhibit-read-only t)) (erase-buffer))) @@ -671,8 +674,7 @@ The current directory at call time should not affect the result (Bug#50630)." (dired (file-name-directory file)))) (warnbuf (get-buffer "*Warnings*"))) (should (dired--filename-with-newline-p)) - (let ((beg (point)) ; beginning of file name - (end (dired-move-to-end-of-filename))) + (let ((beg (point))) ; beginning of file name (should (search-backward "with newline")) ; literal space in file name (should (search-backward "\n" beg))) ; literal newline in file name (if noninteractive @@ -692,6 +694,9 @@ The current directory at call time should not affect the result (Bug#50630)." (ert-deftest dired-test-filename-with-newline-2 () ; bug#79528, bug#80499 "Test handling of file name with embedded newline using `b' switch." + ;; File names with embedded newlines are not allowed on MS-Windows and + ;; MS-DOS. + (skip-when (memq system-type '(windows-nt ms-dos))) (with-current-buffer "*Messages*" (let ((inhibit-read-only t)) (erase-buffer))) @@ -705,8 +710,7 @@ The current directory at call time should not affect the result (Bug#50630)." (with-current-buffer buf (should (dired--filename-with-newline-p)) (dired--toggle-b-switch) - (let ((beg (point)) ; beginning of file name - (end (dired-move-to-end-of-filename))) + (let ((beg (point))) ; beginning of file name (should (search-backward "with\\ newline")) ; result of ls -b switch (should (search-backward "\\n" beg)))) ; result of ls -b switch (if noninteractive @@ -726,18 +730,36 @@ visiting the nonexisting file should killed before `dired' returns, hence another buffer should be returned." (let* ((dir (ert-resource-file (file-name-as-directory "empty-dir"))) (name (concat dir "bla")) - (buf (progn (make-directory dir) + ;; Use PARENT = t in make-directory call to avoid failing if + ;; the directyory already exists for some reason. + (buf (progn (make-directory dir t) (dired name)))) - (let ((errbuf (get-buffer "*ls error*"))) - (should (get-buffer-window errbuf)) - (should-not (equal (buffer-name buf) (file-name-nondirectory name))) - (with-current-buffer errbuf - (should (equal (buffer-string) - (concat "ls: cannot access '" - (file-name-nondirectory name) - "': No such file or directory\n")))) - (kill-buffer errbuf)) - (delete-directory dir t))) + ;; This is for MS-Windows and MS-DOS in the default configuration. + (when (and (featurep 'ls-lisp) + (null ls-lisp-use-insert-directory-program)) + (should (bufferp buf)) + (should (equal (buffer-name buf) (file-name-nondirectory name))) + (with-current-buffer buf + ;; 'ls-lisp' creates a Dired buffer of just 3 lines, with + ;; "(No match)" on the last line + (should (string-match "(No match)" (buffer-string))) + (should (= 3 (line-number-at-pos (buffer-size) t))))) + ;; This is for Posix systems and for MS-Windows/DOS when they use 'ls'. + (unless (and (featurep 'ls-lisp) + (null ls-lisp-use-insert-directory-program)) + (let ((errbuf (get-buffer "*ls error*"))) + (should (get-buffer-window errbuf)) + (should-not (equal (buffer-name buf) (file-name-nondirectory name))) + (with-current-buffer errbuf + (should (string-match-p + (format + ;; Use .* around file name to account for different + ;; file-name quoting styles, or no quoting at all. + "%s: cannot access .*%s.*: No such file or directory\n" + insert-directory-program (file-name-nondirectory name)) + (buffer-string)))) + (kill-buffer errbuf)) + (delete-directory dir t)))) (defun dired-test--filename-with-backslash-n () diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index ae40bb8c385..414f1cf52fa 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1027,17 +1027,19 @@ unquoted file names." (buffer-string))))) (files-tests--with-temp-non-special-and-file-name-handler (tmpdir nospecial-dir t) - (with-temp-buffer (insert-directory nospecial-dir "")) - (let ((errbuf (get-buffer "*ls error*")) - ;; By the time `ls' is called in `insert-directory', the - ;; handler prefix has been removed. - (nospecial-dir (string-remove-prefix "/:" nospecial-dir))) - (should errbuf) - (with-current-buffer errbuf - (should (equal (buffer-string) - (concat "ls: cannot access '" nospecial-dir - "': No such file or directory\n")))) - (kill-buffer errbuf)))) + (if (memq system-type '(windows-nt ms-dos)) + (should-error (with-temp-buffer (insert-directory nospecial-dir ""))) + (with-temp-buffer (insert-directory nospecial-dir "")) + (let ((errbuf (get-buffer "*ls error*")) + ;; By the time `ls' is called in `insert-directory', the + ;; handler prefix has been removed. + (nospecial-dir (string-remove-prefix "/:" nospecial-dir))) + (should errbuf) + (with-current-buffer errbuf + (should (equal (buffer-string) + (concat "ls: cannot access '" nospecial-dir + "': No such file or directory\n")))) + (kill-buffer errbuf))))) (ert-deftest files-tests-file-name-non-special-insert-file-contents () (files-tests--with-temp-non-special (tmpfile nospecial) -- cgit v1.2.1 From d5a3a43745321939f3fb93fbf215849e437a111b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Mar 2026 09:29:56 +0300 Subject: ; Fix last change in dired-tests.el. --- test/lisp/dired-tests.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 407f2545745..77518f17171 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -674,7 +674,8 @@ The current directory at call time should not affect the result (Bug#50630)." (dired (file-name-directory file)))) (warnbuf (get-buffer "*Warnings*"))) (should (dired--filename-with-newline-p)) - (let ((beg (point))) ; beginning of file name + (let ((beg (point)) ; beginning of file name + (_ (dired-move-to-end-of-filename))) (should (search-backward "with newline")) ; literal space in file name (should (search-backward "\n" beg))) ; literal newline in file name (if noninteractive @@ -710,7 +711,8 @@ The current directory at call time should not affect the result (Bug#50630)." (with-current-buffer buf (should (dired--filename-with-newline-p)) (dired--toggle-b-switch) - (let ((beg (point))) ; beginning of file name + (let ((beg (point)) ; beginning of file name + (_ (dired-move-to-end-of-filename))) (should (search-backward "with\\ newline")) ; result of ls -b switch (should (search-backward "\\n" beg)))) ; result of ls -b switch (if noninteractive -- cgit v1.2.1 From 5ec2940e38aaf63ae09a3a650cb740776bcf3f2c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 28 Mar 2026 09:32:27 +0300 Subject: ; Another fix fore dired-tests.el --- test/lisp/dired-tests.el | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 77518f17171..77ed07fcc42 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -738,6 +738,7 @@ hence another buffer should be returned." (dired name)))) ;; This is for MS-Windows and MS-DOS in the default configuration. (when (and (featurep 'ls-lisp) + (boundp 'ls-lisp-use-insert-directory-program) (null ls-lisp-use-insert-directory-program)) (should (bufferp buf)) (should (equal (buffer-name buf) (file-name-nondirectory name))) @@ -748,6 +749,7 @@ hence another buffer should be returned." (should (= 3 (line-number-at-pos (buffer-size) t))))) ;; This is for Posix systems and for MS-Windows/DOS when they use 'ls'. (unless (and (featurep 'ls-lisp) + (boundp 'ls-lisp-use-insert-directory-program) (null ls-lisp-use-insert-directory-program)) (let ((errbuf (get-buffer "*ls error*"))) (should (get-buffer-window errbuf)) -- cgit v1.2.1 From 0de3844f80822ad5eadaf94d4dd0308674353778 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 28 Mar 2026 09:50:00 +0100 Subject: Fix file-name-all-completions for symlinked directories in Tramp * lisp/net/tramp.el (tramp-skeleton-file-name-all-completions): * lisp/net/tramp-adb.el (tramp-adb-handle-file-name-all-completions): * lisp/net/tramp-crypt.el (tramp-crypt-handle-file-name-all-completions): * lisp/net/tramp-fuse.el (tramp-fuse-handle-file-name-all-completions): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-name-all-completions): * lisp/net/tramp-sh.el (tramp-sh-handle-file-name-all-completions): * lisp/net/tramp-smb.el (tramp-smb-handle-file-name-all-completions): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-name-all-completions): Simplify. * tramp-tests.el (tramp-test32-shell-command): Adapt test. * lisp/net/tramp-ftp.el (tramp-disable-ange-ftp): Use `seq-difference'. * lisp/net/tramp-gvfs.el (tramp-gvfs-monitor-process-filter): Use `thread-last'. * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory): Use `seq-difference'. (tramp-sh-gio-monitor-process-filter): Use `thread-last'. * lisp/net/tramp-smb.el (tramp-smb-get-file-entries): Do not add virtual entry ""; it isn't needed anymore. * lisp/net/tramp.el (tramp-make-tramp-hop-name): Use `thread-last'. (tramp-completion-handle-file-directory-p): Use `tramp-prefix-format'. (tramp-fnac-add-trailing-slash): New defvar. (tramp-skeleton-file-name-all-completions): Handle also symlinked directories. (tramp-skeleton-directory-files): Use `tramp-fnac-add-trailing-slash'. (tramp-handle-file-name-completion): Use `seq-difference'. (tramp-handle-make-process): Handle "%w" format specifier. * test/lisp/net/tramp-tests.el (tramp-test26-file-name-completion) (tramp-test32-shell-command, tramp-test36-vc-registered): Adapt tests. --- test/lisp/net/tramp-tests.el | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 149fa1d2537..3972e5faa45 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -5078,6 +5078,21 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (sort (file-name-all-completions "b" tmp-name) #'string-lessp) '("bold" "boz/"))) (should-not (file-name-all-completions "a" tmp-name)) + ;; Symbolic links. + (tramp--test-ignore-make-symbolic-link-error + (make-symbolic-link + (file-name-concat tmp-name "foo") + (file-name-concat tmp-name "link1")) + (should (file-exists-p (expand-file-name "link1" tmp-name))) + (make-symbolic-link + (file-name-concat tmp-name "boz") + (file-name-concat tmp-name "link2")) + (should (file-exists-p (expand-file-name "link2" tmp-name))) + (should (equal (file-name-completion "li" tmp-name) "link")) + (should (member "link1" (file-name-all-completions "" tmp-name))) + (should (member "link2/" (file-name-all-completions "" tmp-name))) + (delete-file (file-name-concat tmp-name "link1")) + (delete-file (file-name-concat tmp-name "link2"))) ;; `completion-regexp-list' restricts the completion to ;; files which match all expressions in this list. ;; Ange-FTP does not complete "". @@ -6329,9 +6344,12 @@ INPUT, if non-nil, is a string sent to the process." this-shell-command "echo foo >&2; echo bar" (current-buffer) stderr) (should (string-equal "bar\n" (buffer-string))) - ;; Check stderr. + ;; Check stderr. Some shells echo, for example the + ;; "adb" or container methods. (should - (string-equal "foo\n" (tramp-get-buffer-string stderr)))) + (string-match-p + (rx bol (** 1 2 "foo\n") eol) + (tramp-get-buffer-string stderr)))) ;; Cleanup. (ignore-errors (kill-buffer stderr)))))) @@ -6896,8 +6914,7 @@ INPUT, if non-nil, is a string sent to the process." "Check `vc-registered'." :tags '(:expensive-test) (skip-unless (tramp--test-enabled)) - (skip-unless (tramp--test-sh-p)) - (skip-unless (not (tramp--test-crypt-p))) + (skip-unless (tramp--test-supports-processes-p)) (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil))) ;; We must use `file-truename' for the temporary directory, in @@ -6912,17 +6929,9 @@ INPUT, if non-nil, is a string sent to the process." (inhibit-message (not (ignore-errors (edebug-mode)))) (vc-handled-backends (cond - ((tramp-find-executable - tramp-test-vec vc-git-program - (tramp-get-remote-path tramp-test-vec)) - '(Git)) - ((tramp-find-executable - tramp-test-vec vc-hg-program - (tramp-get-remote-path tramp-test-vec)) - '(Hg)) - ((tramp-find-executable - tramp-test-vec vc-bzr-program - (tramp-get-remote-path tramp-test-vec)) + ((executable-find vc-git-program 'remote) '(Git)) + ((executable-find vc-hg-program 'remote) '(Hg)) + ((executable-find vc-bzr-program 'remote) (setq tramp-remote-process-environment (cons (format "BZR_HOME=%s" (file-remote-p tmp-name1 'localname)) -- cgit v1.2.1 From 5346417d16a036418fd467f842e97a8bc7e21c63 Mon Sep 17 00:00:00 2001 From: Richard Lawrence Date: Tue, 16 Dec 2025 10:39:19 +0100 Subject: Update gnus-icalendar to use new iCalendar library This change updates gnus-icalendar.el to use the new iCalendar library instead of obsolete functions from icalendar.el. * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event) (gnus-icalendar-event:recurring-p) (gnus-icalendar-event:recurring-interval) (gnus-icalendar-event:recurring-days) (gnus-icalendar-event--find-attendee) (gnus-icalendar-event-from-ical) (gnus-icalendar-event-from-buffer) (gnus-icalendar-event--build-reply) (gnus-icalendar-event-reply-from-buffer) (gnus-icalendar-event:org-repeat): Reimplement using new iCalendar functions. (gnus-icalendar-event--attendees-by-type): Rename from `gnus-icalendar-event--get-attendee-names'. (gnus-icalendar-event--build-reply): Rename from `gnus-icalendar-event--build-reply-event-body'. (gnus-icalendar--format-participant-list): Expect list of `icalendar-attendee's. Add docstring. (Bug#80426) * test/lisp/gnus/gnus-icalendar-tests.el: Update tests. --- test/lisp/gnus/gnus-icalendar-tests.el | 82 +++++++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/lisp/gnus/gnus-icalendar-tests.el b/test/lisp/gnus/gnus-icalendar-tests.el index df9358b96c5..e668becd54d 100644 --- a/test/lisp/gnus/gnus-icalendar-tests.el +++ b/test/lisp/gnus/gnus-icalendar-tests.el @@ -35,7 +35,7 @@ (let (event) (with-temp-buffer (insert ical-string) - (setq event (gnus-icalendar-event-from-buffer (buffer-name) participant))) + (setq event (gnus-icalendar-event-from-buffer (current-buffer) participant))) event)) (ert-deftest gnus-icalendar-parse () @@ -94,7 +94,8 @@ END:VCALENDAR (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3") (should (eq (eieio-object-class event) 'gnus-icalendar-event-request)) (should (not (gnus-icalendar-event:recurring-p event))) - (should (string= (gnus-icalendar-event:start event) "2020-12-08 15:00")) + (should (equal (gnus-icalendar-event:start event) + "2020-12-08 15:00")) (with-slots (organizer summary description location end-time uid rsvp participation-type) event (should (string= organizer "anoncompany.com_3bm6fh805bme9uoeliqcle1sag@group.calendar.google.com")) (should (string= summary "Townhall | All Company Meeting")) @@ -106,9 +107,20 @@ END:VCALENDAR (should (eq participation-type 'non-participant)))) (setenv "TZ" tz)))) +(defun gnus-icalendar-at/@ () + "Replace \" \" with \"@\" before parsing." + (goto-char (point-min)) + (while (re-search-forward " " nil t) + (replace-match "@"))) + +;; FIXME: is "icalendary" (not "icalendar") intentional, here and below? (ert-deftest gnus-icalendary-byday () "" - (let ((tz (getenv "TZ")) + (let* ((tz (getenv "TZ")) + (icalendar-pre-parsing-hook + ;; clean up " " addresses so the parser doesn't choke... + ;; FIXME: can we just change the test data, or is this a real example? + '(gnus-icalendar-at/@)) (event (gnus-icalendar-tests--get-ical-event "\ BEGIN:VCALENDAR PRODID:Zimbra-Calendar-Provider @@ -138,8 +150,8 @@ SUMMARY:appointment every weekday\\, start jul 24\\, 2020\\, end aug 24\\, 2020 ATTENDEE;CN=Mark Hershberger;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP =TRUE:mailto:hexmode gmail.com ORGANIZER;CN=Mark A. Hershberger:mailto:mah nichework.com -DTSTART;TZID=\"America/New_York\":20200724T090000 -DTEND;TZID=\"America/New_York\":20200724T093000 +DTSTART;TZID=America/New_York:20200724T090000 +DTEND;TZID=America/New_York:20200724T093000 STATUS:CONFIRMED CLASS:PUBLIC X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY @@ -163,10 +175,12 @@ END:VCALENDAR" (list "Mark Hershberger")))) (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3") (should (eq (eieio-object-class event) 'gnus-icalendar-event-request)) (should (gnus-icalendar-event:recurring-p event)) - (should (string= (gnus-icalendar-event:recurring-interval event) "1")) + (should (= 1 (gnus-icalendar-event:recurring-interval event))) (should (string= (gnus-icalendar-event:start event) "2020-07-24 15:00")) (with-slots (organizer summary description location end-time uid rsvp participation-type) event - (should (string= organizer "mah nichework.com")) + (should (string= organizer + (replace-regexp-in-string " " "@" + "mah nichework.com"))) (should (string= summary "appointment every weekday, start jul 24, 2020, end aug 24, 2020")) (should (string= description "The following is a new meeting request:")) (should (null location)) @@ -236,7 +250,7 @@ END:VCALENDAR" (list "participant@anoncompany.com")))) (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3") (should (eq (eieio-object-class event) 'gnus-icalendar-event-request)) (should (gnus-icalendar-event:recurring-p event)) - (should (string= (gnus-icalendar-event:recurring-interval event) "1")) + (should (= 1 (gnus-icalendar-event:recurring-interval event))) (should (string= (gnus-icalendar-event:start event) "2020-09-15 14:00")) (with-slots (organizer summary description location end-time uid rsvp participation-type) event (should (string= organizer "anon@anoncompany.com")) @@ -258,6 +272,29 @@ END:VCALENDAR" (list "participant@anoncompany.com")))) (ert-deftest gnus-icalendar-accept-with-comment () "" (let ((event "\ +BEGIN:VCALENDAR +PRODID:-//Google Inc//Google Calendar 70.9054//EN +VERSION:2.0 +CALSCALE:GREGORIAN +METHOD:REQUEST +BEGIN:VTIMEZONE +TZID:Europe/Berlin +X-LIC-LOCATION:Europe/Berlin +BEGIN:DAYLIGHT +TZOFFSETFROM:+0100 +TZOFFSETTO:+0200 +TZNAME:CEST +DTSTART:19700329T020000 +RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU +END:DAYLIGHT +BEGIN:STANDARD +TZOFFSETFROM:+0200 +TZOFFSETTO:+0100 +TZNAME:CET +DTSTART:19701025T030000 +RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU +END:STANDARD +END:VTIMEZONE BEGIN:VEVENT DTSTART;TZID=Europe/Berlin:20200915T140000 DTEND;TZID=Europe/Berlin:20200915T143000 @@ -275,7 +312,8 @@ SEQUENCE:0 STATUS:CONFIRMED SUMMARY:Casual coffee talk TRANSP:OPAQUE -END:VEVENT") +END:VEVENT +END:VCALENDAR") (icalendar-identities '("participant@anoncompany.com"))) (let* ((reply (with-temp-buffer (insert event) @@ -292,6 +330,29 @@ END:VEVENT") (ert-deftest gnus-icalendar-decline-without-changing-comment () "" (let ((event "\ +BEGIN:VCALENDAR +PRODID:-//Google Inc//Google Calendar 70.9054//EN +VERSION:2.0 +CALSCALE:GREGORIAN +METHOD:REQUEST +BEGIN:VTIMEZONE +TZID:Europe/Berlin +X-LIC-LOCATION:Europe/Berlin +BEGIN:DAYLIGHT +TZOFFSETFROM:+0100 +TZOFFSETTO:+0200 +TZNAME:CEST +DTSTART:19700329T020000 +RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU +END:DAYLIGHT +BEGIN:STANDARD +TZOFFSETFROM:+0200 +TZOFFSETTO:+0100 +TZNAME:CET +DTSTART:19701025T030000 +RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU +END:STANDARD +END:VTIMEZONE BEGIN:VEVENT DTSTART;TZID=Europe/Berlin:20200915T140000 DTEND;TZID=Europe/Berlin:20200915T143000 @@ -310,7 +371,8 @@ SEQUENCE:0 STATUS:CONFIRMED SUMMARY:Casual coffee talk TRANSP:OPAQUE -END:VEVENT") +END:VEVENT +END:VCALENDAR") (icalendar-identities '("participant@anoncompany.com"))) (let* ((reply (with-temp-buffer (insert event) -- cgit v1.2.1 From 0c961b7778a0d9dbac3187fdbb722b24f750f764 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Sat, 28 Mar 2026 20:55:53 +0100 Subject: ; Improve check of 'ls' error message in files-tests.el * test/lisp/files-tests.el (files-tests-file-name-non-special-insert-directory): Account for 'ls' error messages which designate 'ls' differently, e.g. as 'gls' or '/bin/ls' and which use different or no quoting of the file name. --- test/lisp/files-tests.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 414f1cf52fa..6781c4a3d8b 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1036,9 +1036,13 @@ unquoted file names." (nospecial-dir (string-remove-prefix "/:" nospecial-dir))) (should errbuf) (with-current-buffer errbuf - (should (equal (buffer-string) - (concat "ls: cannot access '" nospecial-dir - "': No such file or directory\n")))) + (should (string-match-p + (format + ;; Use .* around file name to account for different + ;; file-name quoting styles, or no quoting at all. + "%s: cannot access .*%s.*: No such file or directory\n" + insert-directory-program nospecial-dir) + (buffer-string)))) (kill-buffer errbuf))))) (ert-deftest files-tests-file-name-non-special-insert-file-contents () -- cgit v1.2.1 From 8485e4968030dedb312460d89ad84b3c92b94663 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 31 Mar 2026 09:45:42 -0400 Subject: python-tests.el: Fix test failures introduced by commit c1c08f3c9f6 * test/lisp/progmodes/python-tests.el (python-ts-mode-dotted-decorator-face-2) (python-ts-mode-builtin-call-face) (python-ts-mode-level-fontification-wo-interpolation) (python-ts-mode-disabled-string-interpolation): Call `font-lock-ensure` after setting a var that may flush the font-locking. --- test/lisp/progmodes/python-tests.el | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 1c625d79ca2..4d9e468bee1 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -8012,6 +8012,7 @@ always located at the beginning of buffer." def test():" (setopt treesit-font-lock-level 4) + (font-lock-ensure) (dolist (test '("pytest" "mark" "skip")) (search-forward test) (goto-char (match-beginning 0)) @@ -8022,6 +8023,7 @@ always located at the beginning of buffer." "all()" ;; enable 'function' feature from 4th level (setopt treesit-font-lock-level 4) + (font-lock-ensure) (should (eq (face-at-point) 'font-lock-builtin-face)))) (ert-deftest python-ts-mode-interpolation-nested-string () @@ -8050,6 +8052,7 @@ always located at the beginning of buffer." "t = f\"beg {True + var}\"" (setopt treesit-font-lock-level 2) + (font-lock-ensure) (search-forward "f") (goto-char (match-beginning 0)) (should (not (eq (face-at-point) 'font-lock-string-face))) @@ -8068,6 +8071,7 @@ always located at the beginning of buffer." (setf (nth 2 treesit-font-lock-feature-list) (remq 'string-interpolation (nth 2 treesit-font-lock-feature-list))) (setopt treesit-font-lock-level 3) + (font-lock-ensure) (search-forward "f") (goto-char (match-beginning 0)) -- cgit v1.2.1 From e9a51f0819461b8b8adbf1bca860e1cbfcd03a22 Mon Sep 17 00:00:00 2001 From: Stéphane Marks Date: Fri, 3 Apr 2026 05:18:48 -0400 Subject: ; Fix cus-edit setopt test * test/lisp/cus-edit-tests.el (test-setopt): Change 'test-setopt' message text. --- test/lisp/cus-edit-tests.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/lisp/cus-edit-tests.el b/test/lisp/cus-edit-tests.el index 67a377e9073..770a1549c56 100644 --- a/test/lisp/cus-edit-tests.el +++ b/test/lisp/cus-edit-tests.el @@ -90,7 +90,7 @@ (erase-buffer)) (setopt cus-edit-test-foo1 :foo) (buffer-substring-no-properties (point-min) (point-max))))) - (should (string-search "Value `:foo' for variable `cus-edit-test-foo1' does not match its type \"number\"" + (should (string-search "Value does not match cus-edit-test-foo1's type `number': :foo\n" warn-txt)))) (defcustom cus-edit-test-bug63290-option nil -- cgit v1.2.1