Function: ecomplete-remove

ecomplete-remove is an interactive and byte-compiled function defined in ecomplete.el.gz.

Signature

(ecomplete-remove)

Documentation

Remove from the ecomplete database the entries matching a regexp.

Prompt for the regexp to match the database entries to be removed.

Probably introduced at or before Emacs version 29.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/ecomplete.el.gz
(defun ecomplete-remove ()
  "Remove from the ecomplete database the entries matching a regexp.
Prompt for the regexp to match the database entries to be removed."
  (interactive)
  (let* ((type (ecomplete--prompt-type))
         (data (cdr (assq type ecomplete-database)))
         (match (read-regexp (format "Remove %s keys matching (regexp): "
                                     type)))
         (elems (seq-filter (lambda (elem)
                              (string-match-p match (car elem)))
                            data)))
    (if (length= elems 0)
        (message "No matching entries for %s" match)
      (when (yes-or-no-p (format "Delete %s matching ecomplete %s? "
                                 (length elems)
                                 (if (length= elems 1)
                                     "entry"
                                   "entries")))
        (dolist (elem elems)
          (ecomplete--remove-item type (car elem)))
        (ecomplete-save)
        (message "Deleted entries")))))