From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Let mode-line packages distinguish the selected-window Date: Mon, 28 Oct 2019 10:40:42 +0100 Message-ID: <43be954b-fc69-166f-eb51-fcf2c93c6ee1@gmx.at> References: <87blu3pqyc.fsf@bernoul.li> <83wocrtxl3.fsf@gnu.org> <9a34b0c1-149b-a850-db88-b9d7cb5c751e@gmx.at> <87tv7triwh.fsf@bernoul.li> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="22197"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Jonas Bernoulli Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 28 10:46:00 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 1iP1b5-0005cL-W9 for ged-emacs-devel@m.gmane.org; Mon, 28 Oct 2019 10:46:00 +0100 Original-Received: from localhost ([::1]:52124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP1b4-0004ot-9q for ged-emacs-devel@m.gmane.org; Mon, 28 Oct 2019 05:45:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60918) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iP1WD-0004ob-0i for emacs-devel@gnu.org; Mon, 28 Oct 2019 05:40:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iP1WB-0000S5-R7 for emacs-devel@gnu.org; Mon, 28 Oct 2019 05:40:56 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:50743) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iP1W7-0000QF-Ut; Mon, 28 Oct 2019 05:40:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1572255649; bh=tIaRFXBLXhJ317iEj5EsuS692Wd4Adxdckm4r/sjhQc=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=fhpwe4O3j9rN6Vc8Iv/sQbCusHRyXeIAF6fImvM+oYP7FkOxyX0nO9tN5vY7HA3nA T/S02JjSCOqfNcDiw1ODS/x8Zo4x4aDwa+OyX8WhyCbYyL21z0o9wFfrSpXCR1s0YP 31z2w47eOAyT8gXw/zKKbpu8Pyck2K2tshpJ0LT4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.102] ([212.95.5.242]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MJmGZ-1ijApk06bx-00K7N7; Mon, 28 Oct 2019 10:40:49 +0100 In-Reply-To: <87tv7triwh.fsf@bernoul.li> Content-Language: de-AT X-Provags-ID: V03:K1:o2Qw7yS//HQ20wOinYjl/sh/1U3NfCOFteqcyNff9RI3Quywb3t InYKzmCV/eBp6hhxPQgDj5SBlEQs9pN/WURCFOK5ta7U8IEOtId7QOMX5M/oBGYIMhm2kbj ERXXtjXt4/LPwdFVcJ7jT0moP379PsFtEQnlWighhzV4uUOrv4EKqJCd8miNJAbSAMue+RT 35mRG5xULIuOM62eo0wRw== X-UI-Out-Filterresults: notjunk:1;V03:K0:qij8gkA4OSc=:+679AW5tvgsGM+9t+5O7Ve r/GhXHw0na5GLsUz3XUEOQXwzazoIwRSPceLqDDvYdoYsZIcw6gg+QTX1asRaH7mrjL6875mg +mN90O7uIAtaJr/Ir8PnocDHNtOqut5vHoHrL57J7dqfafKvm4Nibu11I5N+ZAz+klcdUNTCD 19i3/38cXEeOQtd5VSXhXd0l+XeoyWfBIpiKhoCwuonDNH0HLbRkTagliZ5ucCr7n81c6loRc JKegHrL9lDwRgmxk5Nl54s7XTSGcbCvDoSs7BPE2F3OzTboB5vB/USYF0Fr5a5tEEpCvn+2t7 hrrYCq8PqhdSg7Nr/C/wNNI8VFFne9/JFbJ7dFZcMH2I3ROnq6oC1j7L50ogdvwbS3az0dp8n FADbYdNwOkCCqmuDFGqFkaIdzqfy637VBac145eyVcBTOeWJShlFgQEXuki7PRztPZZErHoGZ yQ2l2AbNRdQ2P8Xms69gNMnctM8VFwX99fwhSyPVBOp32poB+9trX9jU/0ho1z8/eYUQEFGOk GgKzySTmxSR7MYR/jM1g9NNDrPHlu4r+v+N7oJCSfBP0xzv4dOkKmqThDZSKWURUiPDKpprcb EFMfwMu0ShJ5qdbcvWmpf6CJgZu8Gb5oRz1lWxUVX1zJ3sJsv8g4LlcKuc/YLsnw9a9zTY4f5 Lg0t9TVGKgkwvfAQeVSCCOp8bcyNQeW94LhXLoJ6zGebfNfNidRs2Xvc+8b8XhfxQFTzV30in Um/Coc8J6B9Hf5G23G5f1w9RaDjMjKqKvIiAfNRWxSU+XAy6AGAu0S86gtaU0EgSzvYUS3j9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.15.18 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:241547 Archived-At: > And here is a weird edge case where doing so is not possible: > > (add-hook 'pre-command-hook (lambda () (force-mode-line-update t))) > > Sure that is weird, but that's not the point. With this hook function > we can observe the following behavior: > > 1. Enter minibuffer. > 2. Switch to another frame. (Without leaving minibuffer first.) > 3. Observe that the window which was the selected window before > (1) now uses mode-line-inactive but your code snippet returns t. 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. > I think the only 100% sure way to be able to answer the first question > is to record that decision at the time when it is made. Emphasize on > both "that decision" (not some closely related one) and "at that time", > i.e. when CURRENT_MODE_LINE_FACE_ID_3 is being called by > display_mode_lines, then that value has to be saved in a way that is > accessible from lisp. Accessible only within the evaluation of 'mode-line-format'. > 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. martin