changeset 6160:5a40bc311e2f

(completion-list-mode): Set completion-reference-buffer to the buffer for which the completions were requested. (completion-reference-buffer): New variable.
author Richard M. Stallman <rms@gnu.org>
date Wed, 02 Mar 1994 23:09:40 +0000
parents 78275962ef1e
children 4a1c5b2c005d
files lisp/simple.el
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/simple.el	Wed Mar 02 22:51:20 1994 +0000
+++ b/lisp/simple.el	Wed Mar 02 23:09:40 1994 +0000
@@ -2339,6 +2339,9 @@
 ;; Completion mode is suitable only for specially formatted data.
 (put 'completion-list-mode 'mode-class 'special)
 
+;; Record the buffer that was current when the completion list was requested.
+(defvar completion-reference-buffer)
+
 (defun completion-list-mode ()
   "Major mode for buffers showing lists of possible completions.
 Type \\<completion-list-mode-map>\\[mouse-choose-completion] to select
@@ -2352,11 +2355,15 @@
 
 (defun completion-setup-function ()
   (save-excursion
-    (completion-list-mode)
-    (goto-char (point-min))
-    (if window-system
-	(insert (substitute-command-keys
-		 "Click \\[mouse-choose-completion] on a completion to select it.\n\n")))))
+    (let ((mainbuf (current-buffer)))
+      (set-buffer standard-output)
+      (completion-list-mode)
+      (make-local-variable 'completion-reference-buffer)
+      (setq completion-reference-buffer mainbuf)
+      (goto-char (point-min))
+      (if window-system
+	  (insert (substitute-command-keys
+		   "Click \\[mouse-choose-completion] on a completion to select it.\n\n"))))))
 
 (add-hook 'completion-setup-hook 'completion-setup-function)