aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-07-01 01:10:42 +0000
committerRichard M. Stallman2005-07-01 01:10:42 +0000
commit6261856785ec2d796ef66b84cb37fd2a61422c66 (patch)
treead138b6f8e8af5b18f53731f2e740403a2eeaf01
parent01bf52cbaf78f2d92861d4c2cb786bbd63af4525 (diff)
downloademacs-6261856785ec2d796ef66b84cb37fd2a61422c66.tar.gz
emacs-6261856785ec2d796ef66b84cb37fd2a61422c66.zip
(crm-do-completion): Handle minibuffer prompt.
(crm-find-current-element): Likewise.
-rw-r--r--lisp/emacs-lisp/crm.el12
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:
197 respectively, 197 respectively,
198 198
199and return t." 199and return t."
200 (let* ((minibuffer-string (buffer-string)) 200 (let* ((prompt-end (minibuffer-prompt-end))
201 (end-index (or (string-match "," minibuffer-string (1- (point))) 201 (minibuffer-string (buffer-substring prompt-end (point-max)))
202 (1- (point-max)))) 202 (end-index (or (string-match "," minibuffer-string (- (point) prompt-end))
203 (- (point-max) prompt-end)))
203 (target-string (substring minibuffer-string 0 end-index)) 204 (target-string (substring minibuffer-string 0 end-index))
204 (index (or (string-match 205 (index (or (string-match
205 (concat crm-separator "\\([^" crm-separator "]*\\)$") 206 (concat crm-separator "\\([^" crm-separator "]*\\)$")
@@ -215,7 +216,8 @@ and return t."
215 (setq crm-beginning-of-element (match-beginning 1)) 216 (setq crm-beginning-of-element (match-beginning 1))
216 (setq crm-end-of-element end-index) 217 (setq crm-end-of-element end-index)
217 ;; string to the left of the current element 218 ;; string to the left of the current element
218 (setq crm-left-of-element (substring target-string 0 (match-beginning 1))) 219 (setq crm-left-of-element
220 (substring target-string 0 (match-beginning 1)))
219 ;; the current element 221 ;; the current element
220 (setq crm-current-element (match-string 1 target-string)) 222 (setq crm-current-element (match-string 1 target-string))
221 ;; string to the right of the current element 223 ;; string to the right of the current element
@@ -287,7 +289,7 @@ The meanings of the return values are:
287 289
288 (if completedp 290 (if completedp
289 (progn 291 (progn
290 (erase-buffer) 292 (delete-region (minibuffer-prompt-end) (point-max))
291 (insert crm-left-of-element completion) 293 (insert crm-left-of-element completion)
292 ;; (if crm-complete-up-to-point 294 ;; (if crm-complete-up-to-point
293 ;; (insert crm-separator)) 295 ;; (insert crm-separator))