From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: E Sabof Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2013 11:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 14604@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.137112397429097 (code B ref -1); Thu, 13 Jun 2013 11:47:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Jun 2013 11:46:14 +0000 Received: from localhost ([127.0.0.1]:40972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Un5yn-0007ZA-0Y for submit@debbugs.gnu.org; Thu, 13 Jun 2013 07:46:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56351) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Un5yk-0007Ye-6l for submit@debbugs.gnu.org; Thu, 13 Jun 2013 07:46:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Un5yc-0007gG-E3 for submit@debbugs.gnu.org; Thu, 13 Jun 2013 07:46:04 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un5yc-0007gC-B6 for submit@debbugs.gnu.org; Thu, 13 Jun 2013 07:46:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un5yZ-0006p5-Ik for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2013 07:46:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Un5yW-0007eT-73 for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2013 07:45:59 -0400 Received: from mail-qe0-f44.google.com ([209.85.128.44]:61449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un5yV-0007eD-8J for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2013 07:45:55 -0400 Received: by mail-qe0-f44.google.com with SMTP id 5so4017811qeb.3 for ; Thu, 13 Jun 2013 04:45:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=/0QL0tiETNUpqwlnF7ipcg0Ph3dXXZWqPgfoQtAtjt4=; b=kSQukGmJOCwsQfmo/4t4FHq3AxTWUPwXlT2MNsDS/6fPzG/6tZ3TQ0rKOaCGFCYaVt 1C0sO39fTEMV/ADaybwR9u0UPGNNDVJ0TRiOcaWKVx4uFyPTUtmJUdah0QWw9GC9J6Eo ms7cBeRrZGfkZDr7i0lhDjDh1UWFgeLsRt8HIbYYAHIVV+MjEW9xyWizHcC2/cOy36zb jm/22F6Qloqa4QGJqVStuna7f9QbvvqnwsvA+qmm9uj3Og4jh0yxMQKEhaYu2wfOT9Xt xYtnJg/GpMyc+uSwtBJ1yo1Bfqv6T+9DKvMT1J04KRi+sF81IYPILLZJAHu5WW6PRum2 Stxg== MIME-Version: 1.0 X-Received: by 10.224.34.198 with SMTP id m6mr2574317qad.39.1371123954451; Thu, 13 Jun 2013 04:45:54 -0700 (PDT) Received: by 10.49.96.226 with HTTP; Thu, 13 Jun 2013 04:45:54 -0700 (PDT) Date: Thu, 13 Jun 2013 12:45:54 +0100 Message-ID: From: E Sabof Content-Type: multipart/alternative; boundary=20cf3074b7b03fa63d04df07acf1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) --20cf3074b7b03fa63d04df07acf1 Content-Type: text/plain; charset=ISO-8859-1 This works on 24.3, but on trunk all windows will be shown as "selected". (setq-default mode-line-format '(:eval (if (eq (frame-selected-window) (selected-window)) "selected" "not-selected"))) I don't know which behavior is correct, but being able to find which is the "really" selected window would be nice. --20cf3074b7b03fa63d04df07acf1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
This works on=A024.3, but on trunk all windows will be s= hown as "selected".

(setq-default=A0
=A0mode-line-format
=A0'(:eval (if (eq (frame-selected-window)
=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0(selected-window))
=A0 =A0 =A0 =A0 =A0 =A0 =A0= "selected"
=A0 =A0 =A0 =A0 =A0 =A0 =A0"not-selecte= d")))

