branch: externals/dash commit b945f0076415d2e0ce5fe7771bd54b8a6acaf926 Merge: 2675596 36b6da5 Author: Basil L. Contovounesios <conto...@tcd.ie> Commit: Basil L. Contovounesios <conto...@tcd.ie>
Merge PR #384 from brennier/master --- NEWS.md | 12 ++++++++++-- dash.el | 4 +--- dev/examples.el | 2 ++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index bd9700e..2a813f2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,13 +6,21 @@ See the end of the file for license conditions. ## Change log +### From 2.19.0 to 2.19.1 + +#### Fixes + +- Fixed a regression from `2.18` in `-is-suffix-p` which led to false + negatives when parts of the suffix appeared multiple times in the + list being searched (Bennett Rennier, #384). + ### From 2.18.1 to 2.19.0 #### Fixes - Reverted a breaking change introduced in `2.18.0` that caused the - threading macro `-->` to be indented differently from `->` and - `->>` (#375). + threading macro `-->` to be indented differently from `->` and `->>` + (#375). - Added and fixed Edebug specifications for many Dash macros (Philipp Stephani, #380, #381). diff --git a/dash.el b/dash.el index 4e56da4..4a591f3 100644 --- a/dash.el +++ b/dash.el @@ -2729,9 +2729,7 @@ Alias: `-is-prefix-p'." Alias: `-is-suffix-p'." (declare (pure t) (side-effect-free t)) - (cond ((null suffix)) - ((setq list (member (car suffix) list)) - (equal (cdr suffix) (cdr list))))) + (equal suffix (last list (length suffix)))) (defun -is-infix? (infix list) "Return non-nil if INFIX is infix of LIST. diff --git a/dev/examples.el b/dev/examples.el index 0125da2..480304e 100644 --- a/dev/examples.el +++ b/dev/examples.el @@ -758,6 +758,8 @@ value rather than consuming a list to produce a single value." (-is-suffix? '(nil) '(nil)) => t (-is-suffix? '(nil) '()) => nil (-is-suffix? '(1 2) '(1 2 3)) => nil + (-is-suffix? '(1 2) '(1 2 1 2)) => t + (-is-suffix? '(1 2) '(1 3 1 2)) => t (let* ((s (list 1 2)) (l s) (c (copy-sequence s))) (and (-is-suffix? s l) (equal s c) (equal l c))) => t)