Function: verb--override-alist

verb--override-alist is a natively compiled function defined in verb.el.

Signature

(verb--override-alist ORIGINAL OTHER &optional CASE-FOLD)

Documentation

Override alist ORIGINAL with OTHER.

That is, overwrite (KEY . VALUE) pairs present in ORIGINAL with ones present in OTHER if KEYs are equal. Return the results in a new alist. If CASE-FOLD is non-nil, ignore case when comparing KEYs.

Aliases

verb--override-url-queries

Source Code

;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb.el
(defun verb--override-alist (original other &optional case-fold)
  "Override alist ORIGINAL with OTHER.
That is, overwrite (KEY . VALUE) pairs present in ORIGINAL with ones
present in OTHER if KEYs are equal.  Return the results in a new
alist.  If CASE-FOLD is non-nil, ignore case when comparing KEYs."
  (let ((result (nreverse (copy-alist original)))
        (processed))
    (dolist (key-value other)
      (let ((key (car key-value)))
        (when (and (assoc-string key result case-fold)
                   (not (funcall (if case-fold
                                     #'member-ignore-case
                                   #'member)
                                 key processed)))
          ;; key in OTHER is in ORIGINAL, delete all entries using
          ;; this key in ORIGINAL (may be more than one).
          (setq result (cl-delete key result
                                  :key #'car
                                  :test (if case-fold
                                            #'verb-util--string=
                                          #'string=))))
        (push key-value result)
        ;; Remember we deleted this key from ORIGINAL so that we don't
        ;; do it again accidentally (this can happen if OTHER contains
        ;; multiple values mapped to the same key).
        (push key processed)))
    (nreverse result)))