I don't know which behavior is correct, but being a= ble to find which is the "really" selected window would be nice.<= /div>
--20cf3074b7b03fa63d04df07acf1-- From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2013 13:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: E Sabof Cc: 14604@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.137112853012936 (code B ref 14604); Thu, 13 Jun 2013 13:03:02 +0000 Received: (at 14604) by debbugs.gnu.org; 13 Jun 2013 13:02:10 +0000 Received: from localhost ([127.0.0.1]:41047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Un7AG-0003MZ-T9 for submit@debbugs.gnu.org; Thu, 13 Jun 2013 09:02:09 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:49770) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Un7AD-0003Ln-QU for 14604@debbugs.gnu.org; Thu, 13 Jun 2013 09:02:07 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MOC006001D4SH00@a-mtaout22.012.net.il> for 14604@debbugs.gnu.org; Thu, 13 Jun 2013 16:01:52 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MOC005GM1J3WKD0@a-mtaout22.012.net.il>; Thu, 13 Jun 2013 16:01:52 +0300 (IDT) Date: Thu, 13 Jun 2013 16:02:01 +0300 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83ppvqw4dy.fsf@gnu.org> References: X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Thu, 13 Jun 2013 12:45:54 +0100 > From: E Sabof > > > [1:text/plain Hide] > > This works on 24.3, but on trunk all windows will be shown as "selected". > > (setq-default > mode-line-format > '(:eval (if (eq (frame-selected-window) > (selected-window)) > "selected" > "not-selected"))) > > I don't know which behavior is correct, but being able to find which is the > "really" selected window would be nice. When the mode-line format is evaluated, Emacs makes its window the selected window. If it didn't, how could it show values for that window in the mode line? From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: E Sabof Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2013 13:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 14604@debbugs.gnu.org Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.137113124521582 (code B ref 14604); Thu, 13 Jun 2013 13:48:01 +0000 Received: (at 14604) by debbugs.gnu.org; 13 Jun 2013 13:47:25 +0000 Received: from localhost ([127.0.0.1]:41130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Un7s4-0005c1-QU for submit@debbugs.gnu.org; Thu, 13 Jun 2013 09:47:25 -0400 Received: from mail-qa0-f44.google.com ([209.85.216.44]:32791) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Un7s1-0005bi-Rz for 14604@debbugs.gnu.org; Thu, 13 Jun 2013 09:47:22 -0400 Received: by mail-qa0-f44.google.com with SMTP id j8so1073372qah.10 for <14604@debbugs.gnu.org>; Thu, 13 Jun 2013 06:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vPQQhP5fsfGRkKONbaGraLnaVW32Jnyh//S2GhP0NBo=; b=G4yfNKX6s+rjykTpUGfeFzR/j1awF/9mK651rCQ1K/PvsTyKZk37IqSDckR0+RiJqP GBZRmPpn9RiqF0HWxsOsA1u7sqAnLgPET9/KbMOynhduZuoabNwV+M+McNu36kFUQ11h M2v7PGm38b9LJI50tEYHEGdPMKbaQyyNWDIp0V5wkSTGoIKs3bJHPRBVrzL9Nglm2mcA XE98q5HmYdiR0Ezp9Gw89sRQNVh4CQHk0MG9uQz0qHRSgHFl+i7Slu2sBy4KgipX5qWS YjkYu45IsET45rcqfq54nulL3oBTHrgNnbE8h8PjWh4X+E1UNQ1HKsvWHSi1LRjvLsZa 3CHg== MIME-Version: 1.0 X-Received: by 10.49.98.138 with SMTP id ei10mr1499825qeb.3.1371131236037; Thu, 13 Jun 2013 06:47:16 -0700 (PDT) Received: by 10.49.96.226 with HTTP; Thu, 13 Jun 2013 06:47:15 -0700 (PDT) In-Reply-To: <83ppvqw4dy.fsf@gnu.org> References: <83ppvqw4dy.fsf@gnu.org> Date: Thu, 13 Jun 2013 14:47:15 +0100 Message-ID: From: E Sabof Content-Type: multipart/alternative; boundary=047d7bdc832c43b94204df095e48 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --047d7bdc832c43b94204df095e48 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Jun 13, 2013 at 2:02 PM, Eli Zaretskii wrote: > > Date: Thu, 13 Jun 2013 12:45:54 +0100 > > From: E Sabof > > > > > > [1:text/plain Hide] > > > > This works on 24.3, but on trunk all windows will be shown as "selected". > > > > (setq-default > > mode-line-format > > '(:eval (if (eq (frame-selected-window) > > (selected-window)) > > "selected" > > "not-selected"))) > > > > I don't know which behavior is correct, but being able to find which is > the > > "really" selected window would be nice. > > When the mode-line format is evaluated, Emacs makes its window the > selected window. If it didn't, how could it show values for that > window in the mode line? > (frame-selected-window) used to remain bound to the window which the user would consider selected, and only (selected-window) changed. I don't know whether it was a bug, or intentional. If it was a bug, I suppose I could get the desired results with command hooks. --047d7bdc832c43b94204df095e48 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable



On Thu, Jun 13, 2013 at 2:02 PM, Eli Zaretskii &l= t;eliz@gnu.org> wrote:
> Date: Thu, 13 Jun 2013 12:45:54 +0100
> From: E Sabof <esabof@gmail.com>
>
>
> [1:text/plain Hide]
>
> This works on 24.3, but on trunk all windows will be shown as "se= lected".
>
> (setq-default
> =A0mode-line-format
> =A0'(:eval (if (eq (frame-selected-window)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(selected-window))
> =A0 =A0 =A0 =A0 =A0 =A0 =A0"selected"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0"not-selected")))
>
> I don't know which behavior is correct, but being able to find whi= ch is the
> "really" selected window would be nice.

When the mode-line format is evaluated, Emacs makes its window the
selected window. =A0If it didn't, how could it show values for that
window in the mode line?

(frame-selected-win= dow) used to remain bound to the window which the user would consider selec= ted, and only (selected-window) changed. I don't know whether it was a = bug, or intentional.

If it was a= bug, I suppose I could get the desired results with command hooks.


