[comp.emacs] minibuffer questions

jgk@osc.COM (Joe Keane) (02/06/90)

I have two questions about using read-from-minibuffer in my Emacs Lisp
routines.  First, is there any way to specify where to put the point in the
minibuffer?  It always starts at the end of the default response, which is not
what i want.  Second, is there any way to change the minibuffer prompt,
without actually calling exit-minibuffer and recalling read-from-minibuffer
with the new prompt?  Thanks for any help.

kjones@talos.uu.net (Kyle Jones) (02/07/90)

Joe Keane writes:
 > I have two questions about using read-from-minibuffer in my Emacs
 > Lisp routines.  First, is there any way to specify where to put the
 > point in the minibuffer?  It always starts at the end of the default
 > response, which is not what i want.  Second, is there any way to
 > change the minibuffer prompt, without actually calling
 > exit-minibuffer and recalling read-from-minibuffer with the new
 > prompt?

The answer is "no" to both of these questions, at least conventionally.
At gunpoint I could probably manage to get the minibuffer point adjusted
with vile kludge involving an asynchronous process.  I can't think of
any way to the alter the value of the prompt, though.

jbw@bucsf.bu.edu (Joe Wells) (02/11/90)

In article <1998@osc.COM> jgk@osc.COM (Joe Keane) writes:
   I have two questions about using read-from-minibuffer in my Emacs Lisp
   routines.  First, is there any way to specify where to put the point in
   the minibuffer?  It always starts at the end of the default response,
   which is not what i want.

Try something like this:

(defun minibuffer-adjust-point-kludge ()
  (interactive)
  (goto-char minibuffer-point)
  (define-key minibuffer-local-map "\C-a" nil))

(let ((minibuffer-local-map minibuffer-local-map)
      (unread-command-char ?\C-a)
      (minibuffer-point 5))
  (define-key minibuffer-local-map "\C-a" 'minibuffer-adjust-point-kludge)
  (read-from-minibuffer "Prompt: " "initial contents"))

-- 
Joe Wells <jbw@bu.edu>
jbw%bucsf.bu.edu@bu-it.bu.edu
...!harvard!bu-cs!bucsf!jbw