GNU bug report logs - #11008
24.0.94; ido-mode: Setting ido-completion-buffer to nil is broken

Previous Next

Package: emacs;

Reported by: Anmol Khirbat <anmol <at> khirbat.net>

Date: Tue, 13 Mar 2012 16:41:02 UTC

Severity: normal

Tags: patch

Found in version 24.0.94

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11008 in the body.
You can then email your comments to 11008 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11008; Package emacs. (Tue, 13 Mar 2012 16:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Anmol Khirbat <anmol <at> khirbat.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 13 Mar 2012 16:41:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Anmol Khirbat <anmol <at> khirbat.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.94; ido-mode: Setting ido-completion-buffer to nil is broken
Date: Tue, 13 Mar 2012 00:58:03 -0700
[Message part 1 (text/plain, inline)]
Hi,

According to the documentation, the variable ido-completion-buffer may
be set to nil to prevent completion buffers from popping up.  However,
if this variable is set to nil, it becomes impossible to switch buffers
or visit files.

Recipe:

1. emacs -Q

2. enable ido
(ido-mode t)
(setq ido-completion-buffer nil)

3. Try to switch buffers or visit a file
C-x b RET (or C-x C-f RET)
The error "Wrong type argument: stringp, nil" flashes in the minibuffer
and nothing happens.

I have included a patch to lisp/ido.el that should fix the problem by
preventing (get-buffer nil) from being called.

Regards,
Anmol

In GNU Emacs 24.0.94.5 (x86_64-apple-darwin11.3.0, NS apple-appkit-1138.32)
of 2012-03-12 on morpheus.lan
Windowing system distributor `Apple', version 10.3.1138
Configured using:
`configure '--with-ns''

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
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

[ido-completion-buffer.patch (text/x-patch, inline)]
diff --git a/lisp/ido.el b/lisp/ido.el
index 5813aff..98afa74 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1722,7 +1722,7 @@ This function also adds a hook to the minibuffer."
     (unless (and ido-enable-tramp-completion
 		 (string-match "\\`/[^/]*@\\'" dir))
       (setq dir (ido-final-slash dir t))))
