From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jonas Bernoulli Newsgroups: gmane.emacs.devel Subject: Re: Let mode-line packages distinguish the selected-window Date: Mon, 28 Oct 2019 11:32:56 +0100 Message-ID: <87r22xw46f.fsf@bernoul.li> References: <87blu3pqyc.fsf@bernoul.li> <83wocrtxl3.fsf@gnu.org> <9a34b0c1-149b-a850-db88-b9d7cb5c751e@gmx.at> <87tv7triwh.fsf@bernoul.li> <43be954b-fc69-166f-eb51-fcf2c93c6ee1@gmx.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="227659"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: mu4e 1.1.0; emacs 27.0.50 Cc: Eli Zaretskii , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 28 11:33:38 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iP2LB-000x0B-Rv for ged-emacs-devel@m.gmane.org; Mon, 28 Oct 2019 11:33:37 +0100 Original-Received: from localhost ([::1]:52416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP2L5-0008NC-9Z for ged-emacs-devel@m.gmane.org; Mon, 28 Oct 2019 06:33:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39466) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP2Kh-0008Mm-9n for emacs-devel@gnu.org; Mon, 28 Oct 2019 06:33:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP2Kg-0001xw-5u for emacs-devel@gnu.org; Mon, 28 Oct 2019 06:33:07 -0400 Original-Received: from mail.hostpark.net ([212.243.197.30]:34936) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iP2Ke-0001vR-9R; Mon, 28 Oct 2019 06:33:04 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id A65DC168B7; Mon, 28 Oct 2019 11:33:01 +0100 (CET) X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Original-Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10124) with ESMTP id fi9n4OXLQHft; Mon, 28 Oct 2019 11:33:01 +0100 (CET) Original-Received: from p2 (212-51-149-230.fiber7.init7.net [212.51.149.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 261B116109; Mon, 28 Oct 2019 11:33:01 +0100 (CET) In-reply-to: <43be954b-fc69-166f-eb51-fcf2c93c6ee1@gmx.at> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.243.197.30 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:241549 Archived-At: > Running your example in an unmodified Emacs _without_ the hook you > sketched above gets me _two active_ mode-lines here (on a windowing > system that gives focus to a frame when the mouse enters it). Running > it with the hook gets me an active mode-line for the window of the > focussed frame only. I can't tell which of these is more distracting. That's the behavior I see too and I am not sure which I prefer either. It probably would make sense to officially support both variants, add a control an option and make sure it is always respected (i.e. that weird code like what I posted thoes not have an effect). > Accessible only within the evaluation of 'mode-line-format'. That's where its needed, yes. If callable and called in other contexts then the value can be undefined as far as I am concerned. >> Now I am not saying this absolutely has to be done. I am quite happy >> with the above code. But since I noticed this edge-case I though I >> would point it out in case you decide that this is something we cannot >> live with. > > So maybe we should just provide a function called 'mode-line-active-p' > that returns non-nil when the window whose mode-line is just processed > is considered active (whether that decision is right or wrong) and not > talk about the selected window in the first place. That would be perfect for packages such as moody and powerline, but of course the code you posted might be useful in other contexts as well. Thanks! Jonas