From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Start value in minibuffer [Was: opening /tmp//foo doesn't work.] Date: Sun, 13 Nov 2005 14:36:03 -0800 Message-ID: References: <4377B512.3050303@soem.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1131922295 17619 80.91.229.2 (13 Nov 2005 22:51:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 13 Nov 2005 22:51:35 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 13 23:51:33 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EbQSt-0002FJ-JH for ged-emacs-devel@m.gmane.org; Sun, 13 Nov 2005 23:36:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EbQSq-0004ub-GV for ged-emacs-devel@m.gmane.org; Sun, 13 Nov 2005 17:36:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EbQSV-0004tx-Tw for emacs-devel@gnu.org; Sun, 13 Nov 2005 17:36:24 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EbQSU-0004tN-C1 for emacs-devel@gnu.org; Sun, 13 Nov 2005 17:36:23 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EbQSU-0004t9-2X for emacs-devel@gnu.org; Sun, 13 Nov 2005 17:36:22 -0500 Original-Received: from [148.87.122.30] (helo=rgminet01.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EbQSS-00036a-IE for emacs-devel@gnu.org; Sun, 13 Nov 2005 17:36:21 -0500 Original-Received: from rgmsgw300.us.oracle.com (rgmsgw300.us.oracle.com [138.1.186.49]) by rgminet01.oracle.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id jADMaDgZ002222 for ; Sun, 13 Nov 2005 15:36:13 -0700 Original-Received: from rgmsgw300.us.oracle.com (localhost [127.0.0.1]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id jADMaD7M006656 for ; Sun, 13 Nov 2005 15:36:13 -0700 Original-Received: from dradamslap (dhcp-amer-whq-csvpn-gw3-141-144-81-128.vpn.oracle.com [141.144.81.128]) by rgmsgw300.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id jADMaCSN006649 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Sun, 13 Nov 2005 15:36:13 -0700 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <4377B512.3050303@soem.dk> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:45907 Archived-At: 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.