Function: erc-add-entry-to-list

erc-add-entry-to-list is a byte-compiled function defined in erc-match.el.gz.

Signature

(erc-add-entry-to-list LIST PROMPT &optional COMPLETIONS ALT)

Documentation

Add an entry interactively to a list.

LIST must be passed as a symbol The query happens using PROMPT. Completion is performed on the optional alist COMPLETIONS.

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-match.el.gz
;; Functions:

(defun erc-add-entry-to-list (list prompt &optional completions alt)
  "Add an entry interactively to a list.
LIST must be passed as a symbol
The query happens using PROMPT.
Completion is performed on the optional alist COMPLETIONS."
  (let ((entry (completing-read
		prompt
		completions
		(lambda (x)
                  (not (erc-member-ignore-case (car x) (symbol-value list))))))
        quoted)
    (setq quoted (regexp-quote entry))
    (when (pcase erc-match-quote-when-adding
            ('ask (unless (string= quoted entry)
                    (y-or-n-p
                     (format "Use regexp-quoted form (%s) instead? " quoted))))
            ('t (not alt))
            ('nil alt))
      (setq entry quoted))
    (if (erc-member-ignore-case entry (symbol-value list))
	(error "\"%s\" is already on the list" entry)
      (set list (cons entry (symbol-value list))))))