emacs-devel
[Top][All Lists]
Advanced

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

Vital information in the minibuffer is hidden by "idle" helpers


From: Lluís
Subject: Vital information in the minibuffer is hidden by "idle" helpers
Date: Mon, 24 Jan 2011 15:22:21 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Don't know if the subject is really helpful...

The thing is, many functions like reading user input (e.g., find-file)
use the minibuffer as their interface to the user.

Similarly, code completion frameworks like 'company' use it to show some
brief help of the completion at hand.

But (there's always a but), functions like semantic's idle helpers kick
in while the previous ones are showing vital information to the user,
hiding it as soon as these idle helpers show information in the
minibuffer (like 'semantic-idle-summary-mode').

I've avoided some of this kinds of things using some ad-hoc coding (see
example below), and I was wondering if a more generic approach could be
taken.

An option would be to discard messages to the minibuffer if a function
reading input from the user is being executed, or using some kind of
(with-exclusive-minibuffer BODY...) that would discard minibuffer
messages produced outside that "environment" (don't know if this is the
correct wording).

Or maybe there's a better way to do it implicitly. Disabling messages
outside an input reading function would be one of such implicit
methods, but I think the case of company poses a more complex scenario,
as I don't know if emacs is able to know that company is waiting for
user input beyond typing code into the buffer.

Additionally, disabled messages could be queued and shown later, so that
they're not completely lost.

My current code for semantic+company is:

  (setq my--enable-semantic-idle-summary-idle-function t)
  (make-variable-buffer-local 'my--enable-semantic-idle-summary-idle-function)
  (defadvice semantic-idle-summary-idle-function (around
                                                  
my--semantic-idle-summary-idle-function
                                                  activate compile)
    (when my--enable-semantic-idle-summary-idle-function
      ad-do-it))
  (defun my-set-minibuffer-helpers (state)
    "Temporarily enable/disable helpers that show state in the minibuffer."
    (setq my--enable-semantic-idle-summary-idle-function state))


  (add-hook 'company-completion-started-hook
            '(lambda (manually) (my-set-minibuffer-helpers nil)))
  (add-hook 'company-completion-cancelled-hook
            '(lambda (manually) (my-set-minibuffer-helpers t)))
  (add-hook 'company-completion-finished-hook
            '(lambda (candidate) (my-set-minibuffer-helpers t)))

Note that in the case of semantic-idle-summary + company, just disabling
the former is not (currently) an option as company uses
'semantic-idle-summary-idle-function' (in order to show the brief help),
which seems to work properly only when semantic-idle-summary-mode is
enabled.


Thanks,
        Lluis

--
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth



reply via email to

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