all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#50110: 26.3; Doc of `assoc': TESTFN optional arg
@ 2021-08-18 17:36 Drew Adams
  2021-08-18 17:50 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2021-08-18 17:36 UTC (permalink / raw)
  To: 50110

Neither the `assoc' doc string nor the Elisp manual, node `Association
Lists' explains the order of the args that get passed to TESTFN.

It's just as reasonable to expect that the pattern is the first arg to
TESTFN, instead of, as is actually the case, the second arg.

E.g., one could suppose that this would work (return the first element):

(setq trees '(("pine" . "cones") ("oak" . "acorns")))

(assoc ".*ine" trees #'string-match-p)

But in fact this is what you need:

(assoc ".*ine" trees (lambda (x regexp) (string-match-p regexp x)))

Please consider documenting the arg order for TESTFN.

In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
 of 2019-08-29
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor `Microsoft Corp.', version 10.0.19042
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-18 19:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-18 17:36 bug#50110: 26.3; Doc of `assoc': TESTFN optional arg Drew Adams
2021-08-18 17:50 ` Eli Zaretskii
2021-08-18 18:41   ` bug#50110: [External] : " Drew Adams
2021-08-18 19:08     ` Eli Zaretskii
2021-08-18 19:49       ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.