unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#3274: ido-completing-read doesn't work unless ido-mode is executed
@ 2009-05-13 15:10 Daniel Colascione
  2010-11-28 13:37 ` Leo
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Colascione @ 2009-05-13 15:10 UTC (permalink / raw)
  To: bug-gnu-emacs


ido-completing-read acts very strangely when ido-mode hasn't been run.
It creates a minibuffer with default bindings for RET which doesn't
report to C-g. This stub buffer is very difficult to exit.

Ideally, ido-completing-read would read in ido style regardless of
whether ido-mode is run. At the very least, it should act like
completing-read.

To reproduce, run emacs -Q, then evaluate

(ido-completing-read "test" '("1" "2" "3"))


In GNU Emacs 22.3.1 (i386-redhat-linux-gnu, GTK+ Version 2.14.7)
 of 2009-02-09 on x86-5.fedora.phx.redhat.com
Windowing system distributor `The X.Org Foundation', version 11.0.10503000
configured using `configure  '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-x-toolkit=gtk' 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu' 'target_alias=i386-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: PHP

Minor modes in effect:
  shell-dirtrack-mode: t
  which-function-mode: t
  cua-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  show-paren-mode: t
  savehist-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
c o n t a c t _ e m a i l , SPC <left> M-b M-b M-d 
<delete> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5> 
<double-mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> 
<mouse-5> <down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5> 
<double-down-mouse-5> <double-mouse-5> C-x C-s C-x 
v v S y u c <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
S u c k SPC e m a i l s SPC i n t o SPC p r o d u c 
t i o n SPC s y s t e m SPC ( w h y SPC w a s n ' t 
SPC t h i s SPC d o n e SPC b e f o r e ? ) C-c C-c 
C-x C-f p r <tab> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> p r i <tab> <tab> 
<backspace> <backspace> <backspace> <tab> <tab> <tab> 
w o <tab> <backspace> <backspace> o r d <tab> <tab> 
<tab> . <tab> <backspace> <backspace> <backspace> <backspace> 
s / <tab> <tab> r <backspace> p r <tab> <tab> <tab> 
o r <tab> . <tab> <return> C-s e m a i l C-s C-s <left> 
C-x k M-x g r e C-g C-x C-f <up> <up> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> / o r d <tab> <return> 
C-x k C-x C-f <up> s <return> M-x g r e p <return> 
p <backspace> e m a i l SPC * . p h p <return> <down-mouse-5> 
<mouse-5> <help-echo> <down-mouse-4> <mouse-4> <help-echo> 
<down-mouse-2> <help-echo> <mouse-2> <help-echo> <help-echo> 
C-x 1 C-s e m a i l C-s C-s C-s C-s C-s C-s C-s C-s 
C-s C-s C-s C-s C-s C-s C-s C-s <left> M-x r e p o 
r t - e m <tab> <return>

Recent messages:
Making completion list... [4 times]
Mark saved where search started
Quit
(New file)
Loading dired...done
Loading grep...done
Mark set
Mark saved where search started
Loading emacsbug...done
call-interactively: Text is read-only [2 times]






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#3274: ido-completing-read doesn't work unless ido-mode is executed
  2009-05-13 15:10 bug#3274: ido-completing-read doesn't work unless ido-mode is executed Daniel Colascione
@ 2010-11-28 13:37 ` Leo
  2010-11-28 13:53   ` Leo
  0 siblings, 1 reply; 5+ messages in thread
From: Leo @ 2010-11-28 13:37 UTC (permalink / raw)
  To: 3274; +Cc: Daniel Colascione


I also ran into this bug a while back but didn't stop to fix it.

Could you verify the following patch fixes the bug?

commit 6ca8e9da0d6b61424a4f60073be0d42bd5b23d05
Date:   Sun Nov 28 13:32:44 2010 +0000

    Fix initialization in ido-completing-read

	Modified lisp/ido.el
diff --git a/lisp/ido.el b/lisp/ido.el
index 70d2d98..f1fc323 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -4853,6 +4853,9 @@ DEF, if non-nil, is the default value."
 	(ido-directory-too-big nil)
 	(ido-context-switch-command 'ignore)
 	(ido-choice-list choices))
+    ;; Initialize ido before invoking ido-read-internal
+    (unless (keymapp ido-common-completion-map)
+      (let (ido-mode) (ido-mode 1)))
     (ido-read-internal 'list prompt hist def require-match initial-input)))
 
 (defun ido-unload-function ()






^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#3274: ido-completing-read doesn't work unless ido-mode is executed
  2010-11-28 13:37 ` Leo
