From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?Q?Llu=C3=ADs?= Newsgroups: gmane.emacs.devel Subject: Vital information in the minibuffer is hidden by "idle" helpers Date: Mon, 24 Jan 2011 15:22:21 +0100 Message-ID: <8762tev0te.fsf@ginnungagap.bsc.es> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1295879129 13197 80.91.229.12 (24 Jan 2011 14:25:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 24 Jan 2011 14:25:29 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 24 15:25:25 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PhNMC-0002Gd-DV for ged-emacs-devel@m.gmane.org; Mon, 24 Jan 2011 15:25:24 +0100 Original-Received: from localhost ([127.0.0.1]:41288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhNMB-0006Xy-Eo for ged-emacs-devel@m.gmane.org; Mon, 24 Jan 2011 09:25:23 -0500 Original-Received: from [140.186.70.92] (port=56502 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhNJd-0004jl-Ts for emacs-devel@gnu.org; Mon, 24 Jan 2011 09:22:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhNJa-0007qi-Rc for emacs-devel@gnu.org; Mon, 24 Jan 2011 09:22:44 -0500 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:46259) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PhNJa-0007qP-F8 for emacs-devel@gnu.org; Mon, 24 Jan 2011 09:22:42 -0500 Original-Received: (qmail invoked by alias); 24 Jan 2011 14:22:40 -0000 Original-Received: from unknown (EHLO localhost) [84.88.53.92] by mail.gmx.net (mp030) with SMTP; 24 Jan 2011 15:22:40 +0100 X-Authenticated: #12333383 X-Provags-ID: V01U2FsdGVkX18u1NArz9AubPbjQL8qssbXha/DRPX0C7sVzel9gZ 4g6h2s//CxmgGQ User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:134890 Archived-At: 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