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: Fri, 08 May 2009 12:25:41 +0200 Message-ID: <87ljp728nu.fsf@kfs-lx.rd.rdm> References: <87ljp9l1w4.fsf@thinkpad.tsdh.de> <87prel16ud.fsf@kfs-lx.rd.rdm> <87y6t8vgsy.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 1241778383 24589 80.91.229.12 (8 May 2009 10:26:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 May 2009 10:26:23 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 08 12:26:15 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 1M2NHS-0001cS-2n for ged-emacs-devel@m.gmane.org; Fri, 08 May 2009 12:26:14 +0200 Original-Received: from localhost ([127.0.0.1]:60876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M2NHR-0006wR-3T for ged-emacs-devel@m.gmane.org; Fri, 08 May 2009 06:26:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M2NHG-0006ud-HK for emacs-devel@gnu.org; Fri, 08 May 2009 06:26:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M2NHE-0006sf-G1 for emacs-devel@gnu.org; Fri, 08 May 2009 06:26:01 -0400 Original-Received: from [199.232.76.173] (port=45551 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M2NHE-0006sQ-7e for emacs-devel@gnu.org; Fri, 08 May 2009 06:26:00 -0400 Original-Received: from mail1-hoer.fullrate.dk ([90.185.1.42]:54731 helo=smtp.fullrate.dk) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M2NHC-0006dR-DE for emacs-devel@gnu.org; Fri, 08 May 2009 06:25:59 -0400 Original-Received: from kfs-lx.rd.rdm.cua.dk (unknown [90.184.173.152]) by smtp.fullrate.dk (Postfix) with SMTP id 855D59D69B for ; Fri, 8 May 2009 12:25:42 +0200 (CEST) In-Reply-To: <87y6t8vgsy.fsf@thinkpad.tsdh.de> (Tassilo Horn's message of "Thu, 07 May 2009 21:44:45 +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:110770 Archived-At: Tassilo Horn writes: >> Does this patch give the desired result? > > Basically yes, but I like the standard visual feedback and usage much > better, e.g. no y-or-n-p but a [confirm] after the minibuffer input and > another RET finds the nonexistent file or buffer. This is not > disturbing at all, while the y-or-n-p is: No matter my decision, I > always have to move fingers to either y or n. I see - and agree. Try the following patch instead: *** ido.el.~1.155.~ 2009-01-05 16:30:50.000000000 +0100 --- ido.el 2009-05-08 12:22:33.000000000 +0200 *************** *** 768,774 **** :type '(choice string (const nil)) :group 'ido) ! (defcustom ido-decorations '( "{" "}" " | " " | ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]") "List of strings used by ido to display the alternatives in the minibuffer. There are 10 elements in this list: 1st and 2nd elements are used as brackets around the prospect list, --- 768,774 ---- :type '(choice string (const nil)) :group 'ido) ! (defcustom ido-decorations '( "{" "}" " | " " | ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]") "List of strings used by ido to display the alternatives in the minibuffer. There are 10 elements in this list: 1st and 2nd elements are used as brackets around the prospect list, *************** *** 779,785 **** 7th element is the string displayed when there are no matches, and 8th element is displayed if there is a single match (and faces are not used), 9th element is displayed when the current directory is non-readable, ! 10th element is displayed when directory exceeds `ido-max-directory-size'." :type '(repeat string) :group 'ido) --- 779,786 ---- 7th element is the string displayed when there are no matches, and 8th element is displayed if there is a single match (and faces are not used), 9th element is displayed when the current directory is non-readable, ! 10th element is displayed when directory exceeds `ido-max-directory-size', ! 11th element is displayed to confirm creating new file or buffer." :type '(repeat string) :group 'ido) *************** *** 1082,1087 **** --- 1083,1091 ---- ;; Non-nil if matching file must be selected. (defvar ido-require-match) + ;; Non-nil if we should add [confirm] to prompt + (defvar ido-show-confirm-message) + ;; Stores a temporary version of the file list being created. (defvar ido-temp-list) *************** *** 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)) --- 1807,1812 ---- *************** *** 1829,1834 **** --- 1829,1835 ---- (ido-case-fold ido-case-fold) (ido-enable-prefix ido-enable-prefix) (ido-enable-regexp ido-enable-regexp) + (ido-show-confirm-message nil) ) (ido-setup-completion-map) *************** *** 2067,2072 **** --- 2068,2074 ---- ;; Handling the require-match must be done in a better way. ((and require-match + (not (memq require-match '(confirm confirm-after-completion))) (not (if ido-directory-too-big (file-exists-p (concat ido-current-directory ido-final-text)) (ido-existing-item-p)))) *************** *** 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 --- 2160,2168 ---- (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) --- 2199,2210 ---- (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 --- 2313,2319 ---- (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 **** --- 2687,2698 ---- "Exit minibuffer, but make sure we have a match if one is needed." (interactive) (if (and (or (not ido-require-match) + (if (memq ido-require-match '(confirm confirm-after-completion)) + (if (or (eq ido-cur-item 'dir) + (eq last-command this-command)) + t + (setq ido-show-confirm-message t) + nil)) (ido-existing-item-p)) (not ido-incomplete-regexp)) (exit-minibuffer))) *************** *** 4398,4403 **** --- 4410,4416 ---- minibuffer-completion-table minibuffer-completion-predicate (not minibuffer-completion-confirm)))) + (setq ido-show-confirm-message nil) (ido-trace "inf" inf) (insert inf)) )))) *************** *** 4430,4435 **** --- 4443,4450 ---- (cond ((null comps) (cond + (ido-show-confirm-message + (or (nth 11 ido-decorations) " [Confirm]")) (ido-directory-nonreadable (or (nth 8 ido-decorations) " [Not readable]")) (ido-directory-too-big -- Kim F. Storm http://www.cua.dk