unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Vital information in the minibuffer is hidden by "idle" helpers
@ 2011-01-24 14:22 Lluís
  0 siblings, 0 replies; only message in thread
From: Lluís @ 2011-01-24 14:22 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-24 14:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-24 14:22 Vital information in the minibuffer is hidden by "idle" helpers Lluís

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).