Subject: bug#12619: completion-at-point and changing buffer

From: Stefan Monnier <[email-masked]>
Date: Wed, 24 Oct 2012 13:48:33 -0400

>> I've just installed a patch which should solve those problems.
>> Can you confirm it fixes your case?
> I'm afraid it doesn't (tested with trunk/110646). The problem is that
> `minibuffer-force-complete' uses `field-beginning' and `field-end',
> neither of which returns a marker. So even if the original function
> uses markers, at this point they are turned into absolute buffer
> positions.
> Wrapping both calls in `copy-marker' fixes the problem for me.

You mean the patch below?
I guess you're right, it's still needed for the use of `start' in:

              (lambda () "Cycle through the possible completions."
                (interactive)
                (let ((completion-extra-properties extra-prop))
                  (completion-in-region start (point) table pred)))))

Can you confirm that this patch fixes it?

        Stefan

=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el	2012-10-24 03:22:21 +0000
+++ lisp/minibuffer.el	2012-10-24 17:47:17 +0000
@@ -1114,7 +1114,7 @@
   ;; FIXME: Need to deal with the extra-size issue here as well.
   ;; FIXME: ~/src/emacs/t<M-TAB>/lisp/minibuffer.el completes to
   ;; ~/src/emacs/trunk/ and throws away lisp/minibuffer.el.
-  (let* ((start (field-beginning))
+  (let* ((start (copy-marker (field-beginning)))
          (end (field-end))
          ;; (md (completion--field-metadata start))
          (all (completion-all-sorted-completions))