# HG changeset patch # User Richard M. Stallman # Date 1120180242 0 # Node ID e2eed2c9a354d188705c5800354cec5aa8c459cf # Parent 8f05c45301cf1b0139eb70ede113080639f5c9a7 (crm-do-completion): Handle minibuffer prompt. (crm-find-current-element): Likewise. diff -r 8f05c45301cf -r e2eed2c9a354 lisp/emacs-lisp/crm.el --- a/lisp/emacs-lisp/crm.el Thu Jun 30 22:18:27 2005 +0000 +++ b/lisp/emacs-lisp/crm.el Fri Jul 01 01:10:42 2005 +0000 @@ -197,9 +197,10 @@ respectively, and return t." - (let* ((minibuffer-string (buffer-string)) - (end-index (or (string-match "," minibuffer-string (1- (point))) - (1- (point-max)))) + (let* ((prompt-end (minibuffer-prompt-end)) + (minibuffer-string (buffer-substring prompt-end (point-max))) + (end-index (or (string-match "," minibuffer-string (- (point) prompt-end)) + (- (point-max) prompt-end))) (target-string (substring minibuffer-string 0 end-index)) (index (or (string-match (concat crm-separator "\\([^" crm-separator "]*\\)$") @@ -215,7 +216,8 @@ (setq crm-beginning-of-element (match-beginning 1)) (setq crm-end-of-element end-index) ;; string to the left of the current element - (setq crm-left-of-element (substring target-string 0 (match-beginning 1))) + (setq crm-left-of-element + (substring target-string 0 (match-beginning 1))) ;; the current element (setq crm-current-element (match-string 1 target-string)) ;; string to the right of the current element @@ -287,7 +289,7 @@ (if completedp (progn - (erase-buffer) + (delete-region (minibuffer-prompt-end) (point-max)) (insert crm-left-of-element completion) ;; (if crm-complete-up-to-point ;; (insert crm-separator))