<= /div> --047d7bdc832c43b94204df095e48-- From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2013 14:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: E Sabof Cc: 14604@debbugs.gnu.org Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.137113413729949 (code B ref 14604); Thu, 13 Jun 2013 14:36:02 +0000 Received: (at 14604) by debbugs.gnu.org; 13 Jun 2013 14:35:37 +0000 Received: from localhost ([127.0.0.1]:41507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Un8cj-0007mz-21 for submit@debbugs.gnu.org; Thu, 13 Jun 2013 10:35:37 -0400 Received: from relais.videotron.ca ([24.201.245.36]:43746) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Un8cf-0007mn-9K for 14604@debbugs.gnu.org; Thu, 13 Jun 2013 10:35:34 -0400 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from ceviche.home ([24.201.64.104]) by VL-VM-MR005.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0MOC00C7X5UUIY60@VL-VM-MR005.ip.videotron.ca> for 14604@debbugs.gnu.org; Thu, 13 Jun 2013 10:35:18 -0400 (EDT) Received: by ceviche.home (Postfix, from userid 20848) id 6182D660D7; Thu, 13 Jun 2013 10:35:18 -0400 (EDT) From: Stefan Monnier Message-id: References: Date: Thu, 13 Jun 2013 10:35:18 -0400 In-reply-to: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > This works on 24.3, but on trunk all windows will be shown as "selected". > (setq-default > mode-line-format > '(:eval (if (eq (frame-selected-window) > (selected-window)) > "selected" > "not-selected"))) Indeed this doesn't work any more. This was one of the very few places where (eq (frame-selected-window) (selected-window)) was nil, and this "invariant" is presumed at various places in the C code, so it was a bug. BTW, this worked in Emacs<24.3 if you wanted to highlight every frame's selected-window, but not if you wanted to highlight "the one and only selected-window". For single-frame settings, there's no difference, of course. There is no alternative, yet. We should probably provide some ad-hoc primitives (call them maybe display-selected-window and display-frame-selected-window) which return something like "the window that was selected when we entered redisplay". Stefan From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: E Sabof Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2013 15:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 14604@debbugs.gnu.org Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.13711355611705 (code B ref 14604); Thu, 13 Jun 2013 15:00:03 +0000 Received: (at 14604) by debbugs.gnu.org; 13 Jun 2013 14:59:21 +0000 Received: from localhost ([127.0.0.1]:41559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Un8zg-0000RQ-U7 for submit@debbugs.gnu.org; Thu, 13 Jun 2013 10:59:21 -0400 Received: from mail-qe0-f44.google.com ([209.85.128.44]:33900) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Un8ze-0000R3-Mq for 14604@debbugs.gnu.org; Thu, 13 Jun 2013 10:59:19 -0400 Received: by mail-qe0-f44.google.com with SMTP id 5so4177335qeb.3 for <14604@debbugs.gnu.org>; Thu, 13 Jun 2013 07:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ROIxWVssMEKhf8K1AZ+wWITKUd5kqJdMlxc3BW8cktY=; b=HhsN8xmRWjpIsGCXOw7cC8/Ek0vYSXXoSUnKRyldokwp1Gx/BCX4scxAfeKURF9PQp C3WJ4Rhq2IuI2JrciQJ+vmaBMDLvvHuV4JYItDnLajNTBDcTE36a4Q2gL1sRfPMPsRhK yX3fKa/ypbaSKZHbF13qdnSyTPEPKF4TbB3lHBKxn1HQioakROj3h9PY8JNKLWkaIAUP ybbiSdnPXl+QpHjcykdCpqovOYQO0cHXN18jS/zAd7w9RBLJc1khAkQ1XcWmUFvhhjz3 gSIEqF+OirI9dJHO3s4KC+qfXzH3D+3SF5h6vrDGQPNVwS9UEpy5BECjMB17Q1mZu4Go +5DQ== MIME-Version: 1.0 X-Received: by 10.224.164.205 with SMTP id f13mr3475286qay.16.1371135551874; Thu, 13 Jun 2013 07:59:11 -0700 (PDT) Received: by 10.49.96.226 with HTTP; Thu, 13 Jun 2013 07:59:11 -0700 (PDT) In-Reply-To: References: Date: Thu, 13 Jun 2013 15:59:11 +0100 Message-ID: From: E Sabof Content-Type: multipart/alternative; boundary=089e0158bac2822b4104df0a5fe6 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --089e0158bac2822b4104df0a5fe6 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Jun 13, 2013 at 3:35 PM, Stefan Monnier wrote: > > This works on 24.3, but on trunk all windows will be shown as "selected". > > (setq-default > > mode-line-format > > '(:eval (if (eq (frame-selected-window) > > (selected-window)) > > "selected" > > "not-selected"))) > > Indeed this doesn't work any more. This was one of the very few places > where (eq (frame-selected-window) (selected-window)) was nil, and this > "invariant" is presumed at various places in the C code, so it was > a bug. > > BTW, this worked in Emacs<24.3 if you wanted to highlight every frame's > selected-window, but not if you wanted to highlight "the one and only > selected-window". For single-frame settings, there's no difference, > of course. > > There is no alternative, yet. We should probably provide some ad-hoc > primitives (call them maybe display-selected-window and > display-frame-selected-window) which return something like "the window > that was selected when we entered redisplay". > > > Stefan > FWIW, the below seems to be working, although it still feels like an omission. Evgeni (defvar user-selected-window nil) (defun register-user-location () (setq user-selected-window (selected-window))) (add-hook 'post-command-hook 'register-user-location) (setq-default mode-line-format '(:eval (if (eq user-selected-window (selected-window)) "selected" "not-selected"))) --089e0158bac2822b4104df0a5fe6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable



On Thu, Jun 13, 2013 at 3:35 PM, Stefan Monnier &= lt;monnier@ir= o.umontreal.ca> wrote:
> This works on 24.3, but on trunk al= l windows will be shown as "selected".
> (setq-default
> =A0mode-line-format
> =A0'(:eval (if (eq (frame-selected-window)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(selected-window))
> =A0 =A0 =A0 =A0 =A0 =A0 =A0"selected"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0"not-selected")))

Indeed this doesn't work any more. =A0This was one of the very fe= w places
where (eq (frame-selected-window) (selected-window)) was nil, and this
"invariant" is presumed at various places in the C code, so it wa= s
a bug.

BTW, this worked in Emacs<24.3 if you wanted to highlight every frame= 9;s
selected-window, but not if you wanted to highlight "the one and only<= br> selected-window". =A0For single-frame settings, there's no differe= nce,
of course.

There is no alternative, yet. =A0We should probably provide some ad-hoc
primitives (call them maybe display-selected-window and
display-frame-selected-window) which return something like "the window=
that was selected when we entered redisplay".


=A0 =A0 =A0 =A0 Stefan
=A0
FW= IW, the below seems to be working, although it still feels like an omission= .

Evge= ni

(defvar use= r-selected-window nil)
(defun register-user= -location ()
=A0 (setq user-selected-window= (selected-window)))
(add-hook 'post-command-hook 'register-u= ser-location)

(setq-default
=A0 mode-line-format
=A0 '(:eval (if = (eq=A0user-selected-window=A0(sel= ected-window))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 "select= ed"
=A0 =A0 =A0 =A0 =A0 =A0 =A0 "not-selected")))
<= /div>

--089e0158bac2822b4104df0a5fe6-- From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2013 16:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: E Sabof Cc: 14604@debbugs.gnu.org, monnier@iro.umontreal.ca Reply-To: Eli Zaretskii Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.137113949411569 (code B ref 14604); Thu, 13 Jun 2013 16:05:02 +0000 Received: (at 14604) by debbugs.gnu.org; 13 Jun 2013 16:04:54 +0000 Received: from localhost ([127.0.0.1]:41703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UnA17-00030V-IB for submit@debbugs.gnu.org; Thu, 13 Jun 2013 12:04:54 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]:41474) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UnA14-000304-FA for 14604@debbugs.gnu.org; Thu, 13 Jun 2013 12:04:51 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MOC00L009YPN500@a-mtaout20.012.net.il> for 14604@debbugs.gnu.org; Thu, 13 Jun 2013 19:04:05 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MOC00LLK9YTEL40@a-mtaout20.012.net.il>; Thu, 13 Jun 2013 19:04:05 +0300 (IDT) Date: Thu, 13 Jun 2013 19:04:15 +0300 From: Eli Zaretskii In-reply-to: X-012-Sender: halo1@inter.net.il Message-id: <83ehc6vvy8.fsf@gnu.org> References: X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Thu, 13 Jun 2013 15:59:11 +0100 > From: E Sabof > Cc: 14604@debbugs.gnu.org > > (defvar user-selected-window nil) > (defun register-user-location () > (setq user-selected-window (selected-window))) > (add-hook 'post-command-hook 'register-user-location) > > (setq-default > mode-line-format > '(:eval (if (eq user-selected-window (selected-window)) > "selected" > "not-selected"))) Does this work with mouse-autoselect-window? From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: E Sabof Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2013 16:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 14604@debbugs.gnu.org, Stefan Monnier Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.137114017712983 (code B ref 14604); Thu, 13 Jun 2013 16:17:01 +0000 Received: (at 14604) by debbugs.gnu.org; 13 Jun 2013 16:16:17 +0000 Received: from localhost ([127.0.0.1]:41735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UnAC8-0003NK-Cp for submit@debbugs.gnu.org; Thu, 13 Jun 2013 12:16:16 -0400 Received: from mail-qe0-f43.google.com ([209.85.128.43]:59228) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UnAC2-0003Mh-QP for 14604@debbugs.gnu.org; Thu, 13 Jun 2013 12:16:13 -0400 Received: by mail-qe0-f43.google.com with SMTP id q19so3261851qeb.16 for <14604@debbugs.gnu.org>; Thu, 13 Jun 2013 09:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=24e4qj09njCs+nVwPJdXDZkhvzLJzX659qAxCCJsjV8=; b=boXLWUZaSSb8bHIezkQEABJtzcirEwGGCGpImtWr+D0ALv+p3lX9xeGSbemT11VuAC 2vRRMLJS8gRmVB674rn1i4d9jHwU0bD145L6y5U05kqMrUkD6hTjcWlm3IW7rtDrs1hN fGtjtYVf4cHGJbECyMMUfTJe92UtedlLz635nccV+CjwT+g8QIxqmdgDUhUWmom3zino 2XAPU2ic1N911bn9WtOAHoBnqTST4mZ5U5cfSfBCK7B9Y/yTRBOMJXk2eM3Q253g5+lC 6FyQr4SAzzfii30oU00VUCBpesRfKF3WRok72MC7WGsSGpOoWpD+RAe+g9oQJAO2jPv5 1xJw== MIME-Version: 1.0 X-Received: by 10.229.139.4 with SMTP id c4mr584367qcu.118.1371140165217; Thu, 13 Jun 2013 09:16:05 -0700 (PDT) Received: by 10.49.96.226 with HTTP; Thu, 13 Jun 2013 09:16:05 -0700 (PDT) In-Reply-To: <83ehc6vvy8.fsf@gnu.org> References: <83ehc6vvy8.fsf@gnu.org> Date: Thu, 13 Jun 2013 17:16:05 +0100 Message-ID: From: E Sabof Content-Type: multipart/alternative; boundary=e89a8f5035be7c352004df0b728a X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --e89a8f5035be7c352004df0b728a Content-Type: text/plain; charset=ISO-8859-1 On Thu, Jun 13, 2013 at 5:04 PM, Eli Zaretskii wrote: > > Date: Thu, 13 Jun 2013 15:59:11 +0100 > > From: E Sabof > > Cc: 14604@debbugs.gnu.org > > > > (defvar user-selected-window nil) > > (defun register-user-location () > > (setq user-selected-window (selected-window))) > > (add-hook 'post-command-hook 'register-user-location) > > > > (setq-default > > mode-line-format > > '(:eval (if (eq user-selected-window (selected-window)) > > "selected" > > "not-selected"))) > > Does this work with mouse-autoselect-window? > Yes --e89a8f5035be7c352004df0b728a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Thu, Jun 13, 2013 at 5:04 PM, Eli Zaretskii <eliz@gnu.org= > wrote:
> Date: Thu, 13 Jun 2013 15:59:11 +0100
> From: E Sabof <esabof@gmail.com= >
> Cc: 14604@debbugs.gnu.org=
>
> (defvar user-selected-window nil)
> (defun register-user-location ()
> =A0 (setq user-selected-window (selected-window)))
> (add-hook 'post-command-hook 'register-user-location)
>
> (setq-default
> =A0 mode-line-format
> =A0 '(:eval (if (eq user-selected-window (selected-window))
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 "selected"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 "not-selected")))

