help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Selecting default prompt text


From: Drew Adams
Subject: RE: Selecting default prompt text
Date: Thu, 12 Feb 2009 09:34:11 -0800

> > Something like this ?
> >
> > (defun minibuffer-select-inital-input ()
> >   (let ((start (next-single-char-property-change 1 'read-only)))
> >     (when (< start (point-max))
> >       (set-mark start) (setq mark-active t))))
> >
> > (add-hook 'minibuffer-setup-hook 'minibuffer-select-inital-input)
> > (read-string "> " "Hallo")
> >
> > -ap
> 
> Yes, thanks. But I released I was hoping for too much here since
> region/mark etc works so many different ways depending on settings. As
> "dim" in the #emacs said, probably best to rely on C-a C-k. 
> e.g With my setting hitting right arrow there results in
> "end of buffer" error.

1. I was going to suggest something like what ap said.

That seems to respond to your request, so I'm not sure what you meant above - in
particular about using the right arrow. If point is at the end of the input (end
of buffer), then why would you hit the right arrow? What would you like the
right arrow to do in that context?


2. [You won't like this related answer, but it might help someone else. ;-)]

In Icicles you can elect to always insert the default value as initial text. And
if you do that, you can also elect to automatically select it (as the active
region). And you can choose where to leave the cursor: before or after the
default text (whether or not you choose to auto-select it).

This means that if you use, say, Delete Selection mode, and you choose to
auto-select the default input, then you can just type other text to replace it,
or hit `C-d' or Backspace (DEL) to delete it.

And even if you choose not to auto-select the default text, you can use `M-k'
anytime to clear the minibuffer (easier than `C-a C-k').

http://www.emacswiki.org/emacs/Icicles_-_Customization_and_General_Tips#icicle-d
efault-value






reply via email to

[Prev in Thread] Current Thread [Next in Thread]