* IDO doesn't honor confirm-nonexistent-file-or-buffer @ 2009-05-07 9:04 Tassilo Horn 2009-05-07 11:38 ` Kim F. Storm 0 siblings, 1 reply; 14+ messages in thread From: Tassilo Horn @ 2009-05-07 9:04 UTC (permalink / raw) To: emacs-devel 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 ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-07 9:04 IDO doesn't honor confirm-nonexistent-file-or-buffer Tassilo Horn @ 2009-05-07 11:38 ` Kim F. Storm 2009-05-07 12:42 ` Leo 2009-05-07 19:44 ` Tassilo Horn 0 siblings, 2 replies; 14+ messages in thread From: Kim F. Storm @ 2009-05-07 11:38 UTC (permalink / raw) To: emacs-devel Tassilo Horn <tassilo@member.fsf.org> 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 <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-07 11:38 ` Kim F. Storm @ 2009-05-07 12:42 ` Leo 2009-05-10 21:28 ` Kim F. Storm 2009-05-07 19:44 ` Tassilo Horn 1 sibling, 1 reply; 14+ messages in thread From: Leo @ 2009-05-07 12:42 UTC (permalink / raw) To: emacs-devel On 2009-05-07 12:38 +0100, Kim F. Storm wrote: > Tassilo Horn <tassilo@member.fsf.org> 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? I reported a bug related to this. http://thread.gmane.org/gmane.emacs.devel/107007/focus=107013 Could you see if the fix there is still needed? Thanks. -- .: Leo :. [ sdl.web AT gmail.com ] .: I use Emacs :. www.git-scm.com git - the one true version control system ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-07 12:42 ` Leo @ 2009-05-10 21:28 ` Kim F. Storm 2009-05-11 1:07 ` Leo 2009-05-12 21:22 ` Leo 0 siblings, 2 replies; 14+ messages in thread From: Kim F. Storm @ 2009-05-10 21:28 UTC (permalink / raw) To: Leo; +Cc: emacs-devel Leo <sdl.web@gmail.com> writes: > On 2009-05-07 12:38 +0100, Kim F. Storm wrote: >> Tassilo Horn <tassilo@member.fsf.org> 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? > > I reported a bug related to this. > http://thread.gmane.org/gmane.emacs.devel/107007/focus=107013 > > Could you see if the fix there is still needed? Thank you for the pointer - this is fixed with my new patch. -- Kim F. Storm <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-10 21:28 ` Kim F. Storm @ 2009-05-11 1:07 ` Leo 2009-05-12 21:22 ` Leo 1 sibling, 0 replies; 14+ messages in thread From: Leo @ 2009-05-11 1:07 UTC (permalink / raw) To: emacs-devel On 2009-05-10 22:28 +0100, Kim F. Storm wrote: >> I reported a bug related to this. >> http://thread.gmane.org/gmane.emacs.devel/107007/focus=107013 >> >> Could you see if the fix there is still needed? > > Thank you for the pointer - this is fixed with my new patch. Thanks. -- .: Leo :. [ sdl.web AT gmail.com ] .: I use Emacs :. www.git-scm.com git - the one true version control system ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-10 21:28 ` Kim F. Storm 2009-05-11 1:07 ` Leo @ 2009-05-12 21:22 ` Leo 1 sibling, 0 replies; 14+ messages in thread From: Leo @ 2009-05-12 21:22 UTC (permalink / raw) To: Kim F. Storm; +Cc: emacs-devel Hi Kim, Can you also take a look at bug #1410? http://thread.gmane.org/gmane.emacs.bugs/22581 Do you think that's a bug too? Kind regards, Leo ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-07 11:38 ` Kim F. Storm 2009-05-07 12:42 ` Leo @ 2009-05-07 19:44 ` Tassilo Horn 2009-05-08 10:25 ` Kim F. Storm 1 sibling, 1 reply; 14+ messages in thread From: Tassilo Horn @ 2009-05-07 19:44 UTC (permalink / raw) To: emacs-devel storm@cua.dk (Kim F. Storm) writes: Hi Kim, >> 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. > > 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. Bye, Tassilo ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-07 19:44 ` Tassilo Horn @ 2009-05-08 10:25 ` Kim F. Storm 2009-05-08 10:57 ` Tassilo Horn 0 siblings, 1 reply; 14+ messages in thread From: Kim F. Storm @ 2009-05-08 10:25 UTC (permalink / raw) To: emacs-devel Tassilo Horn <tassilo@member.fsf.org> 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 <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-08 10:25 ` Kim F. Storm @ 2009-05-08 10:57 ` Tassilo Horn 2009-05-08 22:53 ` Kim F. Storm 0 siblings, 1 reply; 14+ messages in thread From: Tassilo Horn @ 2009-05-08 10:57 UTC (permalink / raw) To: emacs-devel storm@cua.dk (Kim F. Storm) writes: Hi Kim, >> 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: Yes, this is much better. But there's one difference with the standard behavior. Ido always wants a confirmation if the file or buffer doesn't exist. The default setting of confirm-nonexistent-file-or-buffer is after-completion, and then you are asked only to confirm if the last command was a completion command. The current ido behavior equivalent to setting this variable to t (which I do anyway). But probably ido should be as compatible with the standard behavior as far as possible. Bye, Tassilo ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-08 10:57 ` Tassilo Horn @ 2009-05-08 22:53 ` Kim F. Storm 2009-05-08 23:16 ` Tassilo Horn 0 siblings, 1 reply; 14+ messages in thread From: Kim F. Storm @ 2009-05-08 22:53 UTC (permalink / raw) To: emacs-devel Tassilo Horn <tassilo@member.fsf.org> writes: > storm@cua.dk (Kim F. Storm) writes: > > Hi Kim, > >>> 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: > > Yes, this is much better. But there's one difference with the standard > behavior. Ido always wants a confirmation if the file or buffer doesn't > exist. The default setting of confirm-nonexistent-file-or-buffer is > after-completion, and then you are asked only to confirm if the last > command was a completion command. The current ido behavior equivalent > to setting this variable to t (which I do anyway). But probably ido > should be as compatible with the standard behavior as far as possible. In a way ido is always trying to complete what you type, so in what ido command/key should after-completion apply to ? E.g. TAB is rarely used in ido (at least I don't use it much). -- Kim F. Storm <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-08 22:53 ` Kim F. Storm @ 2009-05-08 23:16 ` Tassilo Horn 2009-05-09 16:57 ` Kim F. Storm 0 siblings, 1 reply; 14+ messages in thread From: Tassilo Horn @ 2009-05-08 23:16 UTC (permalink / raw) To: emacs-devel storm@cua.dk (Kim F. Storm) writes: Hi Kim, > In a way ido is always trying to complete what you type, so in what > ido command/key should after-completion apply to ? E.g. TAB is rarely > used in ido (at least I don't use it much). I agree. After using the patch for one day I'd say it's fine as it is. Thanks a lot, Tassilo -- The Bible was originally titled "Chuck Norris and Friends" ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-08 23:16 ` Tassilo Horn @ 2009-05-09 16:57 ` Kim F. Storm 2009-05-09 22:28 ` Stefan Monnier 0 siblings, 1 reply; 14+ messages in thread From: Kim F. Storm @ 2009-05-09 16:57 UTC (permalink / raw) To: emacs-devel Tassilo Horn <tassilo@member.fsf.org> writes: > storm@cua.dk (Kim F. Storm) writes: > > Hi Kim, > >> In a way ido is always trying to complete what you type, so in what >> ido command/key should after-completion apply to ? E.g. TAB is rarely >> used in ido (at least I don't use it much). > > I agree. After using the patch for one day I'd say it's fine as it is. > > Thanks a lot, Thanks for testing. Is it ok to install this patch now ? -- Kim F. Storm <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-09 16:57 ` Kim F. Storm @ 2009-05-09 22:28 ` Stefan Monnier 2009-05-10 21:29 ` Kim F. Storm 0 siblings, 1 reply; 14+ messages in thread From: Stefan Monnier @ 2009-05-09 22:28 UTC (permalink / raw) To: Kim F. Storm; +Cc: emacs-devel > Is it ok to install this patch now ? Yes, please, thank you, Stefan ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: IDO doesn't honor confirm-nonexistent-file-or-buffer 2009-05-09 22:28 ` Stefan Monnier @ 2009-05-10 21:29 ` Kim F. Storm 0 siblings, 0 replies; 14+ messages in thread From: Kim F. Storm @ 2009-05-10 21:29 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Is it ok to install this patch now ? > > Yes, please, thank you, Done (with one additional fix). -- Kim F. Storm <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2009-05-12 21:22 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-05-07 9:04 IDO doesn't honor confirm-nonexistent-file-or-buffer Tassilo Horn 2009-05-07 11:38 ` Kim F. Storm 2009-05-07 12:42 ` Leo 2009-05-10 21:28 ` Kim F. Storm 2009-05-11 1:07 ` Leo 2009-05-12 21:22 ` Leo 2009-05-07 19:44 ` Tassilo Horn 2009-05-08 10:25 ` Kim F. Storm 2009-05-08 10:57 ` Tassilo Horn 2009-05-08 22:53 ` Kim F. Storm 2009-05-08 23:16 ` Tassilo Horn 2009-05-09 16:57 ` Kim F. Storm 2009-05-09 22:28 ` Stefan Monnier 2009-05-10 21:29 ` Kim F. Storm
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).