From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Lars Hansen Newsgroups: gmane.emacs.devel Subject: assq-delete-all patch Date: Wed, 23 Apr 2003 10:29:01 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <3EA64ECD.1060109@math.ku.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1051086608 23318 80.91.224.249 (23 Apr 2003 08:30:08 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Apr 2003 08:30:08 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Apr 23 10:30:03 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 198Fdj-00063X-00 for ; Wed, 23 Apr 2003 10:30:03 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 198FjN-0000O6-00 for ; Wed, 23 Apr 2003 10:35:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 198Fdi-0008U0-08 for emacs-devel@quimby.gnus.org; Wed, 23 Apr 2003 04:30:02 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 198FdF-0008MF-00 for emacs-devel@gnu.org; Wed, 23 Apr 2003 04:29:33 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 198Fd9-0008H1-00 for emacs-devel@gnu.org; Wed, 23 Apr 2003 04:29:28 -0400 Original-Received: from imf.math.ku.dk ([130.225.103.32]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 198Fcm-0007mS-00 for emacs-devel@gnu.org; Wed, 23 Apr 2003 04:29:04 -0400 Original-Received: by imf.math.ku.dk (Postfix on SuSE Linux 7.3 (i386), from userid 73) id B938D8DB76; Wed, 23 Apr 2003 10:29:02 +0200 (MEST) Original-Received: from imf (localhost [127.0.0.1])1AEF98DB0E for ; Wed, 23 Apr 2003 10:29:02 +0200 (MEST) Original-Received: from math.ku.dk (galois.math.ku.dk [130.225.103.19]) D34B78DB0E for ; Wed, 23 Apr 2003 10:29:01 +0200 (MEST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en Original-To: emacs-devel X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13382 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13382 The built-in function assq ignores elements of the list that are not conses. But the function assq-delete-all in subr.el fails. IMHO that is inconsequent. Therefore I suggest this patch: (defun assq-delete-all (key alist) "Delete from ALIST all elements whose car is KEY. ! Return the modified alist." (let ((tail alist)) (while tail ! (if (eq (car (car tail)) key) (setq alist (delq (car tail) alist))) (setq tail (cdr tail))) alist)) --- 2048,2058 ---- (defun assq-delete-all (key alist) "Delete from ALIST all elements whose car is KEY. ! Return the modified alist. ! Elements of ALIST that are not conses are ignored." (let ((tail alist)) (while tail ! (if (and (consp (car tail)) (eq (car (car tail)) key)) (setq alist (delq (car tail) alist))) (setq tail (cdr tail))) alist))