Function: org-cite-basic--complete-key-dynamic-crm-separator

org-cite-basic--complete-key-dynamic-crm-separator is a byte-compiled function defined in oc-basic.el.gz.

Signature

(org-cite-basic--complete-key-dynamic-crm-separator COMPLETION-CANDIDATES SEPARATOR)

Documentation

Return a repeated version of SEPARATOR as needed.

The number of appeared SEPARATORs in the returned string is sufficient so that none of COMPLETION-CANDIDATES contains it. SEPARATOR should be a literal string.

Source Code

;; Defined in /usr/src/emacs/lisp/org/oc-basic.el.gz
(defun org-cite-basic--complete-key-dynamic-crm-separator
    (completion-candidates separator)
  "Return a repeated version of SEPARATOR as needed.
The number of appeared SEPARATORs in the returned string is sufficient
so that none of COMPLETION-CANDIDATES contains it.  SEPARATOR should be
a literal string."
  (let* ((dyn-sep separator)
         (consecutive-sep-regexp
          (format "%s+" (regexp-opt (list separator)))))
    (with-temp-buffer
      (dolist (cand completion-candidates)
        (when (stringp cand)
          (insert cand "\n")))
      (goto-char (point-min))
      (while (re-search-forward consecutive-sep-regexp nil t)
        (while (<= (length dyn-sep) (length (match-string 0)))
          (setq dyn-sep (concat dyn-sep separator)))))
    dyn-sep))