Does this work with mouse-autoselect-window?

Yes
--e89a8f5035be7c352004df0b728a-- From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Oct 2013 17:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: E Sabof Cc: 14604@debbugs.gnu.org Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.138315542630409 (code B ref 14604); Wed, 30 Oct 2013 17:51:02 +0000 Received: (at 14604) by debbugs.gnu.org; 30 Oct 2013 17:50:26 +0000 Received: from localhost ([127.0.0.1]:53135 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbZuU-0007uP-6x for submit@debbugs.gnu.org; Wed, 30 Oct 2013 13:50:26 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:60656) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbZuR-0007uE-8f for 14604@debbugs.gnu.org; Wed, 30 Oct 2013 13:50:24 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r9UHoLaU005872; Wed, 30 Oct 2013 13:50:21 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id F3F81B42FC; Wed, 30 Oct 2013 13:50:20 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Wed, 30 Oct 2013 13:50:20 -0400 In-Reply-To: (E. Sabof's message of "Thu, 13 Jun 2013 15:59:11 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4747=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4747> : inlines <191> : streams <1065086> : uri <1580870> X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) > (defvar user-selected-window nil) > (defun register-user-location () > (setq user-selected-window (selected-window))) > (add-hook 'post-command-hook 'register-user-location) > (setq-default > mode-line-format > '(:eval (if (eq user-selected-window (selected-window)) > "selected" > "not-selected"))) That will usually work, except for corner-cases where redisplay happens in the middle of a command, or when the selected window is modified between commands (e.g. from a process sentinel). You can make it reliable with the use of the new `pre-redisplay-function' hook (instead of post-command-hook), which I just added yesterday. Of course, making it reliable doesn't mean it's not an omission. I tend to agree that it would be good to provide access to that info more directly. Stefan From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: E Sabof Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Oct 2013 19:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 14604@debbugs.gnu.org Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.13831610126881 (code B ref 14604); Wed, 30 Oct 2013 19:24:02 +0000 Received: (at 14604) by debbugs.gnu.org; 30 Oct 2013 19:23:32 +0000 Received: from localhost ([127.0.0.1]:53334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbbMY-0001mu-US for submit@debbugs.gnu.org; Wed, 30 Oct 2013 15:23:31 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:50649) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbbMW-0001me-44 for 14604@debbugs.gnu.org; Wed, 30 Oct 2013 15:23:29 -0400 Received: by mail-wi0-f174.google.com with SMTP id cb5so7327960wib.13 for <14604@debbugs.gnu.org>; Wed, 30 Oct 2013 12:23:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=LloeiA3EvLqoL10+JC55y/wDad+/EEfbiLCahLxq5TQ=; b=Yphrmjg0t6x9J75qQ44glTKlkrSIXCiXF28X1Eq+JSzcXYhIeDMMi9izdAorBTs65h FV6nFSPLpPQ5VpLohkBJmztm6a7V5EhXajN/GIhlozbv4XGvWsQK5T4gP6/gOJzuOFqF qpRuMnUVQ3rovtJ3KnjUrzI1Z3G7PP5uw8MZzUqfKGsjB4Z13JDJ5AVKNtd9Jo7TnVHo wxyl4ILCj2/iofEG2eoutawZwQcPPpRWE/6oX5tEA12UGfRTOHheY6FFOPTI/h5yWQJ0 6b0MaB3X/2INs9jt7g4D4iQEPaoUiK+9HK3lyo16USYAftM6/wuWRHWEU1LTlU+HAqEK FjAg== MIME-Version: 1.0 X-Received: by 10.180.185.101 with SMTP id fb5mr3564400wic.11.1383161001936; Wed, 30 Oct 2013 12:23:21 -0700 (PDT) Received: by 10.217.45.197 with HTTP; Wed, 30 Oct 2013 12:23:21 -0700 (PDT) In-Reply-To: References: Date: Wed, 30 Oct 2013 19:23:21 +0000 Message-ID: From: E Sabof Content-Type: multipart/alternative; boundary=001a11c2448e300f8b04e9fa4439 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a11c2448e300f8b04e9fa4439 Content-Type: text/plain; charset=ISO-8859-1 Thanks! Evgeni On Wed, Oct 30, 2013 at 5:50 PM, Stefan Monnier wrote: > > (defvar user-selected-window nil) > > (defun register-user-location () > > (setq user-selected-window (selected-window))) > > (add-hook 'post-command-hook 'register-user-location) > > > (setq-default > > mode-line-format > > '(:eval (if (eq user-selected-window (selected-window)) > > "selected" > > "not-selected"))) > > That will usually work, except for corner-cases where redisplay happens > in the middle of a command, or when the selected window is modified > between commands (e.g. from a process sentinel). > > You can make it reliable with the use of the new > `pre-redisplay-function' hook (instead of post-command-hook), which > I just added yesterday. > > Of course, making it reliable doesn't mean it's not an omission. > I tend to agree that it would be good to provide access to that info > more directly. > > > Stefan > --001a11c2448e300f8b04e9fa4439 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks!

