all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: Start value in minibuffer [Was: opening /tmp//foo doesn't work.]
Date: Sun, 13 Nov 2005 14:36:03 -0800	[thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICKEMECOAA.drew.adams@oracle.com> (raw)
In-Reply-To: <4377B512.3050303@soem.dk>

    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 [to] 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
    instead.

    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))

I think you're speaking of reading minibuffer input with a non-nil
INITIAL-INPUT argument (e.g. to `completing-read'), so that that value
appears initially in the minibuffer (for acceptance, deletion, or editing)
as a "start value".

Your code then makes sure this is preselected. If one is in pc-selection
mode (or delete-selection-mode), then typing will replace the selected start
value, and backspace will delete it.

Do I understand you correctly? If so...

It has been decided that the INITIAL-VALUE parameter to minibuffer-input
functions is more or less deprecated, in favor of the DEF (default-value)
parameter alone. The UI model chosen is not to burden the user with a start
value already in the minibuffer, but rather to let him use M-n to pull the
default value into the minibuffer (to serve as start value), if he wants it.

I don't like that decision, personally, but that's the way it is. I like
your approach, and I use something similar in my own library, icicles.el. I
also provide a user option to control whether or not the default value is
also used as a start value - for those who prefer the standard Emacs
approach to "start values":

icicle-use-default-as-init-value-flag:
 Non-nil means to use default value as init value when reading input.
 This is used by `completing-read'.  When the default-value argument is
 non-nil and the initial-input argument is nil or "",  the default
 value is inserted in the minibuffer as the initial input.

 This has the advantage of not requiring you to use `M-n' to retrieve
 the default value.  It has the disadvantage of making you empty the
 minibuffer if you do not want to use or edit the default value.

However, I think this issue is relatively independent of the treatment of //
and /~ in file-name input. I would not get rid of that special treatment,
even when the general behavior you describe is available. That shortcut is
useful at any time, not just with a "start value", and it erases only the
prefix through the slash, not the entire minibuffer content.

  reply	other threads:[~2005-11-13 22:36 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-12 10:47 opening /tmp//foo doesn't work Han Boetes
2005-11-12 14:40 ` Alfred M. Szmidt
2005-11-12 15:15   ` Han Boetes
2005-11-12 15:55     ` Alfred M. Szmidt
2005-11-12 16:11       ` Han Boetes
2005-11-12 16:22         ` Alfred M. Szmidt
2005-11-12 16:38 ` Tomas Zerolo
2005-11-12 17:23   ` Chong Yidong
2005-11-13 21:50     ` Start value in minibuffer [Was: opening /tmp//foo doesn't work.] Lars Hansen
2005-11-13 22:36       ` Drew Adams [this message]
2005-11-13 22:45         ` Lennart Borgman
2005-11-13 22:57           ` Drew Adams
2005-11-13 23:08             ` Lennart Borgman
2005-11-15  5:42             ` Richard M. Stallman
2005-11-14  0:34           ` Miles Bader
2005-11-14  0:43             ` Lennart Borgman
2005-11-13 23:22         ` Start value in minibuffer Stefan Monnier
2005-11-13 23:48           ` Kim F. Storm
2005-11-14  0:55             ` Juri Linkov
2005-11-14  2:35               ` Drew Adams
2005-11-14 10:56                 ` Lars Hansen
2005-11-14 17:36                   ` Drew Adams
2005-11-14  9:40         ` Start value in minibuffer [Was: opening /tmp//foo doesn't work.] Lars Hansen
2005-11-14 12:47       ` Robert J. Chassell
2005-11-14 22:44         ` Lars Hansen
2005-11-14 23:06           ` Robert J. Chassell
2005-11-15 17:06             ` Lars Hansen
2005-11-15 17:33               ` Miles Bader
2005-11-15 17:56                 ` Lars Hansen
2005-11-15 18:39               ` Kevin Rodgers
2005-11-15 18:08           ` Richard M. Stallman
2005-11-12 20:07   ` opening /tmp//foo doesn't work Randal L. Schwartz
2005-11-12 18:11 ` Turning on file-name-shadow-mode by default (was: opening /tmp//foo doesn't work.) Reiner Steib
2005-11-12 20:06   ` Miles Bader
2005-11-12 21:17     ` Luc Teirlinck
2005-11-12 21:38       ` Miles Bader
2005-11-13 21:08       ` Turning on file-name-shadow-mode by default Stefan Monnier
2005-11-13 23:57         ` Luc Teirlinck
2005-11-14 17:48         ` Richard M. Stallman
2005-11-14 23:23           ` Luc Teirlinck
2005-11-15  0:57             ` Juri Linkov
2005-11-15  2:12               ` Luc Teirlinck
2005-11-15  2:19                 ` Juri Linkov
2005-11-15  3:04                   ` Luc Teirlinck
2005-11-15  3:08                   ` Miles Bader
2005-11-15  3:19                     ` Juri Linkov
2005-11-15  3:13                   ` Luc Teirlinck
2005-11-15  3:18                     ` Juri Linkov
2005-11-15  4:13                       ` Luc Teirlinck
2005-11-15  4:43                       ` Luc Teirlinck
2005-11-15 22:57               ` Stefan Monnier
2005-11-15 18:08             ` Richard M. Stallman
2005-11-15 23:02               ` Stefan Monnier
2005-11-13 20:54   ` Turning on file-name-shadow-mode by default (was: opening /tmp//foo doesn't work.) Richard M. Stallman
2005-11-14  0:09     ` Luc Teirlinck
2005-11-16  3:17     ` Luc Teirlinck
2005-11-12 21:21 ` opening /tmp//foo doesn't work Richard M. Stallman
2005-11-12 23:16   ` Drew Adams
2005-11-13  9:28   ` Lars Hansen
2005-11-13 21:05 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DNEMKBNJBGPAOPIJOOICKEMECOAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.