From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: visual-region-mode? Date: Mon, 17 Sep 2018 01:55:53 +0300 Organization: LINKOV.NET Message-ID: <87fty9jbly.fsf@mail.linkov.net> References: <83k1nxvm5j.fsf@gnu.org> <877ejxsm18.fsf@toy.adminart.net> <874lf0oul4.fsf@toy.adminart.net> <877ejuabdt.fsf_-_@toy.adminart.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1537141052 22891 195.159.176.226 (16 Sep 2018 23:37:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 16 Sep 2018 23:37:32 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: hw@adminart.net, =?iso-8859-1?Q?Cl=E9ment?= Pit-Claudel , charles@aurox.ch, rms@gnu.org, Elias =?iso-8859-1?Q?M=E5rtenson?= , Emacs developers To: Yuri Khan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 17 01:37:27 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g1gbX-0005qA-1G for ged-emacs-devel@m.gmane.org; Mon, 17 Sep 2018 01:37:27 +0200 Original-Received: from localhost ([::1]:33000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1gdd-0008WA-Ec for ged-emacs-devel@m.gmane.org; Sun, 16 Sep 2018 19:39:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1gcp-0008Vz-Ii for emacs-devel@gnu.org; Sun, 16 Sep 2018 19:38:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1gck-0006os-Di for emacs-devel@gnu.org; Sun, 16 Sep 2018 19:38:47 -0400 Original-Received: from pop.dreamhost.com ([64.90.62.162]:57572 helo=pdx1-sub0-mail-a8.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g1gck-0006lq-2y; Sun, 16 Sep 2018 19:38:42 -0400 Original-Received: from pdx1-sub0-mail-a8.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a8.g.dreamhost.com (Postfix) with ESMTP id A9CA68069E; Sun, 16 Sep 2018 16:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=Q7zGOJ575zM6PUaw/DgWUFkedXI=; b= Kh8RKyrsrOdhIqTEzvlvdI8ozeH/T1Fe82DoYKm0+rSDA71YeQFdAJ8yt3I8j51P +Ga7Sywt3RIjDxHDA3j70xuUk+c3aFCad64/3cay2zZVK8njWwLATDhL2mQMUOZd qVhh+6LHfqaQ123L1SHWA7xn5A+KTtTD16EEorbCA84= Original-Received: from localhost.linkov.net (m91-129-107-237.cust.tele2.ee [91.129.107.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a8.g.dreamhost.com (Postfix) with ESMTPSA id 807BF7E446; Sun, 16 Sep 2018 16:38:37 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a8 X-DH-BACKEND: pdx1-sub0-mail-a8 In-Reply-To: (Yuri Khan's message of "Tue, 11 Sep 2018 12:43:16 +0700") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.90.62.162 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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:229872 Archived-At: > By the way, this definition of region is flawed. > > The mark is buffer-local, while the point is buffer-and-window-local. > Display a buffer B in windows X and Y, mark a region in window X, then > switch to window Y. Suddenly, an entirely unrelated fragment of text > is highlighted as region. > > A consistent definition of a persistent region would make it an > interval between two buffer-local markers, both of which are distinct > from the point. > > A consistent definition of a transient region would make the mark also > buffer-and-window-local, so that buffer B in windows X and Y could > have completely independently marked regions. Yes, this is an annoying problem. As a workaround, it's easy to make the mark buffer-and-window-local with this simple code: (defvar-local mark-active-window nil) (add-hook 'activate-mark-hook (lambda () (setq mark-active-window (selected-window)))) (add-hook 'deactivate-mark-hook (lambda () (setq mark-active-window nil))) (defun redisplay--update-mark-active-window (window) (when mark-active-window (setq mark-active (eq mark-active-window window)))) (add-to-list 'pre-redisplay-functions #'redisplay--update-mark-active-window) I'm not sure if a new customizable option is necessary to define the preferable behavior like with the option `highlight-nonselected-windows'.