From: Richard M. Stallman Date: Wed, 2 Mar 1994 23:09:40 +0000 (+0000) Subject: (completion-list-mode): Set completion-reference-buffer X-Git-Tag: emacs-19.34~9692 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3819736b9e2b195af5022bcdb3880dac0fdef93c;p=emacs.git (completion-list-mode): Set completion-reference-buffer to the buffer for which the completions were requested. (completion-reference-buffer): New variable. --- diff --git a/lisp/simple.el b/lisp/simple.el index c74141cb1c2..cc847efec64 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2339,6 +2339,9 @@ it were the arg to `interactive' (which see) to interactively read the value." ;; 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 \\\\[mouse-choose-completion] to select @@ -2352,11 +2355,15 @@ a completion with the mouse." (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)