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

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

bug#9639: 24.0.90; Problem with bury-buffer in minibuffer-hide-completio


From: martin rudalics
Subject: bug#9639: 24.0.90; Problem with bury-buffer in minibuffer-hide-completions
Date: Sat, 01 Oct 2011 11:08:09 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

> 1. emacs -Q
> 2. Type `M-x glo TAB' and at the completion "M-x global-" type TAB again,
>    making a *Completions* buffer pop up.
> 3. Type `v TAB', yielding the completion "M-x global-visual-line-mode".
> => The window that had been displaying the *Completions* buffer now
> displays the *Messages* buffer.
>
> AFAICT this is due to the following cond clause in bury-buffer (which is
> called by minibuffer-hide-completions):
>
>      ((not (window-dedicated-p))
>       (switch-to-prev-buffer nil 'bury))

... plus the fact that switching buffers should not delete windows ...

> Only after typing RET in the minibuffer to accept the completion is the
> window that had been displaying the *Completions* buffer and now
> displays the *Messages* buffer deleted; in Emacs 23.2 it is deleted as
> soon as the sole completion is displayed in the minibuffer.  Commenting
> out the above clause restores the 23.2 behavior.  But this presumably
> has bad effects elsewhere.

Presumably `minibuffer-hide-completions' should iconify a standalone
completions frame while deleting a split-off completions window.  So
maybe the following DTRT:

(defun minibuffer-hide-completions ()
  "Get rid of an out-of-date *Completions* buffer."
  ;; FIXME: We could/should use minibuffer-scroll-window here, but it
  ;; can also point to the minibuffer-parent-window, so it's a bit tricky.
  (let* ((window (get-buffer-window "*Completions*" 0))
         (buffer (window-buffer window)))
    (when window
      (let ((deletable (window-deletable-p window)))
        (cond
         ((eq deletable 'frame)
          ;; Iconify frame.
          (iconify-frame (window-frame window))
          (bury-buffer-internal buffer))
         (deletable
          ;; Delete window
          (delete-window window)
          (bury-buffer-internal buffer))
         (t
          ;; Switch to another buffer.
          (switch-to-prev-buffer window 'bury)))))))

> (Interestingly, the C code of bury-buffer prior to the move to Lisp in
> revision 104559 (and long before that) has the equivalent of the above
> clause.)

ISTR that completion windows were dedicated then and typing "v TAB"
would trigger the following code in `minibuffer-completion-help'

      ;; If there are no completions, or if the current input is already the
      ;; only possible completion, then hide (previous&stale) completions.
      (let ((window (and (get-buffer "*Completions*")
                         (get-buffer-window "*Completions*" 0))))
        (when (and (window-live-p window) (window-dedicated-p window))
          (condition-case ()
              (delete-window window)
            (error (iconify-frame (window-frame window))))))

which I can't find anymore.  But I might be wrong.

martin




reply via email to

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