From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] update the behavior of highlight-nonselected-windows Date: Tue, 31 Mar 2015 08:52:14 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1427806367 11325 80.91.229.3 (31 Mar 2015 12:52:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 31 Mar 2015 12:52:47 +0000 (UTC) Cc: emacs-devel To: Oleh Krehel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 31 14:52:35 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ycvek-0000RX-Jk for ged-emacs-devel@m.gmane.org; Tue, 31 Mar 2015 14:52:34 +0200 Original-Received: from localhost ([::1]:38571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ycvej-00045t-Qz for ged-emacs-devel@m.gmane.org; Tue, 31 Mar 2015 08:52:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcveV-00045f-BA for emacs-devel@gnu.org; Tue, 31 Mar 2015 08:52:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YcveR-0002dI-UR for emacs-devel@gnu.org; Tue, 31 Mar 2015 08:52:19 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:9769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YcveR-0002cy-QW for emacs-devel@gnu.org; Tue, 31 Mar 2015 08:52:15 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXYBBVYjEAsOJhIUGA0kqiSMDA9JDAODPgODcASoOw X-IPAS-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXYBBVYjEAsOJhIUGA0kqiSMDA9JDAODPgODcASoOw X-IronPort-AV: E=Sophos;i="5.01,1,1400040000"; d="scan'208";a="115039496" Original-Received: from 65-110-216-75.cpe.pppoe.ca (HELO pastel.home) ([65.110.216.75]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Mar 2015 08:52:15 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id EFD469FB; Tue, 31 Mar 2015 08:52:14 -0400 (EDT) In-Reply-To: (Oleh Krehel's message of "Tue, 31 Mar 2015 13:53:33 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:184615 Archived-At: > - (mapc #'redisplay--update-region-highlight windows) > + (mapc #'redisplay--update-region-highlight > + (delq nil > + (mapcar (lambda (w) > + (unless (eq (window-buffer w) > + (current-buffer)) > + w)) > + windows))) I don't think depending on the value of `current-buffer' can be right. More specifically, it will only do what (I think) you want in the case where the buffer who's displayed in several windows (and has an active region) happens to be the current buffer. IIUC the problem that annoys you, it comes from the fact that the region is defined to be "anything between point and mark" but point is a per-window attribute while mark is a per-buffer attribute. Maybe a way to solve this issue would be to keep track of the window in which the mark was made active. E.g. instead of setting mark-active to t we'd set it to (selected-window). And then we could change redisplay--update-region-highlights to only highlight in the window specified by mark-active. Stefan