From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: C-x C-b and C-x C-f bugging about confirmation Date: Tue, 25 Nov 2008 13:03:54 +0900 Message-ID: References: <1227274391.618443.2559.nullmailer@null> <1227353165.501338.3377.nullmailer@null> <87bpw6vcm3.fsf@jurta.org> <87abbqmu7u.fsf@catnip.gol.com> <87y6z9k8cj.fsf@cyd.mit.edu> Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1227585906 31467 80.91.229.12 (25 Nov 2008 04:05:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Nov 2008 04:05:06 +0000 (UTC) Cc: Juri Linkov , ams@gnu.org, Stefan Monnier , emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 25 05:06:08 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L4pAu-0006gO-TU for ged-emacs-devel@m.gmane.org; Tue, 25 Nov 2008 05:05:47 +0100 Original-Received: from localhost ([127.0.0.1]:47093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4p9l-0008Gb-Mg for ged-emacs-devel@m.gmane.org; Mon, 24 Nov 2008 23:04:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L4p9g-0008GW-Kf for emacs-devel@gnu.org; Mon, 24 Nov 2008 23:04:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L4p9e-0008FW-4T for emacs-devel@gnu.org; Mon, 24 Nov 2008 23:04:03 -0500 Original-Received: from [199.232.76.173] (port=43172 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4p9d-0008FT-W8 for emacs-devel@gnu.org; Mon, 24 Nov 2008 23:04:02 -0500 Original-Received: from tyo201.gate.nec.co.jp ([202.32.8.193]:45498) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L4p9b-0001lW-Ef; Mon, 24 Nov 2008 23:04:00 -0500 Original-Received: from relay11.aps.necel.com ([10.29.19.46]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id mAP43gBv016020; Tue, 25 Nov 2008 13:03:55 +0900 (JST) Original-Received: from relay21.aps.necel.com ([10.29.19.24] [10.29.19.24]) by relay11.aps.necel.com with ESMTP; Tue, 25 Nov 2008 13:03:55 +0900 Original-Received: from dhapc248.dev.necel.com ([10.114.112.215] [10.114.112.215]) by relay21.aps.necel.com with ESMTP; Tue, 25 Nov 2008 13:03:55 +0900 Original-Received: by dhapc248.dev.necel.com (Postfix, from userid 31295) id EAD62455; Tue, 25 Nov 2008 13:03:54 +0900 (JST) System-Type: i686-pc-linux-gnu Blat: Foop In-Reply-To: <87y6z9k8cj.fsf@cyd.mit.edu> (Chong Yidong's message of "Mon, 24 Nov 2008 00:21:00 -0500") Original-Lines: 42 X-detected-operating-system: by monty-python.gnu.org: Solaris 8 (1) 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:106132 Archived-At: Patch seems to work well. I have a few of my own custom completion commands which I'd like to be treated like`minibuffer-complete' for purposes of confirmation; any objections to the following additional patch? Thanks, -Miles 2008-11-25 Miles Bader * minibuffer.el (minibuffer-confirm-exit-commands): New variable. (minibuffer-complete-and-exit): Use it. --- orig/lisp/minibuffer.el +++ mod/lisp/minibuffer.el @@ -542,6 +542,10 @@ ;; through the previous possible completions. (setq completion-all-sorted-completions (cdr all))))) +(defvar minibuffer-confirm-exit-commands '(minibuffer-complete) + "A list of commands which cause an immediately following +`minibuffer-complete-and-exit' to ask for extra confirmation.") + (defun minibuffer-complete-and-exit () "Exit if the minibuffer contains a valid completion. Otherwise, try to complete the minibuffer contents. If @@ -595,7 +599,7 @@ ((eq minibuffer-completion-confirm 'confirm-after-completion) ;; Similar to the above, but only if trying to exit immediately ;; after typing TAB (this catches most minibuffer typos). - (if (eq last-command 'minibuffer-complete) + (if (memq last-command minibuffer-confirm-exit-commands) (progn (minibuffer-message "Confirm") nil) (exit-minibuffer))) -- Learning, n. The kind of ignorance distinguishing the studious.