comparison src/fns.c @ 5583:10f179710250

Deprecate #'remassoc, #'remassq, #'remrassoc, #'remrassq. src/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> * fns.c (remassoc_no_quit): * fns.c (remrassq_no_quit): * fns.c (syms_of_fns): * fontcolor-tty.c (Fregister_tty_color): * fontcolor-tty.c (Funregister_tty_color): * fontcolor-tty.c (Ffind_tty_color): * lisp.h: Remove Fremassq, Fremrassq, Fremassoc, Fremrassoc, they're XEmacs-specific functions and Lisp callers should use (delete* ... :key #'car) anyway. Keep the non-Lisp-visible _no_quit versions, calling FdeleteX from C with the appropriate arguments is ungainly. lisp/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> * obsolete.el: * obsolete.el (assq-delete-all): * packages.el (package-provide): * packages.el (package-suppress): * mule/cyrillic.el ("Cyrillic-KOI8"): * mule/cyrillic.el (koi8-u): * mule/general-late.el (posix-charset-to-coding-system-hash): * mule/latin.el: * mule/latin.el (for): * cl-extra.el: * cl-extra.el (cl-extra): * loadup.el (load-history): Change any uses of #'remassq, #'remassoc and friends to calling #'delete* with an appropriate key argument. Provide compatibility implementations, mark them obsolete. man/ChangeLog addition: 2011-10-09 Aidan Kehoe <kehoea@parhasard.net> * lispref/lists.texi (Association Lists): Don't document #'remassoc, #'remassq and friends in detail; they're XEmacs-specific and (delete* ... :key #'car) is preferable.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 09 Oct 2011 12:55:51 +0100
parents 56144c8593a8
children 1a507c4c6c42
comparison
equal deleted inserted replaced
5582:873d7425c1ad 5583:10f179710250
3640 } 3640 }
3641 3641
3642 return sequence; 3642 return sequence;
3643 } 3643 }
3644 3644
3645 DEFUN ("remassoc", Fremassoc, 2, 2, 0, /*
3646 Delete by side effect any elements of ALIST whose car is `equal' to KEY.
3647 The modified ALIST is returned. If the first member of ALIST has a car
3648 that is `equal' to KEY, there is no way to remove it by side effect;
3649 therefore, write `(setq foo (remassoc key foo))' to be sure of changing
3650 the value of `foo'.
3651 */
3652 (key, alist))
3653 {
3654 EXTERNAL_LIST_LOOP_DELETE_IF (elt, alist,
3655 (CONSP (elt) &&
3656 internal_equal (key, XCAR (elt), 0)));
3657 return alist;
3658 }
3659
3660 Lisp_Object 3645 Lisp_Object
3661 remassoc_no_quit (Lisp_Object key, Lisp_Object alist) 3646 remassoc_no_quit (Lisp_Object key, Lisp_Object alist)
3662 { 3647 {
3663 int speccount = specpdl_depth (); 3648 LIST_LOOP_DELETE_IF (elt, alist,
3664 specbind (Qinhibit_quit, Qt); 3649 (CONSP (elt) &&
3665 return unbind_to_1 (speccount, Fremassoc (key, alist)); 3650 internal_equal (key, XCAR (elt), 0)));
3666 }
3667
3668 DEFUN ("remassq", Fremassq, 2, 2, 0, /*
3669 Delete by side effect any elements of ALIST whose car is `eq' to KEY.
3670 The modified ALIST is returned. If the first member of ALIST has a car
3671 that is `eq' to KEY, there is no way to remove it by side effect;
3672 therefore, write `(setq foo (remassq key foo))' to be sure of changing
3673 the value of `foo'.
3674 */
3675 (key, alist))
3676 {
3677 EXTERNAL_LIST_LOOP_DELETE_IF (elt, alist,
3678 (CONSP (elt) &&
3679 EQ_WITH_EBOLA_NOTICE (key, XCAR (elt))));
3680 return alist; 3651 return alist;
3681 } 3652 }
3682 3653
3683 /* no quit, no errors; be careful */ 3654 /* no quit, no errors; be careful */
3684 3655
3686 remassq_no_quit (Lisp_Object key, Lisp_Object alist) 3657 remassq_no_quit (Lisp_Object key, Lisp_Object alist)
3687 { 3658 {
3688 LIST_LOOP_DELETE_IF (elt, alist, 3659 LIST_LOOP_DELETE_IF (elt, alist,
3689 (CONSP (elt) && 3660 (CONSP (elt) &&
3690 EQ_WITH_EBOLA_NOTICE (key, XCAR (elt)))); 3661 EQ_WITH_EBOLA_NOTICE (key, XCAR (elt))));
3691 return alist;
3692 }
3693
3694 DEFUN ("remrassoc", Fremrassoc, 2, 2, 0, /*
3695 Delete by side effect any elements of ALIST whose cdr is `equal' to VALUE.
3696 The modified ALIST is returned. If the first member of ALIST has a car
3697 that is `equal' to VALUE, there is no way to remove it by side effect;
3698 therefore, write `(setq foo (remrassoc value foo))' to be sure of changing
3699 the value of `foo'.
3700 */
3701 (value, alist))
3702 {
3703 EXTERNAL_LIST_LOOP_DELETE_IF (elt, alist,
3704 (CONSP (elt) &&
3705 internal_equal (value, XCDR (elt), 0)));
3706 return alist;
3707 }
3708
3709 DEFUN ("remrassq", Fremrassq, 2, 2, 0, /*
3710 Delete by side effect any elements of ALIST whose cdr is `eq' to VALUE.
3711 The modified ALIST is returned. If the first member of ALIST has a car
3712 that is `eq' to VALUE, there is no way to remove it by side effect;
3713 therefore, write `(setq foo (remrassq value foo))' to be sure of changing
3714 the value of `foo'.
3715 */
3716 (value, alist))
3717 {
3718 EXTERNAL_LIST_LOOP_DELETE_IF (elt, alist,
3719 (CONSP (elt) &&
3720 EQ_WITH_EBOLA_NOTICE (value, XCDR (elt))));
3721 return alist; 3662 return alist;
3722 } 3663 }
3723 3664
3724 /* Like Fremrassq, fast and unsafe; be careful */ 3665 /* Like Fremrassq, fast and unsafe; be careful */
3725 Lisp_Object 3666 Lisp_Object
11769 DEFSUBR (Fposition); 11710 DEFSUBR (Fposition);
11770 DEFSUBR (Ffind); 11711 DEFSUBR (Ffind);
11771 11712
11772 DEFSUBR (FdeleteX); 11713 DEFSUBR (FdeleteX);
11773 DEFSUBR (FremoveX); 11714 DEFSUBR (FremoveX);
11774 DEFSUBR (Fremassoc);
11775 DEFSUBR (Fremassq);
11776 DEFSUBR (Fremrassoc);
11777 DEFSUBR (Fremrassq);
11778 DEFSUBR (Fdelete_duplicates); 11715 DEFSUBR (Fdelete_duplicates);
11779 DEFSUBR (Fremove_duplicates); 11716 DEFSUBR (Fremove_duplicates);
11780 DEFSUBR (Fnreverse); 11717 DEFSUBR (Fnreverse);
11781 DEFSUBR (Freverse); 11718 DEFSUBR (Freverse);
11782 DEFSUBR (FsortX); 11719 DEFSUBR (FsortX);