This function returns a list of the strings that were read,
with empty strings removed."
- (let ((crm-current-separator
- (if (consp crm-separator)
- (car crm-separator)
- crm-separator))
- (crm-canonical-separator (cdr-safe crm-separator)))
- (split-string
- (minibuffer-with-setup-hook
- #'completing-read-multiple-mode
- (completing-read prompt (apply-partially #'crm--table table)
- predicate require-match initial-input hist def inherit-input-method))
- crm-current-separator t)))
+ (let* ((crm-current-separator
+ (if (consp crm-separator)
+ (car crm-separator)
+ crm-separator))
+ (crm-canonical-separator (cdr-safe crm-separator))
+ (string (minibuffer-with-setup-hook
+ #'completing-read-multiple-mode
+ (completing-read prompt (apply-partially #'crm--table table)
+ predicate require-match initial-input hist
+ def inherit-input-method)))
+ (results (split-string string crm-current-separator t)))
+ (when-let ((hist-var (and hist (not (eq hist t))
+ (if (consp hist) (car hist) hist)))
+ (hist-list (symbol-value hist)))
+ (when (string= (car hist-list) string) (pop (symbol-value hist)))
+ (dolist (res results) (add-to-history hist-var res)))
+ results))
(provide 'crm)