]> code.delx.au - gnu-emacs/commitdiff
Handle nil value of ido-completion-buffer.
authorAnmol Khirbat <anmol@khirbat.net>
Wed, 21 Mar 2012 16:41:01 +0000 (00:41 +0800)
committerChong Yidong <cyd@gnu.org>
Wed, 21 Mar 2012 16:41:01 +0000 (00:41 +0800)
* lisp/ido.el (ido-set-current-directory, ido-read-internal)
(ido-choose-completion-string, ido-completion-help): Handle nil
value of ido-completion-buffer.

Fixes: debbugs:11008
lisp/ChangeLog
lisp/ido.el

index 50a9e61bf4c1c083c1c1d5256f5bb9158e33f9cc..1bde1a36d544361ca08858bcaaefbbadc6f6523b 100644 (file)
@@ -1,3 +1,9 @@
+2012-03-21  Anmol Khirbat  <anmol@khirbat.net>  (tiny change)
+
+       * ido.el (ido-set-current-directory, ido-read-internal)
+       (ido-choose-completion-string, ido-completion-help): Handle nil
+       value of ido-completion-buffer (Bug#11008).
+
 2012-03-21  Sam Steingold  <sds@gnu.org>
 
        * window.el (switch-to-prev-buffer): Do not switch to a visible
index 5813aff0f217bb1a28cfe0ea45ab882c499e23e2..dcaa8f373cea02556efedb9a967157220d6de542 100644 (file)
@@ -1722,8 +1722,9 @@ 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)
-      (kill-buffer ido-completion-buffer))
+  (and ido-completion-buffer
+       (get-buffer ido-completion-buffer)
+       (kill-buffer ido-completion-buffer))
   (cond
    ((equal dir ido-current-directory)
     nil)
@@ -1736,8 +1737,9 @@ 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)
-       (kill-buffer ido-completion-buffer))
+    (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 +1984,9 @@ 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)
-         (kill-buffer ido-completion-buffer))
+      (and ido-completion-buffer
+          (get-buffer ido-completion-buffer)
+          (kill-buffer ido-completion-buffer))
 
       (ido-trace "\n_EXIT_" ido-exit)
 
@@ -3837,8 +3840,9 @@ 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)
-       (kill-buffer ido-completion-buffer))
+    (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 +3861,8 @@ 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 +3881,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