all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#11008: 24.0.94; ido-mode: Setting ido-completion-buffer to nil is broken
@ 2012-03-13  7:58 Anmol Khirbat
  2012-03-13 16:56 ` Leo
  2012-03-21 16:41 ` Chong Yidong
  0 siblings, 2 replies; 4+ messages in thread
From: Anmol Khirbat @ 2012-03-13  7:58 UTC (permalink / raw)
  To: 11008

[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix for (setq ido-completion-buffer nil) --]
[-- Type: text/x-patch, Size: 2593 bytes --]

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

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

* bug#11008: 24.0.94; ido-mode: Setting ido-completion-buffer to nil is broken
  2012-03-13  7:58 bug#11008: 24.0.94; ido-mode: Setting ido-completion-buffer to nil is broken Anmol Khirbat
@ 2012-03-13 16:56 ` Leo
  2012-03-14 10:32   ` Leo
  2012-03-21 16:41 ` Chong Yidong
  1 sibling, 1 reply; 4+ messages in thread
From: Leo @ 2012-03-13 16:56 UTC (permalink / raw)
  To: Anmol Khirbat; +Cc: 11008

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







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

* bug#11008: 24.0.94; ido-mode: Setting ido-completion-buffer to nil is broken
  2012-03-13 16:56 ` Leo
@ 2012-03-14 10:32   ` Leo
  0 siblings, 0 replies; 4+ messages in thread
From: Leo @ 2012-03-14 10:32 UTC (permalink / raw)
  To: Anmol Khirbat; +Cc: 11008

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





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

* bug#11008: 24.0.94; ido-mode: Setting ido-completion-buffer to nil is broken
  2012-03-13  7:58 bug#11008: 24.0.94; ido-mode: Setting ido-completion-buffer to nil is broken Anmol Khirbat
  2012-03-13 16:56 ` Leo
@ 2012-03-21 16:41 ` Chong Yidong
  1 sibling, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2012-03-21 16:41 UTC (permalink / raw)
  To: Anmol Khirbat; +Cc: 11008

Anmol Khirbat <anmol@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.





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

end of thread, other threads:[~2012-03-21 16:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-13  7:58 bug#11008: 24.0.94; ido-mode: Setting ido-completion-buffer to nil is broken Anmol Khirbat
2012-03-13 16:56 ` Leo
2012-03-14 10:32   ` Leo
2012-03-21 16:41 ` Chong Yidong

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.