bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11008: 24.0.94; ido-mode: Setting ido-completion-buffer to nil is br


From: Leo
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (Mac OS X 10.6.8)

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 "\\`/[^/address@hidden'" 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 via email to

[Prev in Thread] Current Thread [Next in Thread]