Evgeni


On Wed, Oct 30, 2013 at 5:= 50 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrot= e:
> (defvar user-selected= -window nil)
> (defun register-user-location ()
> =A0 (setq user-selected-window (selected-window)))
> (add-hook 'post-command-hook 'register-user-location)

> (setq-default
> =A0 mode-line-format
> =A0 '(:eval (if (eq user-selected-window (selected-window))
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 "selected"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 "not-selected")))

That will usually work, except for corner-cases where redisplay happe= ns
in the middle of a command, or when the selected window is modified
between commands (e.g. from a process sentinel).

You can make it reliable with the use of the new
`pre-redisplay-function' hook (instead of post-command-hook), which
I just added yesterday.

Of course, making it reliable doesn't mean it's not an omission. I tend to agree that it would be good to provide access to that info
more directly.


=A0 =A0 =A0 =A0 Stefan

--001a11c2448e300f8b04e9fa4439-- From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: E Sabof Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Oct 2013 22:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 14604@debbugs.gnu.org Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.13831728485528 (code B ref 14604); Wed, 30 Oct 2013 22:41:02 +0000 Received: (at 14604) by debbugs.gnu.org; 30 Oct 2013 22:40:48 +0000 Received: from localhost ([127.0.0.1]:53683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbeRT-0001R5-1W for submit@debbugs.gnu.org; Wed, 30 Oct 2013 18:40:47 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:45010) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbeRJ-0001Qk-Jm for 14604@debbugs.gnu.org; Wed, 30 Oct 2013 18:40:38 -0400 Received: by mail-wg0-f46.google.com with SMTP id m15so1975108wgh.25 for <14604@debbugs.gnu.org>; Wed, 30 Oct 2013 15:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=beebQyGxZcY1Kqsc4envs7LInKM5GvjbmPr4IpQK608=; b=rNEEq1OLI1FLGMzd+hcgjcnplQXuYN5JORETnhmVgansfNm2OJOk1ko5M+gTZy+Mlm uhPJ6SgMEuL63zLDsRr2oQBVlaRa5XgYy7MWAoPgRojbedgRxi1kpqLgSfjs+L2rn2Xj mhwQ+B531ERrSarHQPt/Y61NNm11zEu/DYg344e4DZuOO+3oH1QxTMaK2e48STGmSf7a XornmeaXp3ypvknVLcrkdL1FxVAfJpTIYwAiH+mFYPcKcvsfpjmCZPrM3AgUSZZ6b3m5 FMCIIAOEJFs9NOxW2h5jOVRX+6TBeLGYKxBWQTZ1NWBfnArSu/+Sq7rgQIbwu/Zle7gs G+FA== MIME-Version: 1.0 X-Received: by 10.181.12.75 with SMTP id eo11mr4126216wid.24.1383172831765; Wed, 30 Oct 2013 15:40:31 -0700 (PDT) Received: by 10.217.45.197 with HTTP; Wed, 30 Oct 2013 15:40:31 -0700 (PDT) In-Reply-To: References: Date: Wed, 30 Oct 2013 22:40:31 +0000 Message-ID: From: E Sabof Content-Type: multipart/alternative; boundary=f46d043c7c564ceafb04e9fd0516 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --f46d043c7c564ceafb04e9fd0516 Content-Type: text/plain; charset=ISO-8859-1 Seemed to work during my brief test. Am I right in assuming that it's going to become `pre-redisplay-functions' if it goes into production? Evgeni On Wed, Oct 30, 2013 at 7:23 PM, E Sabof wrote: > Thanks! > > Evgeni > > > On Wed, Oct 30, 2013 at 5:50 PM, Stefan Monnier wrote: > >> > (defvar user-selected-window nil) >> > (defun register-user-location () >> > (setq user-selected-window (selected-window))) >> > (add-hook 'post-command-hook 'register-user-location) >> >> > (setq-default >> > mode-line-format >> > '(:eval (if (eq user-selected-window (selected-window)) >> > "selected" >> > "not-selected"))) >> >> That will usually work, except for corner-cases where redisplay happens >> in the middle of a command, or when the selected window is modified >> between commands (e.g. from a process sentinel). >> >> You can make it reliable with the use of the new >> `pre-redisplay-function' hook (instead of post-command-hook), which >> I just added yesterday. >> >> Of course, making it reliable doesn't mean it's not an omission. >> I tend to agree that it would be good to provide access to that info >> more directly. >> >> >> Stefan >> > > --f46d043c7c564ceafb04e9fd0516 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Seemed to work during my brief test. Am I right in assumin= g that it's going to become `pre-redisplay-functions'=A0if it goes into pro= duction?

