all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Completion: minibuffer.el vs comint.el
@ 2010-11-14 16:44 Андрей Парамонов
  0 siblings, 0 replies; 7+ messages in thread
From: Андрей Парамонов @ 2010-11-14 16:44 UTC (permalink / raw)
  To: emacs-devel; +Cc: martin rudalics

Hello!

I'm investigating possibilities to use Emacs Python IDE. Before I used
Emacs for writing programs in R language, with the help of ESS
package. Both ESS mode and Python mode have helper inferior modes to
interact with interpreter. Also, both have very decent completion.

I've found out that ESS mode completion works via comint.el 's
comint-dynamic-complete, while Python mode (and, in fact, the majority
of modes including Emacs Lisp mode and Semantic) completion works via
minibuffer.el 's completion-at-point. Why bother, may you ask? In
fact, I would never bother about internals and even wouldn't notice
any difference if not subtle, but extremely annoying detail. It's
about how display-buffer acts in presence of *Completions* buffer.

To reproduce:

0) Make sure pop-up-frames is nil (the default).

1) comint.el completion (this required you to press a key in the
middle of program -- it there a way to make this testcase fully
automated?):

(global-set-key [(f12)] '(lambda() (interactive)
			   (progn
			     (if (window-dedicated-p (get-buffer-window "*Completions*"))
				 (message "*Completions* is dedicated")
			       (message "*Completions* is NOT dedicated"))
			     (display-buffer "bar" t))))

(require 'comint)
(let ((foo (get-buffer-create "foo"))
      (bar (get-buffer-create "bar")))
  (switch-to-buffer foo)
  (delete-other-windows)
  (comint-dynamic-list-completions (list "alice" "anastasia" "anna"))
  ;; The following display-buffer call is impossible because we want
  ;; to display-buffer while *Completions* is visible. Press F12.
  ;; (display-buffer bar t)
  )

On pressing F12, you will see buffer "bar" open in place of
*Completions* window. This is the expected thing, actually.

2) minibuffer.el completion:

(let ((foo (get-buffer-create "foo"))
      (bar (get-buffer-create "bar")))
  (switch-to-buffer foo)
  (delete-other-windows)
  (emacs-lisp-mode)
  (insert "(a")
  (completion-at-point)
  (if (window-dedicated-p (get-buffer-window "*Completions*"))
      (message "*Completions* is dedicated")
    (message "*Completions* is NOT dedicated"))
  (display-buffer bar t))

You will see buffer "bar" open in a new frame despite pop-up-frames
being nil (documentation says: if nil, never make a separate frame!).
Also you will see why it happens: *Completions* window is "dedicated".
This is damn annoying!

I have limited experience in elisp so I can't understand why and where
*Completions* buffer becomes dedicated (set-window-dedicated-p is a
built-in function in `C source code' -- is there a way to set a
breakpoint for it?). If it's intentional, is there a reason for it?
comint.el doesn't set "dedicated" flag, and seems to work just fine.

See also debbugs.gnu.org/7368 .

Best wishes,
Andrey Paramonov



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

end of thread, other threads:[~2011-03-29 20:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20101114173358.683A6628353@mail.cs.ucr.edu>
2010-11-15 21:56 ` Completion: minibuffer.el vs comint.el Andrew Helsley
2011-03-28 14:11   ` Stefan Monnier
2011-03-29  9:14     ` martin rudalics
2011-03-29 13:39       ` Stefan Monnier
2011-03-29 15:18         ` martin rudalics
2011-03-29 20:55           ` Stefan Monnier
2010-11-14 16:44 Андрей Парамонов

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.