From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Start value in minibuffer Date: Mon, 14 Nov 2005 02:55:11 +0200 Organization: JURTA Message-ID: <87r79kxd3k.fsf@jurta.org> References: <87u0egm8xv.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1131930282 3359 80.91.229.2 (14 Nov 2005 01:04:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 14 Nov 2005 01:04:42 +0000 (UTC) Cc: monnier@iro.umontreal.ca, drew.adams@oracle.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 14 02:04:39 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EbSld-0002PH-M6 for ged-emacs-devel@m.gmane.org; Mon, 14 Nov 2005 02:04:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EbSld-0008SA-5D for ged-emacs-devel@m.gmane.org; Sun, 13 Nov 2005 20:04:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EbSkx-00088s-JO for emacs-devel@gnu.org; Sun, 13 Nov 2005 20:03:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EbSkw-00087f-Fm for emacs-devel@gnu.org; Sun, 13 Nov 2005 20:03:34 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EbSkw-00087X-Br for emacs-devel@gnu.org; Sun, 13 Nov 2005 20:03:34 -0500 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EbSkw-0003Af-1w for emacs-devel@gnu.org; Sun, 13 Nov 2005 20:03:34 -0500 Original-Received: from mail.neti.ee (80-235-37-229-dsl.mus.estpak.ee [80.235.37.229]) by Relayhost1.neti.ee (Postfix) with ESMTP id 33EB220D7; Mon, 14 Nov 2005 03:03:44 +0200 (EET) Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: (Kim F. Storm's message of "Mon, 14 Nov 2005 00:48:06 +0100") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee 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:45928 Archived-At: >> BTW, shouldn't pc-selection-mode do that? > > .. and delete-selection-mode and cua-mode as well. There is one essential difference between pc-selection-mode, delete-selection-mode and cua-mode. pc-selection-mode deactivates the mark after point movements. For some time I tried to use the code below with delete-selection-mode. It copies the default value from the prompt to the input area and selects it. But it is inconvenient when after starting to move point to edit the default value, the selection doesn't become deactivated. This is not like other GUI applications (e.g. many GTK applications) work after selecting a field. Perhaps this should be treated specially in delete-selection-mode. ;; Prerequisites: (minibuffer-electric-default-mode 1) ; hide default after copying it (transient-mark-mode 1) (delete-selection-mode 1) (put 'previous-history-element 'delete-selection t) (put 'next-history-element 'delete-selection t) (put 'minibuffer-complete 'delete-selection t) (put 'minibuffer-complete-and-exit 'delete-selection t) (put 'exit-minibuffer 'delete-selection t) (defun minibuffer-setup-default-value () (when (and (= (length (minibuffer-contents-no-properties)) 0) (save-excursion (re-search-backward "\\( (default\\> \\(.*\\))\\):? \\'" nil t))) (push-mark (point) nil t) (insert (match-string-no-properties 2)))) (add-hook 'minibuffer-setup-hook 'minibuffer-setup-default-value) -- Juri Linkov http://www.jurta.org/emacs/