Function: choose-completion-guess-base-position
choose-completion-guess-base-position is a byte-compiled function
defined in simple.el.gz.
Signature
(choose-completion-guess-base-position STRING)
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
;; Delete the longest partial match for STRING
;; that can be found before POINT.
(defun choose-completion-guess-base-position (string)
(save-excursion
(let ((opoint (point))
len)
;; Try moving back by the length of the string.
(goto-char (max (- (point) (length string))
(minibuffer-prompt-end)))
;; See how far back we were actually able to move. That is the
;; upper bound on how much we can match and delete.
(setq len (- opoint (point)))
(if completion-ignore-case
(setq string (downcase string)))
(while (and (> len 0)
(let ((tail (buffer-substring (point) opoint)))
(if completion-ignore-case
(setq tail (downcase tail)))
(not (string= tail (substring string 0 len)))))
(setq len (1- len))
(forward-char 1))
(point))))