Allow plist-get/plist-put/plist-member to take a comparison function

* doc/lispref/lists.texi (Plist Access): Document it.

* lisp/filesets.el (filesets-reset-fileset)
(filesets-ingroup-cache-get):
(filesets-ingroup-cache-put):
(filesets-build-menu-now): Don't use lax-plist functions.

* lisp/simple.el (lax-plist-put, lax-plist-get): Moved here from
fns.c and make obsolete.

* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Don't mark
plist functions as side-effect-free or pure.

* lisp/emacs-lisp/comp.el (comp-known-type-specifiers): Adjust type.

* lisp/emacs-lisp/shortdoc.el (list): Don't document deprecated
functions.

* src/xdisp.c (build_desired_tool_bar_string):
(display_mode_element):
(store_mode_line_string):
(display_string):
(produce_stretch_glyph):
(note_mode_line_or_margin_highlight):
(note_mouse_highlight):
* src/w32.c (serial_configure):
* src/sysdep.c (serial_configure):
* src/sound.c (parse_sound):
* src/process.c (Fset_process_buffer):
(Fset_process_sentinel):
(Fprocess_contact):
(Fmake_process):
(Fmake_pipe_process):
(Fset_network_process_option):
(Fserial_process_configure):
(Fmake_serial_process):
(set_network_socket_coding_system):
(finish_after_tls_connection):
(connect_network_socket):
(Fmake_network_process):
(server_accept_connection):
* src/lread.c (ADDPARAM):
(hash_table_from_plist):
* src/keyboard.c (make_lispy_position):
* src/indent.c (check_display_width):
* src/image.c (postprocess_image):
* src/gnutls.c (gnutls_verify_boot):
(Fgnutls_boot):
(gnutls_symmetric):
(Fgnutls_hash_mac):
(Fgnutls_hash_digest):
* src/dired.c (filter):
* src/data.c (add_to_function_history):
* src/coding.c (Fcoding_system_put): Adjust callers from
Fplist_put (etc) to plist_put.

* src/fns.c (plist_get):
(plist_put):
(plist_member): New functions (without optional third parameter)
to be used in C code.

* src/fns.c (Fplist_get, Fplist_put, Fplist_member): Take an
optional predicate parameter (bug#47425).

* src/lisp.h: Declare new plist_put, plist_get and plist_member
functions.

* test/lisp/json-tests.el (test-json-add-to-plist): Use plist-get.

* test/src/fns-tests.el (test-cycle-lax-plist-get):
(test-cycle-lax-plist-put):
(lax-plist-get/odd-number-of-elements):
(test-plist): Remove lax-plist tests, since semantics have changed
(they no longer error out on cycles).
This commit is contained in:
Lars Ingebrigtsen 2022-06-27 12:22:05 +02:00
parent 5b1bb1af03
commit 513acdc9b4
28 changed files with 334 additions and 345 deletions

View file

@ -2939,21 +2939,21 @@ serial_configure (struct Lisp_Process *p,
#endif
/* Configure speed. */
if (!NILP (Fplist_member (contact, QCspeed)))
tem = Fplist_get (contact, QCspeed);
if (!NILP (plist_member (contact, QCspeed)))
tem = plist_get (contact, QCspeed);
else
tem = Fplist_get (p->childp, QCspeed);
tem = plist_get (p->childp, QCspeed);
CHECK_FIXNUM (tem);
err = cfsetspeed (&attr, convert_speed (XFIXNUM (tem)));
if (err != 0)
report_file_error ("Failed cfsetspeed", tem);
childp2 = Fplist_put (childp2, QCspeed, tem);
childp2 = plist_put (childp2, QCspeed, tem);
/* Configure bytesize. */
if (!NILP (Fplist_member (contact, QCbytesize)))
tem = Fplist_get (contact, QCbytesize);
if (!NILP (plist_member (contact, QCbytesize)))
tem = plist_get (contact, QCbytesize);
else
tem = Fplist_get (p->childp, QCbytesize);
tem = plist_get (p->childp, QCbytesize);
if (NILP (tem))
tem = make_fixnum (8);
CHECK_FIXNUM (tem);
@ -2968,13 +2968,13 @@ serial_configure (struct Lisp_Process *p,
if (XFIXNUM (tem) != 8)
error ("Bytesize cannot be changed");
#endif
childp2 = Fplist_put (childp2, QCbytesize, tem);
childp2 = plist_put (childp2, QCbytesize, tem);
/* Configure parity. */
if (!NILP (Fplist_member (contact, QCparity)))
tem = Fplist_get (contact, QCparity);
if (!NILP (plist_member (contact, QCparity)))
tem = plist_get (contact, QCparity);
else
tem = Fplist_get (p->childp, QCparity);
tem = plist_get (p->childp, QCparity);
if (!NILP (tem) && !EQ (tem, Qeven) && !EQ (tem, Qodd))
error (":parity must be nil (no parity), `even', or `odd'");
#if defined (PARENB) && defined (PARODD) && defined (IGNPAR) && defined (INPCK)
@ -3001,13 +3001,13 @@ serial_configure (struct Lisp_Process *p,
if (!NILP (tem))
error ("Parity cannot be configured");
#endif
childp2 = Fplist_put (childp2, QCparity, tem);
childp2 = plist_put (childp2, QCparity, tem);
/* Configure stopbits. */
if (!NILP (Fplist_member (contact, QCstopbits)))
tem = Fplist_get (contact, QCstopbits);
if (!NILP (plist_member (contact, QCstopbits)))
tem = plist_get (contact, QCstopbits);
else
tem = Fplist_get (p->childp, QCstopbits);
tem = plist_get (p->childp, QCstopbits);
if (NILP (tem))
tem = make_fixnum (1);
CHECK_FIXNUM (tem);
@ -3023,13 +3023,13 @@ serial_configure (struct Lisp_Process *p,
if (XFIXNUM (tem) != 1)
error ("Stopbits cannot be configured");
#endif
childp2 = Fplist_put (childp2, QCstopbits, tem);
childp2 = plist_put (childp2, QCstopbits, tem);
/* Configure flowcontrol. */
if (!NILP (Fplist_member (contact, QCflowcontrol)))
tem = Fplist_get (contact, QCflowcontrol);
if (!NILP (plist_member (contact, QCflowcontrol)))
tem = plist_get (contact, QCflowcontrol);
else
tem = Fplist_get (p->childp, QCflowcontrol);
tem = plist_get (p->childp, QCflowcontrol);
if (!NILP (tem) && !EQ (tem, Qhw) && !EQ (tem, Qsw))
error (":flowcontrol must be nil (no flowcontrol), `hw', or `sw'");
#if defined (CRTSCTS)
@ -3063,14 +3063,14 @@ serial_configure (struct Lisp_Process *p,
error ("Software flowcontrol (XON/XOFF) not supported");
#endif
}
childp2 = Fplist_put (childp2, QCflowcontrol, tem);
childp2 = plist_put (childp2, QCflowcontrol, tem);
/* Activate configuration. */
err = tcsetattr (p->outfd, TCSANOW, &attr);
if (err != 0)
report_file_error ("Failed tcsetattr", Qnil);
childp2 = Fplist_put (childp2, QCsummary, build_string (summary));
childp2 = plist_put (childp2, QCsummary, build_string (summary));
pset_childp (p, childp2);
}
#endif /* not DOS_NT */