all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* assq-delete-all patch
@ 2003-04-23  8:29 Lars Hansen
  0 siblings, 0 replies; only message in thread
From: Lars Hansen @ 2003-04-23  8:29 UTC (permalink / raw)


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))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-04-23  8:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-23  8:29 assq-delete-all patch Lars Hansen

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.