From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: IDO doesn't honor confirm-nonexistent-file-or-buffer Date: Thu, 07 May 2009 13:38:02 +0200 Message-ID: <87prel16ud.fsf@kfs-lx.rd.rdm> References: <87ljp9l1w4.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1241696721 20136 80.91.229.12 (7 May 2009 11:45:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 May 2009 11:45:21 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 07 13:45:08 2009 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 1M222E-0005qb-SO for ged-emacs-devel@m.gmane.org; Thu, 07 May 2009 13:45:07 +0200 Original-Received: from localhost ([127.0.0.1]:46979 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M222E-0001Ma-0D for ged-emacs-devel@m.gmane.org; Thu, 07 May 2009 07:45:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M21ve-0007kJ-6i for emacs-devel@gnu.org; Thu, 07 May 2009 07:38:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M21vc-0007jq-BV for emacs-devel@gnu.org; Thu, 07 May 2009 07:38:17 -0400 Original-Received: from [199.232.76.173] (port=47976 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M21vb-0007jj-OS for emacs-devel@gnu.org; Thu, 07 May 2009 07:38:15 -0400 Original-Received: from mail1-hoer.fullrate.dk ([90.185.1.42]:63090 helo=smtp.fullrate.dk) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M21vZ-00075u-HO for emacs-devel@gnu.org; Thu, 07 May 2009 07:38:15 -0400 Original-Received: from kfs-lx.rd.rdm.cua.dk (unknown [90.184.173.152]) by smtp.fullrate.dk (Postfix) with SMTP id D9F109CF15 for ; Thu, 7 May 2009 13:38:02 +0200 (CEST) In-Reply-To: <87ljp9l1w4.fsf@thinkpad.tsdh.de> (Tassilo Horn's message of "Thu, 07 May 2009 11:04:43 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:110749 Archived-At: Tassilo Horn writes: > Hi all, > > I like the new find-file behavior with the default setting of > `confirm-nonexistent-file-or-buffer', because I'm a bad but fast > typist. ;-) > > I use ido-mode, but that doesn't respect this variable and opens a new > file/buffer without any confirmation, even if the last command was a > completion command. It would be great if the ido commands would behave > like the standard find-file and switch-to-buffer commands. > > Bye, > Tassilo > Does this patch give the desired result? *** ido.el.~1.155.~ 2009-01-05 16:30:50.000000000 +0100 --- ido.el 2009-05-07 13:36:09.000000000 +0200 *************** *** 1803,1812 **** DEFAULT if given is the default item to start with. If REQUIRE-MATCH is non-nil, an existing file must be selected. If INITIAL is non-nil, it specifies the initial input string." - ;; Ido does not implement the `confirm' and - ;; `confirm-after-completion' values of REQUIRE-MATCH. - (if (memq require-match '(confirm confirm-after-completion)) - (setq require-match nil)) (let ((ido-cur-item item) (ido-entry-buffer (current-buffer)) --- 1803,1808 ---- *************** *** 2069,2075 **** ((and require-match (not (if ido-directory-too-big (file-exists-p (concat ido-current-directory ido-final-text)) ! (ido-existing-item-p)))) (error "Must specify valid item")) (t --- 2065,2075 ---- ((and require-match (not (if ido-directory-too-big (file-exists-p (concat ido-current-directory ido-final-text)) ! (ido-existing-item-p))) ! (cond ! ((memq require-match '(confirm confirm-after-completion)) ! (not (y-or-n-p (format "Create '%s'? " ido-final-text)))) ! (t t))) (error "Must specify valid item")) (t *************** *** 2158,2164 **** (ido-current-directory nil) (ido-directory-nonreadable nil) (ido-directory-too-big nil) ! (buf (ido-read-internal 'buffer (or prompt "Buffer: ") 'ido-buffer-history default nil initial))) ;; Choose the buffer name: either the text typed in, or the head ;; of the list of matches --- 2158,2166 ---- (ido-current-directory nil) (ido-directory-nonreadable nil) (ido-directory-too-big nil) ! (require-match (confirm-nonexistent-file-or-buffer)) ! (buf (ido-read-internal 'buffer (or prompt "Buffer: ") 'ido-buffer-history default ! require-match initial))) ;; Choose the buffer name: either the text typed in, or the head ;; of the list of matches *************** *** 2195,2204 **** (ido-visit-buffer buf method t))) ;; buffer doesn't exist ! ((eq ido-create-new-buffer 'never) (message "No buffer matching `%s'" buf)) ((and (eq ido-create-new-buffer 'prompt) (not (y-or-n-p (format "No buffer matching `%s', create one? " buf)))) nil) --- 2197,2208 ---- (ido-visit-buffer buf method t))) ;; buffer doesn't exist ! ((and (eq ido-create-new-buffer 'never) ! (null require-match)) (message "No buffer matching `%s'" buf)) ((and (eq ido-create-new-buffer 'prompt) + (null require-match) (not (y-or-n-p (format "No buffer matching `%s', create one? " buf)))) nil) *************** *** 2307,2313 **** (or prompt "Find file: ") 'ido-file-history (and (eq method 'alt-file) buffer-file-name) ! nil initial)))) ;; Choose the file name: either the text typed in, or the head ;; of the list of matches --- 2311,2317 ---- (or prompt "Find file: ") 'ido-file-history (and (eq method 'alt-file) buffer-file-name) ! (confirm-nonexistent-file-or-buffer) initial)))) ;; Choose the file name: either the text typed in, or the head ;; of the list of matches *************** *** 2681,2686 **** --- 2685,2691 ---- "Exit minibuffer, but make sure we have a match if one is needed." (interactive) (if (and (or (not ido-require-match) + (memq ido-require-match '(confirm confirm-after-completion)) (ido-existing-item-p)) (not ido-incomplete-regexp)) (exit-minibuffer))) -- Kim F. Storm http://www.cua.dk