Function: dired--need-confirm-positions

dired--need-confirm-positions is a byte-compiled function defined in dired-aux.el.gz.

Signature

(dired--need-confirm-positions COMMAND STRING)

Documentation

Search for non-isolated matches of STRING in COMMAND.

Return a list of positions that match STRING, but would not be considered "isolated" by dired--star-or-qmark-p.

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
(defun dired--need-confirm-positions (command string)
  "Search for non-isolated matches of STRING in COMMAND.
Return a list of positions that match STRING, but would not be
considered \"isolated\" by `dired--star-or-qmark-p'."
  (cl-assert (= (length string) 1))
  (let ((start 0)
        (isolated-char-positions nil)
        (confirm-positions nil)
        (regexp (regexp-quote string)))
    ;; Collect all ? and * surrounded by spaces and `?`.
    (while (dired--star-or-qmark-p command string nil start)
      (push (cons (match-beginning 2) (match-end 2))
            isolated-char-positions)
      (setq start (match-end 2)))
    ;; Now collect any remaining ? and *.
    (setq start 0)
    (while (string-match regexp command start)
      (unless (cl-member (match-beginning 0) isolated-char-positions
                         :test (lambda (pos match)
                                 (<= (car match) pos (cdr match))))
        (push (match-beginning 0) confirm-positions))
      (setq start (match-end 0)))
    confirm-positions))