[Top][All Lists]

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

Start value in minibuffer [Was: opening /tmp//foo doesn't work.]

From: Lars Hansen
Subject: Start value in minibuffer [Was: opening /tmp//foo doesn't work.]
Date: Sun, 13 Nov 2005 22:50:10 +0100
User-agent: Debian Thunderbird 1.0.2 (X11/20051002)

Chong Yidong wrote:

>The reason is convenience.  This allows you to enter a new filename
>without having to erase the default offered in the minibuffer.  (A
>similar example: /tmp/~/foo goes to ~/foo).  I use this feature all
>the time.
To me this feature seems as a rather awkward work-around the lack of a
general way to handle start values in the minibuffer.

I believe a good handling should allow the user to easily use the start
value in any of these ways:

1. As a default value.
2. As a template.
3. Not at all.

1. If the user just hits return, the start value should be used as a
default value.
2. If something similar to the start value is needed, it should be
possible the edit it. This is convenient in eg. a rename command if the
old name is inserted as the start value.
3. If one don't want to use the start value, it is annoying to have to
delete it. In this case it should possible to simply type what one wants

For those of you that use pc-selection-mode, I believe there is a
natural way to fulfill these requirements. Just try this:

(add-hook 'minibuffer-setup-hook 'select-minibuffer-contents)

(defun select-minibuffer-contents ()
  "Select minibuffer contents."
  (set-mark (point-max))
  (goto-char (minibuffer-prompt-end)))

(defadvice next-history-element (after select-minibuffer-contents activate)
  "Select minibuffer contents."
  (set-mark (point-max))
  (goto-char (minibuffer-prompt-end))
  (setq deactivate-mark nil))

reply via email to

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