all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lluís <xscript@gmx.net>
To: emacs-devel@gnu.org
Subject: Vital information in the minibuffer is hidden by "idle" helpers
Date: Mon, 24 Jan 2011 15:22:21 +0100	[thread overview]
Message-ID: <8762tev0te.fsf@ginnungagap.bsc.es> (raw)

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	other threads:[~2011-01-24 14:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8762tev0te.fsf@ginnungagap.bsc.es \
    --to=xscript@gmx.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.