diff options
author | Richard M. Stallman <rms@gnu.org> | 2005-07-01 01:10:42 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2005-07-01 01:10:42 +0000 |
commit | 6261856785ec2d796ef66b84cb37fd2a61422c66 (patch) | |
tree | ad138b6f8e8af5b18f53731f2e740403a2eeaf01 /lisp/emacs-lisp | |
parent | 01bf52cbaf78f2d92861d4c2cb786bbd63af4525 (diff) | |
download | emacs-6261856785ec2d796ef66b84cb37fd2a61422c66.tar.gz emacs-6261856785ec2d796ef66b84cb37fd2a61422c66.tar.bz2 emacs-6261856785ec2d796ef66b84cb37fd2a61422c66.zip |
(crm-do-completion): Handle minibuffer prompt.
(crm-find-current-element): Likewise.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/crm.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el index 572c658d0fc..5f54abf4e96 100644 --- a/lisp/emacs-lisp/crm.el +++ b/lisp/emacs-lisp/crm.el @@ -197,9 +197,10 @@ If an element is found, bind: 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 @@ and return t." (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 @@ The meanings of the return values are: (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)) |