@ 2010-11-28 13:53   ` Leo
  2010-11-28 20:50     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Leo @ 2010-11-28 13:53 UTC (permalink / raw)
  To: 3274; +Cc: Daniel Colascione

On 2010-11-28 13:37 +0000, Leo wrote:
> I also ran into this bug a while back but didn't stop to fix it.
>
> Could you verify the following patch fixes the bug?

Please consider this patch instead. While the previous fix is minimal it
does a bit too much by calling (ido-mode 1).

commit eb3f3a514c7ebd2db402ca8c2f3ce7088dd8736a (HEAD, refs/heads/Ferrari)
Date:   Sun Nov 28 13:32:44 2010 +0000

    Fix initialisation in ido-completing-read (#3274)

	Modified lisp/ido.el
diff --git a/lisp/ido.el b/lisp/ido.el
index 70d2d98..2cc10b2 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1490,6 +1490,11 @@ Removes badly formatted data and ignored directories."
   ;; ido kill emacs hook
   (ido-save-history))
 
+(defun ido-common-initilization ()
+  (ido-init-completion-maps)
+  (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup)
+  (add-hook 'choose-completion-string-functions 'ido-choose-completion-string))
+
 (define-minor-mode ido-everywhere
   "Toggle using ido speed-ups everywhere file and directory names are read.
 With ARG, turn ido speed-up on if arg is positive, off otherwise."
@@ -1533,12 +1538,9 @@ This function also adds a hook to the minibuffer."
 	 (t nil)))
 
   (ido-everywhere (if ido-everywhere 1 -1))
-  (when ido-mode
-    (ido-init-completion-maps))
 
   (when ido-mode
-    (add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup)
-    (add-hook 'choose-completion-string-functions 'ido-choose-completion-string)
+    (ido-common-initilization)
     (ido-load-history)
 
     (add-hook 'kill-emacs-hook 'ido-kill-emacs-hook)
@@ -4853,6 +4855,8 @@ DEF, if non-nil, is the default value."
 	(ido-directory-too-big nil)
 	(ido-context-switch-command 'ignore)
 	(ido-choice-list choices))
+    ;; Initialize ido before invoking ido-read-internal
+    (ido-common-initilization)
     (ido-read-internal 'list prompt hist def require-match initial-input)))
 
 (defun ido-unload-function ()






^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#3274: ido-completing-read doesn't work unless ido-mode is executed
  2010-11-28 13:53   ` Leo
@ 2010-11-28 20:50     ` Stefan Monnier
  2010-12-02 23:05       ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2010-11-28 20:50 UTC (permalink / raw)
  To: Leo; +Cc: 3274, Daniel Colascione

>> I also ran into this bug a while back but didn't stop to fix it.
>> Could you verify the following patch fixes the bug?

> --- a/lisp/ido.el
> +++ b/lisp/ido.el
> @@ -4853,6 +4853,9 @@ DEF, if non-nil, is the default value."
>  	(ido-directory-too-big nil)
>  	(ido-context-switch-command 'ignore)
>  	(ido-choice-list choices))
> +    ;; Initialize ido before invoking ido-read-internal
> +    (unless (keymapp ido-common-completion-map)
> +      (let (ido-mode) (ido-mode 1)))
>      (ido-read-internal 'list prompt hist def require-match initial-input)))

"(let (ido-mode) (ido-mode 1))" is an "ugly hack" (not only because it
calls (ido-mode 1) but because of the let-binding).

> Please consider this patch instead. While the previous fix is minimal it
> does a bit too much by calling (ido-mode 1).

Glad you found a better solution.  Your patch looks good.  Savannah is
down right now, so I'll install it later.  Thanks.


        Stefan





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#3274: ido-completing-read doesn't work unless ido-mode is executed
  2010-11-28 20:50     ` Stefan Monnier
@ 2010-12-02 23:05       ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2010-12-02 23:05 UTC (permalink / raw)
  To: Leo; +Cc: Daniel Colascione

>> Please consider this patch instead. While the previous fix is minimal it
>> does a bit too much by calling (ido-mode 1).
> Glad you found a better solution.  Your patch looks good.  Savannah is
> down right now, so I'll install it later.  Thanks.

Should be fixed in emacs-23 now.


        Stefan





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-02 23:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-13 15:10 bug#3274: ido-completing-read doesn't work unless ido-mode is executed Daniel Colascione
2010-11-28 13:37 ` Leo
2010-11-28 13:53   ` Leo
2010-11-28 20:50     ` Stefan Monnier
2010-12-02 23:05       ` Stefan Monnier

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).