+2008-04-30 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * minibuffer.el (completion--do-completion): Move point even if the
+ completion makes no change.
+ (completion-pcm-try-completion): Fix computation of new point.
+
2008-04-30 David Hansen <david.hansen@gmx.net>
* dired.el: Require 'cl.
;; Insert in minibuffer the chars we got.
(goto-char end)
(insert completion)
- (delete-region beg end)
- (goto-char (+ beg comp-pos)))
+ (delete-region beg end))
+ ;; Move point.
+ (goto-char (+ beg comp-pos))
(if (not (or unchanged completed))
;; The case of the string changed, but that's all. We're not sure
(all (completion-pcm--all-completions pattern table pred)))
(when all
(let* ((mergedpat (completion-pcm--merge-completions all pattern))
- ;; `mergedpat' is in reverse order.
- (pointpat (or (memq 'point mergedpat) (memq 'any mergedpat)))
- ;; New pos from the end.
+ ;; `mergedpat' is in reverse order. Place new point (by
+ ;; order of preference) either at the old point, or at
+ ;; the last place where there's something to choose, or
+ ;; at the very end.
+ (pointpat (or (memq 'point mergedpat) (memq 'any mergedpat)
+ margedpat))
+ ;; New pos from the start.
(newpos (length (completion-pcm--pattern->string pointpat)))
- ;; Do it afterwards because it changes `pointpat' by sideeffect.
+ ;; Do it afterwards because it changes `pointpat' by sideeffect.
(merged (completion-pcm--pattern->string (nreverse mergedpat))))
- (cons merged (- (length merged) newpos))))))
+ (cons merged newpos)))))
(provide 'minibuffer)