3782 |
;; that can be found before POINT. |
;; that can be found before POINT. |
3783 |
(defun choose-completion-delete-max-match (string) |
(defun choose-completion-delete-max-match (string) |
3784 |
(let ((opoint (point)) |
(let ((opoint (point)) |
3785 |
(len (min (length string) |
len) |
3786 |
(- (point) (point-min))))) |
;; Try moving back by the length of the string. |
3787 |
(goto-char (- (point) (length string))) |
(goto-char (max (- (point) (length string)) |
3788 |
|
(minibuffer-prompt-end))) |
3789 |
|
;; See how far back we were actually able to move. That is the |
3790 |
|
;; upper bound on how much we can match and delete. |
3791 |
|
(setq len (- opoint (point))) |
3792 |
(if completion-ignore-case |
(if completion-ignore-case |
3793 |
(setq string (downcase string))) |
(setq string (downcase string))) |
3794 |
(while (and (> len 0) |
(while (and (> len 0) |
3795 |
(let ((tail (buffer-substring (point) |
(let ((tail (buffer-substring (point) opoint))) |
|
(+ (point) len)))) |
|
3796 |
(if completion-ignore-case |
(if completion-ignore-case |
3797 |
(setq tail (downcase tail))) |
(setq tail (downcase tail))) |
3798 |
(not (string= tail (substring string 0 len))))) |
(not (string= tail (substring string 0 len))))) |