Function: erc--remove-from-prop-value-list

erc--remove-from-prop-value-list is a byte-compiled function defined in erc.el.gz.

Signature

(erc--remove-from-prop-value-list FROM TO PROP VAL &optional OBJECT)

Documentation

Remove VAL from text PROP value between FROM and TO.

If current value is VAL itself, remove the property entirely. When VAL is a list, act as if this function were called repeatedly with VAL set to each of VAL's members.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc.el.gz
(defun erc--remove-from-prop-value-list (from to prop val &optional object)
  "Remove VAL from text PROP value between FROM and TO.
If current value is VAL itself, remove the property entirely.
When VAL is a list, act as if this function were called
repeatedly with VAL set to each of VAL's members."
  (let ((old (get-text-property from prop object))
        (pos from)
        (end (next-single-property-change from prop object to))
        new)
    (while (< pos to)
      (when old
        (if (setq new (and (consp old) (if (consp val)
                                           (seq-difference old val)
                                         (remq val old))))
            (put-text-property pos end prop
                               (if (cdr new) new (car new)) object)
          (when (pcase val
                  ((pred consp) (or (consp old) (memq old val)))
                  (_ (if (consp old) (memq val old) (eq old val))))
            (remove-text-properties pos end (list prop nil) object))))
      (setq pos end
            old (get-text-property pos prop object)
            end (next-single-property-change pos prop object to)))))