-  (if (get-buffer ido-completion-buffer)
+  (if (and ido-completion-buffer (get-buffer ido-completion-buffer))
       (kill-buffer ido-completion-buffer))
   (cond
    ((equal dir ido-current-directory)
@@ -1736,7 +1736,7 @@ This function also adds a hook to the minibuffer."
    (t
     (ido-trace "cd" dir)
     (setq ido-current-directory dir)
-    (if (get-buffer ido-completion-buffer)
+    (if (and ido-completion-buffer (get-buffer ido-completion-buffer))
 	(kill-buffer ido-completion-buffer))
     (setq ido-directory-nonreadable (ido-nonreadable-directory-p dir))
     (setq ido-directory-too-big (and (not ido-directory-nonreadable)
@@ -1982,7 +1982,7 @@ If INITIAL is non-nil, it specifies the initial input string."
 					(setq ido-text-init nil))
 				      ido-completion-map nil hist))))
       (ido-trace "read-from-minibuffer" ido-final-text)
-      (if (get-buffer ido-completion-buffer)
+      (if (and ido-completion-buffer (get-buffer ido-completion-buffer))
 	  (kill-buffer ido-completion-buffer))
 
       (ido-trace "\n_EXIT_" ido-exit)
@@ -3837,7 +3837,7 @@ This is to make them appear as if they were \"virtual buffers\"."
 (defun ido-choose-completion-string (choice &rest ignored)
   (when (ido-active)
     ;; Insert the completion into the buffer where completion was requested.
-    (if (get-buffer ido-completion-buffer)
+    (if (and ido-completion-buffer (get-buffer ido-completion-buffer))
 	(kill-buffer ido-completion-buffer))
     (cond
      ((ido-active t) ;; ido-use-merged-list
@@ -3857,7 +3857,7 @@ This is to make them appear as if they were \"virtual buffers\"."
   "Show possible completions in a *File Completions* buffer."
   (interactive)
   (setq ido-rescan nil)
-  (let ((temp-buf (get-buffer ido-completion-buffer))
+  (let ((temp-buf (and ido-completion-buffer (get-buffer ido-completion-buffer)))
 	display-it full-list)
     (if (and (eq last-command this-command) temp-buf)
 	;; scroll buffer
@@ -3876,7 +3876,7 @@ This is to make them appear as if they were \"virtual buffers\"."
 	    (scroll-other-window))
 	  (set-buffer buf))
       (setq display-it t))
-    (if display-it
+    (if (and ido-completion-buffer display-it)
 	(with-output-to-temp-buffer ido-completion-buffer
 	  (let ((completion-list (sort
 				  (cond

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11008; Package emacs. (Tue, 13 Mar 2012 17:27:01 GMT) Full text and rfc822 format available.

Message #8 received at 11008 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Anmol Khirbat <anmol <at> khirbat.net>
Cc: 11008 <at> debbugs.gnu.org
Subject: Re: bug#11008: 24.0.94;
	ido-mode: Setting ido-completion-buffer to nil is broken
Date: Wed, 14 Mar 2012 00:56:07 +0800
Could you try the following patch? Thanks.

=== modified file 'lisp/ido.el'
--- lisp/ido.el	2012-02-04 00:59:58 +0000
+++ lisp/ido.el	2012-03-13 16:47:52 +0000
@@ -1722,8 +1722,8 @@
     (unless (and ido-enable-tramp-completion
 		 (string-match "\\`/[^/]*@\\'" dir))
       (setq dir (ido-final-slash dir t))))
-  (if (get-buffer ido-completion-buffer)
-      (kill-buffer ido-completion-buffer))
+  (when (and ido-completion-buffer (get-buffer ido-completion-buffer))
+    (kill-buffer ido-completion-buffer))
   (cond
    ((equal dir ido-current-directory)
     nil)
@@ -1736,8 +1736,8 @@
    (t
     (ido-trace "cd" dir)
     (setq ido-current-directory dir)
-    (if (get-buffer ido-completion-buffer)
-	(kill-buffer ido-completion-buffer))
+    (when (and ido-completion-buffer (get-buffer ido-completion-buffer))
+      (kill-buffer ido-completion-buffer))
     (setq ido-directory-nonreadable (ido-nonreadable-directory-p dir))
     (setq ido-directory-too-big (and (not ido-directory-nonreadable)
 				     (ido-directory-too-big-p dir)))
@@ -1982,8 +1982,8 @@
 					(setq ido-text-init nil))
 				      ido-completion-map nil hist))))
       (ido-trace "read-from-minibuffer" ido-final-text)
-      (if (get-buffer ido-completion-buffer)
-	  (kill-buffer ido-completion-buffer))
+      (when (and ido-completion-buffer (get-buffer ido-completion-buffer))
+	(kill-buffer ido-completion-buffer))
 
       (ido-trace "\n_EXIT_" ido-exit)
 
@@ -3837,8 +3837,8 @@
 (defun ido-choose-completion-string (choice &rest ignored)
   (when (ido-active)
     ;; Insert the completion into the buffer where completion was requested.
-    (if (get-buffer ido-completion-buffer)
-	(kill-buffer ido-completion-buffer))
+    (when (and ido-completion-buffer (get-buffer ido-completion-buffer))
+      (kill-buffer ido-completion-buffer))
     (cond
      ((ido-active t) ;; ido-use-merged-list
       (setq ido-current-directory ""
@@ -3857,7 +3857,8 @@
   "Show possible completions in a *File Completions* buffer."
   (interactive)
   (setq ido-rescan nil)
-  (let ((temp-buf (get-buffer ido-completion-buffer))
+  (let ((temp-buf (and ido-completion-buffer
+		       (get-buffer ido-completion-buffer)))
 	display-it full-list)
     (if (and (eq last-command this-command) temp-buf)
 	;; scroll buffer
@@ -3876,37 +3877,37 @@
 	    (scroll-other-window))
 	  (set-buffer buf))
       (setq display-it t))
-    (if display-it
-	(with-output-to-temp-buffer ido-completion-buffer
-	  (let ((completion-list (sort
-				  (cond
-				   (ido-directory-too-big
-				    (message "Reading directory...")
-				    (setq ido-directory-too-big nil
-					  ido-ignored-list nil
-					  ido-cur-list (ido-all-completions)
-					  ido-rescan t)
-				    (ido-set-matches)
-				    (or ido-matches ido-cur-list))
-				   (ido-use-merged-list
-				    (ido-flatten-merged-list (or ido-matches ido-cur-list)))
-				   ((or full-list ido-completion-buffer-all-completions)
-				    (ido-all-completions))
-				   (t
-				    (copy-sequence (or ido-matches ido-cur-list))))
-				  #'ido-file-lessp)))
-	    (if (featurep 'xemacs)
-		;; XEmacs extents are put on by default, doesn't seem to be
-		;; any way of switching them off.
-		;; This obscure code avoids a byte compiler warning in Emacs.
-		(let ((f 'display-completion-list))
-		  (funcall f completion-list
-			   :help-string "ido "
-			   :activate-callback
-			   (lambda (x y z) (message "Doesn't work yet, sorry!"))))
-	      ;; else running Emacs
-	      ;;(add-hook 'completion-setup-hook 'completion-setup-function)
-	      (display-completion-list completion-list)))))))
+    (when (and display-it ido-completion-buffer)
+      (with-output-to-temp-buffer ido-completion-buffer
+	(let ((completion-list (sort
+				(cond
+				 (ido-directory-too-big
+				  (message "Reading directory...")
+				  (setq ido-directory-too-big nil
+					ido-ignored-list nil
+					ido-cur-list (ido-all-completions)
+					ido-rescan t)
+				  (ido-set-matches)
+				  (or ido-matches ido-cur-list))
+				 (ido-use-merged-list
+				  (ido-flatten-merged-list (or ido-matches ido-cur-list)))
+				 ((or full-list ido-completion-buffer-all-completions)
+				  (ido-all-completions))
+				 (t
+				  (copy-sequence (or ido-matches ido-cur-list))))
+				#'ido-file-lessp)))
+	  (if (featurep 'xemacs)
+	      ;; XEmacs extents are put on by default, doesn't seem to be
+	      ;; any way of switching them off.
+	      ;; This obscure code avoids a byte compiler warning in Emacs.
+	      (let ((f 'display-completion-list))
+		(funcall f completion-list
+			 :help-string "ido "
+			 :activate-callback
+			 (lambda (x y z) (message "Doesn't work yet, sorry!"))))
+	    ;; else running Emacs
+	    ;;(add-hook 'completion-setup-hook 'completion-setup-function)
+	    (display-completion-list completion-list)))))))
 
 ;;; KILL CURRENT BUFFER
 (defun ido-kill-buffer-at-head ()






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11008; Package emacs. (Wed, 14 Mar 2012 11:04:02 GMT) Full text and rfc822 format available.

Message #11 received at 11008 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Anmol Khirbat <anmol <at> khirbat.net>
Cc: 11008 <at> debbugs.gnu.org
Subject: Re: bug#11008: 24.0.94;
	ido-mode: Setting ido-completion-buffer to nil is broken
Date: Wed, 14 Mar 2012 18:32:54 +0800
On 2012-03-14 00:56 +0800, Leo wrote:
> Could you try the following patch? Thanks.

I usually skip a bug report with lots of boilerplate information and
thus didn't realise you already attached a patch. sorry. BTW, the two
patches are nearly identical.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11008; Package emacs. (Wed, 21 Mar 2012 17:13:02 GMT) Full text and rfc822 format available.

Message #14 received at 11008 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Anmol Khirbat <anmol <at> khirbat.net>
Cc: 11008 <at> debbugs.gnu.org
Subject: Re: bug#11008: 24.0.94;
	ido-mode: Setting ido-completion-buffer to nil is broken
Date: Thu, 22 Mar 2012 00:41:38 +0800
Anmol Khirbat <anmol <at> khirbat.net> writes:

> I have included a patch to lisp/ido.el that should fix the problem by
> preventing (get-buffer nil) from being called.

Committed, thanks.




bug closed, send any further explanations to 11008 <at> debbugs.gnu.org and Anmol Khirbat <anmol <at> khirbat.net> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 21 Mar 2012 17:13:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 19 Apr 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 15 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.