diff options
| -rw-r--r-- | lisp/simple.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 564aac03541..d1026e6ff6b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3782,14 +3782,17 @@ With prefix argument N, move N items (negative N means move backward)." | |||
| 3782 | ;; that can be found before POINT. | 3782 | ;; that can be found before POINT. |
| 3783 | (defun choose-completion-delete-max-match (string) | 3783 | (defun choose-completion-delete-max-match (string) |
| 3784 | (let ((opoint (point)) | 3784 | (let ((opoint (point)) |
| 3785 | (len (min (length string) | 3785 | len) |
| 3786 | (- (point) (point-min))))) | 3786 | ;; Try moving back by the length of the string. |
| 3787 | (goto-char (- (point) (length string))) | 3787 | (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))) | ||
| 3788 | (if completion-ignore-case | 3792 | (if completion-ignore-case |
| 3789 | (setq string (downcase string))) | 3793 | (setq string (downcase string))) |
| 3790 | (while (and (> len 0) | 3794 | (while (and (> len 0) |
| 3791 | (let ((tail (buffer-substring (point) | 3795 | (let ((tail (buffer-substring (point) opoint))) |
| 3792 | (+ (point) len)))) | ||
| 3793 | (if completion-ignore-case | 3796 | (if completion-ignore-case |
| 3794 | (setq tail (downcase tail))) | 3797 | (setq tail (downcase tail))) |
| 3795 | (not (string= tail (substring string 0 len))))) | 3798 | (not (string= tail (substring string 0 len))))) |