[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Input from buffer instead of minibuffer
From: |
Barry Margolin |
Subject: |
Re: Input from buffer instead of minibuffer |
Date: |
Sun, 30 Sep 2012 21:10:43 -0400 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <58f60ac7-2407-411c-92ba-13a4550f682a@googlegroups.com>,
Michael Haensel <mhaensel73@gmail.com> wrote:
> Hello everyone -
>
> I'm writing a quiz program in Emacs Lisp. The program creates a new frame and
> buffer for the quiz questions. The quiz then runs something like this:
>
> (insert "Please identify: [quiz item]")
> (setq response
> (read-from-minibuffer "Please identify: [quiz item]"))
> ... do stuff based on response
>
> This displays the question in the buffer and the minibuffer. The response is
> read in from the minibuffer. This isn't deal-breakingly bad, but a better
> design would read the response from the buffer and skip the minibuffer
> entirely.
>
> Is there an easy way to read a response from the buffer instead of the
> minibuffer? If it matters, a "response" is a string of 1-8 alphabetic
> characters terminated by a newline/return key.
Nothing built-in, but it should be pretty straightforward to write a
command that looks in the buffer to find the response, and bind the
Return key to this command.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***