From e00c1b9caea53df8ac242029d4513c24b9b28d7e Mon Sep 17 00:00:00 2001
From: Glenn Morris <rgm@gnu.org>
Date: Sat, 14 Apr 2007 20:23:31 +0000
Subject: [PATCH] (PC-goto-end, PC-do-completion-end): Make buffer-local.

---
 lisp/complete.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/complete.el b/lisp/complete.el
index b93202b2894..b1bb36f9dfa 100644
--- a/lisp/complete.el
+++ b/lisp/complete.el
@@ -190,10 +190,14 @@ If nil, means use the colon-separated path in the variable $INCPATH instead."
 (defvar PC-do-completion-end nil
   "Internal variable used by `PC-do-completion'.")
 
+(make-variable-buffer-local 'PC-do-completion-end)
+
 (defvar PC-goto-end nil
    "Internal variable set in `PC-do-completion', used in
 `choose-completion-string-functions'.")
 
+(make-variable-buffer-local 'PC-goto-end)
+
 ;;;###autoload
 (define-minor-mode partial-completion-mode
   "Toggle Partial Completion mode.
@@ -768,6 +772,8 @@ GOTO-END is non-nil, however, it instead replaces up to END."
                     (let ((prompt-end (minibuffer-prompt-end)))
                       (with-output-to-temp-buffer "*Completions*"
                         (display-completion-list (sort helpposs 'string-lessp))
+                        (setq PC-do-completion-end end
+                              PC-goto-end goto-end)
                         (with-current-buffer standard-output
                           ;; Record which part of the buffer we are completing
                           ;; so that choosing a completion from the list
@@ -786,9 +792,7 @@ GOTO-END is non-nil, however, it instead replaces up to END."
                           ;; plays around with point.
                           (setq completion-base-size (if dirname
                                                          dirlength
-                                                       (- beg prompt-end))
-                                PC-do-completion-end end
-                                PC-goto-end goto-end))))
+                                                       (- beg prompt-end))))))
 		  (PC-temp-minibuffer-message " [Next char not unique]"))
 		nil)))))
 
-- 
2.39.5