GNU bug report logs - #58278
Add new function seq-keep

Previous Next

Package: emacs;

Reported by: Jonas Bernoulli <jonas <at> bernoul.li>

Date: Mon, 3 Oct 2022 21:31:02 UTC

Severity: normal

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jonas Bernoulli <jonas <at> bernoul.li>
Cc: 58278 <at> debbugs.gnu.org
Subject: bug#58278: Add new function seq-keep
Date: Tue, 04 Oct 2022 15:56:08 +0200
Just for kicks, here's some random "del.*map" instances from the
Emacs sources:

(delq nil (mapcar (lambda (n) (and (>= n 0) n)) articles))

This should be (seq-filter #'cl-plusp articles).

(delq nil (mapcar #'gnus-server-to-method gnus-agent-covered-methods))

This would be nice as seq-keep.

      (delq nil (mapcar
                 (lambda (c)
                   (when (string-prefix-p base c)
                     (substring c base-size)))
                 hist)))))

Ditto.

   (delq nil (mapcar (lambda (action)
                       (cond
                        ((eq action 'create) 'created)
                        ((eq action 'modify) 'changed)
                        ((eq action 'attrib) 'attribute-changed)
                        ((memq action '(delete delete-self move-self)) 'deleted)
                        ((eq action 'moved-from) 'renamed-from)
                        ((eq action 'moved-to) 'renamed-to)
                        ((eq action 'ignored) 'stopped)))
                     actions))

Ditto.

     (delq nil (mapcar
		(lambda (x) (if (string-match "\\`\\." x) x))
		ido-temp-list)))

This should be seq-filter.

			(cookies (delq nil (mapcar
					    (lambda (e)
					      (org-list-get-checkbox e s))
					    items))))

seq-keep.

    (let* ((have (delq nil (mapcar
			    (lambda (x) (get-text-property 1 'time-of-day x))
			    list)))

seq-keep.

          (string-join
           (delq nil (mapcar
                      (lambda (item)
                        (when (cdr item)
                          (format "%s='%s'" (car item) (cdr item))))
                      `(("type" . ,type) ("sender" . ,sender)
                        ("destination" . ,destination) ("path" . ,path)
                        ("interface" . ,interface) ("member" . ,member))))
           ",")

seq-keep.

       (reverse (delete "" (mapcar (lambda (r)
				     (replace-regexp-in-string "nil" "" r))
				   result0)))))))

This suggest that the signature should be

(func sequence &optional delete-element)

which defaults to nil, but could be "" here, and use seq-keep.

  (delq 'type (mapcar #'car (haiku-selection-data clipboard nil))))

Ditto.






This bug report was last modified 2 years and 270 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.