Evgeni


On Wed, Oct 30, 2013 at 7:23 PM, E Sabof <esabof@gmail.= com> wrote:
Thanks!

= Evgeni


On Wed, Oct 30, 2013 at 5:50 PM, Stefan = Monnier <monnier@iro.umontreal.ca> wrote:
> (defvar user-selected-window nil)<= br> > (defun register-user-location ()
> =A0 (setq user-selected-window (selected-window)))
> (add-hook 'post-command-hook 'register-user-location)

> (setq-default
> =A0 mode-line-format
> =A0 '(:eval (if (eq user-selected-window (selected-window))
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 "selected"
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 "not-selected")))

That will usually work, except for corner-cases where redisplay happe= ns
in the middle of a command, or when the selected window is modified
between commands (e.g. from a process sentinel).

You can make it reliable with the use of the new
`pre-redisplay-function' hook (instead of post-command-hook), which
I just added yesterday.

Of course, making it reliable doesn't mean it's not an omission. I tend to agree that it would be good to provide access to that info
more directly.


=A0 =A0 =A0 =A0 Stefan


--f46d043c7c564ceafb04e9fd0516-- From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Oct 2013 23:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: E Sabof Cc: 14604@debbugs.gnu.org Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.13831758519990 (code B ref 14604); Wed, 30 Oct 2013 23:31:01 +0000 Received: (at 14604) by debbugs.gnu.org; 30 Oct 2013 23:30:51 +0000 Received: from localhost ([127.0.0.1]:53722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbfDu-0002b4-T2 for submit@debbugs.gnu.org; Wed, 30 Oct 2013 19:30:51 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:25913) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VbfDs-0002ap-56 for 14604@debbugs.gnu.org; Wed, 30 Oct 2013 19:30:48 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFsoXfp/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA6R6gV6DEw X-IPAS-Result: Av8EABK/CFFsoXfp/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA6R6gV6DEw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="36721559" Received: from 108-161-119-233.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([108.161.119.233]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 30 Oct 2013 19:30:42 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id E5903AE1C4; Wed, 30 Oct 2013 19:30:43 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Wed, 30 Oct 2013 19:30:43 -0400 In-Reply-To: (E. Sabof's message of "Wed, 30 Oct 2013 22:40:31 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > Seemed to work during my brief test. Am I right in assuming that it's going > to become `pre-redisplay-functions' if it goes into production? No: use add-function to modify it. Stefan From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: E Sabof Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Nov 2013 21:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 14604@debbugs.gnu.org Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.138334043114101 (code B ref 14604); Fri, 01 Nov 2013 21:14:02 +0000 Received: (at 14604) by debbugs.gnu.org; 1 Nov 2013 21:13:51 +0000 Received: from localhost ([127.0.0.1]:58154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VcM2R-0003fN-AP for submit@debbugs.gnu.org; Fri, 01 Nov 2013 17:13:51 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:50891) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VcM2O-0003fA-Rh for 14604@debbugs.gnu.org; Fri, 01 Nov 2013 17:13:49 -0400 Received: by mail-wi0-f176.google.com with SMTP id ex4so1651969wid.3 for <14604@debbugs.gnu.org>; Fri, 01 Nov 2013 14:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RjyJvwKa9tJTsgyRTLcjkAU3mUSTnnrycA/jd4roxBk=; b=BmNLmX3vWJThtKKqQCe0OpCv8mS1gfncJMRYTIBYOAumVX5Sq6uFTpwzbNAIlnJJ9G IdoxYkbzPN+xGAqrq8EUO5g9eyrHUHOzh0GGZx7vX4D4UfDymDEGv69yrbmz0cO3lWvU hiOBKnW7KYU6safjf+4mB+2rkV1SaUqdvGIsMuiOEokBdPqz2t3GQQrBy09LG2wtzHWe mya/jKvLeyuDgNBUrBmz1JMrdYitV2magp2rIWN+zf0jdWHrNT7PjKUQ7wvQquLzYyZp AwppwIRRozdyiCYUxs/dx8kMbqElyd9nSNiWxsaVgNdfNh33vSGDXrY12cI75ibGon3r 6Dcw== MIME-Version: 1.0 X-Received: by 10.180.72.195 with SMTP id f3mr3666628wiv.51.1383340422896; Fri, 01 Nov 2013 14:13:42 -0700 (PDT) Received: by 10.217.45.197 with HTTP; Fri, 1 Nov 2013 14:13:42 -0700 (PDT) In-Reply-To: References: Date: Fri, 1 Nov 2013 21:13:42 +0000 Message-ID: From: E Sabof Content-Type: multipart/alternative; boundary=f46d043c7b8c82a4b004ea240a26 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --f46d043c7b8c82a4b004ea240a26 Content-Type: text/plain; charset=ISO-8859-1 FWIW, I do like the new mechnsim. At the same time I think it offers little utility for of 90% cases, while introducing complexity and opaqueness. I wouldn't want it to become default for hooks. Evgeni On Wed, Oct 30, 2013 at 11:30 PM, Stefan Monnier wrote: > > Seemed to work during my brief test. Am I right in assuming that it's > going > > to become `pre-redisplay-functions' if it goes into production? > > No: use add-function to modify it. > > > Stefan > --f46d043c7b8c82a4b004ea240a26 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
FWIW, I do like the new mechnsim. At the same time I think= it offers little utility for of 90% cases, while introducing complexity an= d opaqueness. I wouldn't want it to become default for hooks.

