Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!oliveb!intelca!mipos3!nate From: nate@mipos3.intel.com (Nate Hess) Newsgroups: comp.emacs Subject: Re: Playing with the minibuffer -- two questions Keywords: minibuffer Message-ID: <2379@mipos3.intel.com> Date: 13 Jun 88 17:07:26 GMT References: <31024@yale-celray.yale.UUCP> Reply-To: nate@mipos3.intel.com (Nate Hess) Organization: Intel Corporation, Santa Clara, CA Lines: 43 In article <31024@yale-celray.yale.UUCP> Ram-Ashwin@cs.yale.edu (Ashwin Ram) writes: >I tried to bind a key to the following function: > > (defun insert-minibuffer-contents () > (interactive) > (insert-buffer (window-buffer (minibuffer-window)))) > >in the hope that hitting the key would cause the current contents of the >minibuffer to be inserted in the current buffer. No luck. I get nothing if I >hit the key. If I execute (insert-minibuffer-contents) in, say, the *scratch* >buffer, I get "Mark set". Any suggestions? EL code to get the current >minibuffer contents as a string, or any other way of getting hold of the >minibuffer message, would be fine too. I got the same results executing the above code from the scratch buffer, so I wrote the following: (defun foobar () (interactive) (set-buffer (window-buffer (minibuffer-window))) (buffer-string)) which, when defun'ed and run from inside the scratch buffer, seems to work pretty much like you wanted it to. Note, however, that there is no way, to my knowledge, to grab the message in the minibuffer area, ie., Quit, Auto-saving...done, etc. What the foobar function above *does* allow you to grab is the contents of the minibuffer if it's already active. For example, if you've typed 'M-x foo' when you execute foobar, you'll get "foo". If you've typed 'C-x C-f', you'll get "/". The "M-x " and the "Find File: " will *not* be included as part of the minibuffer contents. This seems to follow, though, from the fact that if you do 'M-x foo' and then a 'C-a', you'll go to just before the "foo", and not all the way back to before the "M-x". So, the messages don't really seem to be part of the minibuffer. Hope this helps, --woodstock -- "How did you get your mind to tilt like your hat?" ...!{decwrl|hplabs!oliveb|pur-ee|qantel|amd}!intelca!mipos3!nate : nate@mipos3.intel.com ATT : (408) 765-4309