From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Let mode-line packages distinguish the selected-window Date: Sat, 26 Oct 2019 17:01:28 +0300 Message-ID: <83wocrtxl3.fsf@gnu.org> References: <87blu3pqyc.fsf@bernoul.li> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="159843"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Jonas Bernoulli Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 26 16:02:06 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 1iOMdp-000fO8-IW for ged-emacs-devel@m.gmane.org; Sat, 26 Oct 2019 16:02:05 +0200 Original-Received: from localhost ([::1]:40252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOMdn-0001Ab-Mg for ged-emacs-devel@m.gmane.org; Sat, 26 Oct 2019 10:02:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46400) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iOMdc-0000v2-8z for emacs-devel@gnu.org; Sat, 26 Oct 2019 10:01:53 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:41294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iOMdZ-0007jJ-Mn; Sat, 26 Oct 2019 10:01:49 -0400 Original-Received: from [176.228.60.248] (port=2354 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iOMdQ-0004IP-H6; Sat, 26 Oct 2019 10:01:43 -0400 In-reply-to: <87blu3pqyc.fsf@bernoul.li> (message from Jonas Bernoulli on Sat, 26 Oct 2019 15:38:19 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:241460 Archived-At: > From: Jonas Bernoulli > Date: Sat, 26 Oct 2019 15:38:19 +0200 > > It would be nice if Emacs could instead bind a variable that is > accessible from lisp to the window that will be the selected window > again once we are done updating the mode-line of this and other windows. > > This should probably happen in display_mode_lines(). Actually this > function does already save the selected-window in another variable > before it changes the value of this variable, but it only does so for > its own use. > > Lisp_Object old_selected_window = selected_window; > ... > struct window *sel_w = XWINDOW (old_selected_window); > > Later this function decides what face to use like so: > > /* Select mode line face based on the real selected window. */ > display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w), > NILP (window_mode_line_format) > ? BVAR (current_buffer, mode_line_format) > : window_mode_line_format); > > The result of this decision unfortunately also isn't accessible from > lisp. > > In summary, please add a way for functions that format elements of the > mode-line to determine whether these elements are going to be used in > the selected or some other window. Maybe there is a better way to do > that than what I suggested above. Do you have a patch that works for you? If so, could you show it? I understand the general idea, but in the display code the devil is in the details, and this particular place is tricky already. One issue that bothers me is what happens when we are in the minibuffer window. So a working patch, which was tested with the packages you mention, would go a long way towards resolving the issue. Thanks.