Function: c-delq-from-dotted-list

c-delq-from-dotted-list is a byte-compiled function defined in cc-engine.el.gz.

Signature

(c-delq-from-dotted-list ELT DLIST)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-engine.el.gz
;;; Basic utility functions.

(defun c-delq-from-dotted-list (elt dlist)
  ;; If ELT is a member of the (possibly dotted) list DLIST, remove all
  ;; occurrences of it (except for any in the last cdr of DLIST).
  ;;
  ;; Call this as (setq DLIST (c-delq-from-dotted-list ELT DLIST)), as
  ;; sometimes the original structure is changed, sometimes it's not.
  ;;
  ;; This function is needed in Emacs < 24.5, and possibly XEmacs, because
  ;; `delq' throws an error in these versions when given a dotted list.
  (let ((tail dlist) prev)
    (while (consp tail)
      (if (eq (car tail) elt)
	  (if prev
	      (setcdr prev (cdr tail))
	    (setq dlist (cdr dlist)))
	(setq prev tail))
      (setq tail (cdr tail)))
    dlist))