all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: Anmol Khirbat <anmol@khirbat.net>
Cc: 11008@debbugs.gnu.org
Subject: bug#11008: 24.0.94; ido-mode: Setting ido-completion-buffer to nil is broken
Date: Wed, 14 Mar 2012 00:56:07 +0800	[thread overview]
Message-ID: <m1obs0fniw.fsf@gmail.com> (raw)
In-Reply-To: <m2ehsxdjas.fsf@morpheus.lan> (Anmol Khirbat's message of "Tue, 13 Mar 2012 00:58:03 -0700")

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







  reply	other threads:[~2012-03-13 16:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-03-14 10:32   ` Leo
2012-03-21 16:41 ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1obs0fniw.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=11008@debbugs.gnu.org \
    --cc=anmol@khirbat.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.