X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-lib.el;h=d5ca0f404ff5de3d529c946c0e05e0927186a7f4;hb=3185df17eb6c7621df3945841af58f2b19facc40;hp=cc80fb29ee24a5f6d59b77e1a3632719b67ae726;hpb=bc382902c10c7c39076a8c70da846317f505f527;p=notmuch diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index cc80fb29..d5ca0f40 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -120,6 +120,15 @@ within the current window." (or (memq prop buffer-invisibility-spec) (assq prop buffer-invisibility-spec))))) +(defun notmuch-remove-if-not (predicate list) + "Return a copy of LIST with all items not satisfying PREDICATE removed." + (let (out) + (while list + (when (funcall predicate (car list)) + (push (car list) out)) + (setq list (cdr list))) + (nreverse out))) + ; This lets us avoid compiling these replacement functions when emacs ; is sufficiently new enough to supply them alone. We do the macro ; treatment rather than just wrapping our defun calls in a when form