Evgeni


On Wed, Oct 30, 2013 at 11:30 PM, Stefan Monnier <= monnier@iro.umontreal.ca> wrote:
> Seemed to work during= my brief test. Am I right in assuming that it's going
> to become `pre-redisplay-functions' if it goes into production?
No: use add-function to modify it.


=A0 =A0 =A0 =A0 Stefan

--f46d043c7b8c82a4b004ea240a26-- From unknown Sat Jun 21 03:24:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#14604: 24.3.50.1; Possibly incorrect behaviour of frame-selected-window Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Feb 2022 09:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14604 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: E Sabof Cc: 14604@debbugs.gnu.org Received: via spool by 14604-submit@debbugs.gnu.org id=B14604.164474411219587 (code B ref 14604); Sun, 13 Feb 2022 09:22:02 +0000 Received: (at 14604) by debbugs.gnu.org; 13 Feb 2022 09:21:52 +0000 Received: from localhost ([127.0.0.1]:36312 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJB4q-00055q-B6 for submit@debbugs.gnu.org; Sun, 13 Feb 2022 04:21:52 -0500 Received: from quimby.gnus.org ([95.216.78.240]:51306) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJB4o-00055a-KQ for 14604@debbugs.gnu.org; Sun, 13 Feb 2022 04:21:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=V6mUQf4pffVfcO3H6W2uikD2x2jChJd03+AymcRgoa8=; b=SwXHZjqfqHMuaznFfJ+9Z1ysnR 30cVwNxMFF9yYMLVrTuAeJI9JmkIVIMsNjmYiGDASLH+CIiZ6ia5/c7zkMGmvVlITbjpImZkGMS2t b/bOJPLVd8k24sGS2JQktEa5OQDiCDlhoTVTe80Qrh0ozZn7EX4YTWBK6HM5ewVunI/c=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJB4f-0001AV-8U; Sun, 13 Feb 2022 10:21:44 +0100 From: Lars Ingebrigtsen References: X-Now-Playing: Nils Petter =?UTF-8?Q?Molv=C3=A6r's?= _Solid Ether_: "Trip" Date: Sun, 13 Feb 2022 10:21:38 +0100 In-Reply-To: (E. Sabof's message of "Thu, 13 Jun 2013 12:45:54 +0100") Message-ID: <877d9zxgt9.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: E Sabof writes: > This works on 24.3, but on trunk all windows will be shown as "selected". > > (setq-default > mode-line-format > '(:eval (if (eq (frame-selected-window) > (selected-window)) > "selected" > "not-sele [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) E Sabof writes: > This works on 24.3, but on trunk all windows will be shown as "selected". > > (setq-default > mode-line-format > '(:eval (if (eq (frame-selected-window) > (selected-window)) > "selected" > "not-selected"))) > > I don't know which behavior is correct, but being able to find which is the "really" > selected window would be nice. (I'm going through old bug reports that unfortunately weren't resolved at the time.) In Emacs 29, we've introduced a new function `mode-line-window-selected-p' for this use case (i.e., determining if we're rendering the mode line for the currently selected window). So I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 13 04:21:57 2022 Received: (at control) by debbugs.gnu.org; 13 Feb 2022 09:21:58 +0000 Received: from localhost ([127.0.0.1]:36315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJB4v-000567-IR for submit@debbugs.gnu.org; Sun, 13 Feb 2022 04:21:57 -0500 Received: from quimby.gnus.org ([95.216.78.240]:51320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJB4t-00055j-JJ for control@debbugs.gnu.org; Sun, 13 Feb 2022 04:21:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2FIUSu5gegleLnLg78YDVF3a5UuUAmPgG+exuQe3q5A=; b=tnWLX+X+EpDlJ/tIu5j4GYrHNE 6S8GZ8FZ2+DdNr0805dyk0Y8n2vipcdKZ1PxhDN3VHH7Go/feyqSMILfRvvN4q4lelEWeHdzpg8/H ua6vP73UgXDYs7NNoL5usmdukuO4rW/YC71FZX50kUoB8pK3i1QCNZg+pP54D9opswdg=; Received: from [84.212.220.105] (helo=giant) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJB4l-0001Af-Cd for control@debbugs.gnu.org; Sun, 13 Feb 2022 10:21:49 +0100 Date: Sun, 13 Feb 2022 10:21:46 +0100 Message-Id: <875ypjxgt1.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #14604 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 14604 29.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 14604 29.1 quit