From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 15 15:08:22 2014 Received: (at submit) by debbugs.gnu.org; 15 Oct 2014 19:08:23 +0000 Received: from localhost ([127.0.0.1]:44792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeTvq-0006d8-2a for submit@debbugs.gnu.org; Wed, 15 Oct 2014 15:08:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41559) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeTgK-0006CX-7L for submit@debbugs.gnu.org; Wed, 15 Oct 2014 14:52:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeTgA-0004f0-1s for submit@debbugs.gnu.org; Wed, 15 Oct 2014 14:52:19 -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.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:54702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeTg9-0004ev-VW for submit@debbugs.gnu.org; Wed, 15 Oct 2014 14:52:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeTg2-0000Z2-Gj for bug-gnu-emacs@gnu.org; Wed, 15 Oct 2014 14:52:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XeTft-0004Nm-MO for bug-gnu-emacs@gnu.org; Wed, 15 Oct 2014 14:52:02 -0400 Received: from mail-la0-f51.google.com ([209.85.215.51]:43392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XeTft-0004N9-Fk for bug-gnu-emacs@gnu.org; Wed, 15 Oct 2014 14:51:53 -0400 Received: by mail-la0-f51.google.com with SMTP id ge10so1604724lab.24 for ; Wed, 15 Oct 2014 11:51:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:date:message-id :subject:from:to:content-type; bh=RCh3CLgan/cPYgWmWorBSH0EDA8THoDy8XcjWUeqXaQ=; b=gMl+9MXvruuI1zcuzCFqeaIRcwnv5rHKqPH/84Snaff6MrDcdvsjRs0/q9FWS6pCrk IaR3VmLrBfJLUqRj1kQ2BvGNif3Usigzb3SU10SgQYSPK/1++JLZYOjeeO2ls8zzPMc2 vU5egSRHCHyP1mmRKEMbdTQNpBdSvLGyKxnsjr6JKBV44fgqewia+oZ2VG8YHDjv1jOL /fpIcOOeWjGKtEBIowwqRiA/RNdpwwRdtT6NAKJhGEQHoGFXGGh1SdP+X1bUOS4UCSYV un7L5Hlsfsf4zo8wgPeUtBAq/DK6YiZs7E77e7+8hTJveQHFOsJVpWtbSCMm3hsovcu1 yZ8A== X-Gm-Message-State: ALoCoQmzz4kfDQQ0ZkNKZuFqHoSjpJfLw7ELpCF05Mo3cKw88RMY7+MLhXPitIj4M9g2umuw0LO7 MIME-Version: 1.0 X-Received: by 10.152.234.36 with SMTP id ub4mr14505010lac.25.1413399111391; Wed, 15 Oct 2014 11:51:51 -0700 (PDT) Received: by 10.152.37.202 with HTTP; Wed, 15 Oct 2014 11:51:51 -0700 (PDT) X-Originating-IP: [67.128.198.190] Date: Wed, 15 Oct 2014 11:51:51 -0700 X-Google-Sender-Auth: oQOTMBGFi5hCjwKA9IJnYx9sb6U Message-ID: Subject: 24.3; Request for a hook to be provided when scrolling will move the cursor From: Josh To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=UTF-8 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: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 15 Oct 2014 15:08:19 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: josh+gnu@nispio.net 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: -5.0 (-----) It would be helpful to have a hook that would be called before any scrolling command moves the cursor. In other words, I want to be notified when an update to the display will force the location of `point' to change in the current buffer. One motivation for such a hook is the ability to save the current cursor location before scrolling so that it is possible to automatically jump back to that position after scolling. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 15 16:43:24 2014 Received: (at 18739) by debbugs.gnu.org; 15 Oct 2014 20:43:24 +0000 Received: from localhost ([127.0.0.1]:44874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeVPo-0001xI-AR for submit@debbugs.gnu.org; Wed, 15 Oct 2014 16:43:24 -0400 Received: from mtaout23.012.net.il ([80.179.55.175]:33495) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeVPk-0001x5-5q for 18739@debbugs.gnu.org; Wed, 15 Oct 2014 16:43:21 -0400 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NDI008006VZMO00@a-mtaout23.012.net.il> for 18739@debbugs.gnu.org; Wed, 15 Oct 2014 23:43:18 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDI008TM6W5KN20@a-mtaout23.012.net.il>; Wed, 15 Oct 2014 23:43:18 +0300 (IDT) Date: Wed, 15 Oct 2014 23:43:18 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: josh+gnu@nispio.net Message-id: <83wq813vyx.fsf@gnu.org> References: X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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: Wed, 15 Oct 2014 11:51:51 -0700 > From: Josh > > It would be helpful to have a hook that would be called before any > scrolling command moves the cursor. In other words, I want to be > notified when an update to the display will force the location of > `point' to change in the current buffer. What's wrong with window-scroll-functions? > One motivation for such a hook is the ability to save the current > cursor location before scrolling so that it is possible to > automatically jump back to that position after scolling. If you jump back, you will actually undo the scroll, so I'm not sure what kind of situation are you talking about, or why do you use the scrolling commands to begin with. Please elaborate. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 15 17:01:39 2014 Received: (at 18739) by debbugs.gnu.org; 15 Oct 2014 21:01:39 +0000 Received: from localhost ([127.0.0.1]:44887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeVhS-0002RV-SH for submit@debbugs.gnu.org; Wed, 15 Oct 2014 17:01:39 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:36398) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeVhQ-0002RK-1y for 18739@debbugs.gnu.org; Wed, 15 Oct 2014 17:01:36 -0400 Received: by mail-lb0-f174.google.com with SMTP id p9so1747002lbv.5 for <18739@debbugs.gnu.org>; Wed, 15 Oct 2014 14:01:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=mziN/oU8tkL3M4xELajEoah4+DeRaZtGV579LPTA4xw=; b=NpTNaSevY4KXiETAd/GwzILVMfQNFWZ6GK5yS+pvrZ5/87h3tqS9RHwEaF3OxIHbr1 D3GOLpinZEOiLXw6KxJKiftiSGm+/aiYD5IAikRTwkxXqVOnOerZKBGPMem667p7iKQn FtnRF/xqjQxSG6r92JdEy04Br89CmBJuxBjFWEt71N1ANUw8VJ+cmM80t7AQZDdp/tpR Ir9ZeL410jSFz3KksNgtJ+bDV+Ka8Hd7WpvmQ6V+Vpjy3shpJZcEBl1GBNj5/Et7xa43 g2+dDMitgA3M/oc7UjHlAm2YRFgXLgv+9u9GdP/cpwkFqcpXCclUyxqZG1hz0gR5JCol s/mQ== X-Gm-Message-State: ALoCoQm/cKYFRooC47//JxPGf+OEnypl5yIv7yMpWGdOUkLkbAud6gAgm4Gwi0a94P5iX7t/C5a7 MIME-Version: 1.0 X-Received: by 10.112.118.229 with SMTP id kp5mr4283747lbb.99.1413406894871; Wed, 15 Oct 2014 14:01:34 -0700 (PDT) Received: by 10.152.37.202 with HTTP; Wed, 15 Oct 2014 14:01:34 -0700 (PDT) X-Originating-IP: [67.128.198.190] In-Reply-To: <83wq813vyx.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> Date: Wed, 15 Oct 2014 14:01:34 -0700 X-Google-Sender-Auth: SFrOHx5xdQIBLuKyvK-CKwCaBWE Message-ID: Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor From: Josh To: Eli Zaretskii Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18739 Cc: 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: josh+gnu@nispio.net 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 (/) > If you jump back, you will actually undo the scroll, so I'm not sure > what kind of situation are you talking about, or why do you use the > scrolling commands to begin with. Please elaborate. I am writing code and I realize that I forgot the name of the variable that I defined 30 lines ago, I use the mouse to do a quick scroll up, read the name, and scroll back down where I came from. The problem is that now the cursor location has changed, and I have to spend time trying to figure out which line I was typing on and moving my cursor back to that position. It would be nice if I could have the cursor stay where I left it for the brief period that I peek elsewhere in the buffer. > What's wrong with window-scroll-functions? I was looking for a hook, and did not see a relevant one. I was not aware that window-scroll-functions existed, but it looks like it could be a viable solution. Thank you. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 15 17:08:45 2014 Received: (at 18739) by debbugs.gnu.org; 15 Oct 2014 21:08:45 +0000 Received: from localhost ([127.0.0.1]:44891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeVoK-0002cL-QP for submit@debbugs.gnu.org; Wed, 15 Oct 2014 17:08:45 -0400 Received: from mtaout25.012.net.il ([80.179.55.181]:38384) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeVoI-0002cC-Oh for 18739@debbugs.gnu.org; Wed, 15 Oct 2014 17:08:43 -0400 Received: from conversion-daemon.mtaout25.012.net.il by mtaout25.012.net.il (HyperSendmail v2007.08) id <0NDI0080072Z5A00@mtaout25.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 00:03:58 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout25.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDI006A67UM7K40@mtaout25.012.net.il>; Thu, 16 Oct 2014 00:03:58 +0300 (IDT) Date: Thu, 16 Oct 2014 00:08:41 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: josh+gnu@nispio.net Message-id: <83tx353usm.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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: Wed, 15 Oct 2014 14:01:34 -0700 > From: Josh > Cc: 18739@debbugs.gnu.org > > > If you jump back, you will actually undo the scroll, so I'm not sure > > what kind of situation are you talking about, or why do you use the > > scrolling commands to begin with. Please elaborate. > > I am writing code and I realize that I forgot the name of the variable > that I defined 30 lines ago, I use the mouse to do a quick scroll up, > read the name, and scroll back down where I came from. The problem is > that now the cursor location has changed, and I have to spend time > trying to figure out which line I was typing on and moving my cursor > back to that position. It would be nice if I could have the cursor > stay where I left it for the brief period that I peek elsewhere in the > buffer. The usual technique in Emacs is to put the mark where you were before scrolling. Then "C-x C-x" will get you back. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 15 17:21:08 2014 Received: (at 18739) by debbugs.gnu.org; 15 Oct 2014 21:21:08 +0000 Received: from localhost ([127.0.0.1]:44905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeW0J-0002wQ-5U for submit@debbugs.gnu.org; Wed, 15 Oct 2014 17:21:07 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:38741) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeVsc-0002ja-IH for 18739@debbugs.gnu.org; Wed, 15 Oct 2014 17:13:11 -0400 Received: by mail-ob0-f173.google.com with SMTP id wp4so1799736obc.18 for <18739@debbugs.gnu.org>; Wed, 15 Oct 2014 14:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=3pTqODZdMFwGZ8tMgWXOQpMWsVLxbOl62xmtRUXnG9E=; b=BohkVE9h6Y3+Z9rV21rJiFP96ySPedGfAs2nISWmxerBq/k9NMeNOjwBraUM1Mhc4I uN8AmVgejWSxIvxP3cKqs6Aw8t6WMqYYW0sTtibnaOxNVOhOuKJyxOQP8GGj338ayxN8 8Mol4WCyk9/+/xrX8ij3/eedLRO+l87N7CuuL+d8JOulpizWX5IJhdNJARN2BqJw3lu3 TdDnTmT55OMOymRwA6AWI1bhbgYClxxA7Fve1wwH5kmvv0rxmooyrs4EoOYut8+Cjkhs 3h4nZ/pHA1HFih5ktWJ89wnatluH/HuHnToiDGbbeBTdsRmDtRNO4KRKLgc2uhg/863U 3b+Q== X-Received: by 10.202.106.145 with SMTP id f139mr12309383oic.43.1413407589751; Wed, 15 Oct 2014 14:13:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.35.197 with HTTP; Wed, 15 Oct 2014 14:12:49 -0700 (PDT) In-Reply-To: <83tx353usm.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83tx353usm.fsf@gnu.org> From: Josh Hunsaker Date: Wed, 15 Oct 2014 14:12:49 -0700 Message-ID: Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor To: Eli Zaretskii Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18739 X-Mailman-Approved-At: Wed, 15 Oct 2014 17:21:05 -0400 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org 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 (/) > The usual technique in Emacs is to put the mark where you were before > scrolling. Then "C-x C-x" will get you back. This requires the forethought to set the mark before scrolling. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 15 17:27:41 2014 Received: (at 18739) by debbugs.gnu.org; 15 Oct 2014 21:27:41 +0000 Received: from localhost ([127.0.0.1]:44909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeW6e-00036I-MM for submit@debbugs.gnu.org; Wed, 15 Oct 2014 17:27:41 -0400 Received: from fely.am-1.org ([78.47.74.50]:36366) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeW6c-000367-Im for 18739@debbugs.gnu.org; Wed, 15 Oct 2014 17:27:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=z0J42Nuq/rW9OFQBQe2PWzuwZeLkwB+XDAX9z8XHku4=; b=e3XSjRDLclORSEJi91tjCWJUtBToTXgu3CREkizZVCC9myOeSdviiElh7i/+fRFaHhF0CO/lMtEpd85wcHlEhrqp0L4xL0OvFZOkB5nsAcJhHb7eHVtnrxRkT2leKPpg3SleovMJW8rY+nfaspQoNIDEp6zo/acsrdDLcuJ6UwM=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XeW6a-0005Vz-U4 for 18739@debbugs.gnu.org; Wed, 15 Oct 2014 21:27:37 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XeW6S-0006LA-WA for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 04:27:29 +0700 From: Ivan Shmakov To: 18739@debbugs.gnu.org Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor References: <83wq813vyx.fsf@gnu.org> <83tx353usm.fsf@gnu.org> Date: Wed, 15 Oct 2014 21:27:28 +0000 In-Reply-To: (Josh Hunsaker's message of "Wed, 15 Oct 2014 14:12:49 -0700") Message-ID: <87mw8xvxa7.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 18739 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 (/) >>>>> Josh Hunsaker writes: >>> I am writing code and I realize that I forgot the name of the >>> variable that I defined 30 lines ago, I use the mouse to do a quick >>> scroll up, read the name, and scroll back down where I came from. >> The usual technique in Emacs is to put the mark where you were >> before scrolling. Then "C-x C-x" will get you back. > This requires the forethought to set the mark before scrolling. Usually, I use incremental search (C-r) to look back at the code. A side effect of that is that the mark gets set, so after I=E2=80=99ve looked what I was interested in up, =E2=80=93 I can readily C= -x C-x my way back. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 15 18:48:20 2014 Received: (at 18739) by debbugs.gnu.org; 15 Oct 2014 22:48:20 +0000 Received: from localhost ([127.0.0.1]:44961 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeXMh-0005Dp-Va for submit@debbugs.gnu.org; Wed, 15 Oct 2014 18:48:20 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:58205) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeXMf-0005Dh-RR for 18739@debbugs.gnu.org; Wed, 15 Oct 2014 18:48:18 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMQCzQSFBgNJIgECNIZF456B4Q4AQOpGYFqgXGBWyE X-IPAS-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMQCzQSFBgNJIgECNIZF456B4Q4AQOpGYFqgXGBWyE X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="94303739" Received: from 69-196-168-232.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.232]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 Oct 2014 18:48:17 -0400 Received: by pastel.home (Postfix, from userid 20848) id 0AE8B7CFB; Wed, 15 Oct 2014 18:48:17 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor Message-ID: References: <83wq813vyx.fsf@gnu.org> Date: Wed, 15 Oct 2014 18:48:16 -0400 In-Reply-To: <83wq813vyx.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 15 Oct 2014 23:43:18 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org 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 (/) >> It would be helpful to have a hook that would be called before any >> scrolling command moves the cursor. In other words, I want to be >> notified when an update to the display will force the location of >> `point' to change in the current buffer. > What's wrong with window-scroll-functions? But these are also called when point is not affected, right? >> One motivation for such a hook is the ability to save the current >> cursor location before scrolling so that it is possible to >> automatically jump back to that position after scolling. > If you jump back, you will actually undo the scroll, so I'm not sure > what kind of situation are you talking about, or why do you use the > scrolling commands to begin with. Please elaborate. He's thinking of scrolling back a while later. Think about a case such as Martin's scroll-replace.el (just added to GNU ELPA). Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 02:36:42 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 06:36:42 +0000 Received: from localhost ([127.0.0.1]:45152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xeefx-0001la-NY for submit@debbugs.gnu.org; Thu, 16 Oct 2014 02:36:42 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]:43680) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xeefu-0001lQ-Jw for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 02:36:39 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NDI00M00XQ31S00@a-mtaout20.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 09:36:36 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDI00LJDYD0JV80@a-mtaout20.012.net.il>; Thu, 16 Oct 2014 09:36:36 +0300 (IDT) Date: Thu, 16 Oct 2014 09:36:37 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: Josh Hunsaker Message-id: <83siio4j2i.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83tx353usm.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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 (+) > From: Josh Hunsaker > Date: Wed, 15 Oct 2014 14:12:49 -0700 > Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org > > > The usual technique in Emacs is to put the mark where you were before > > scrolling. Then "C-x C-x" will get you back. > > This requires the forethought to set the mark before scrolling. No, you can do it always. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 02:41:16 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 06:41:16 +0000 Received: from localhost ([127.0.0.1]:45156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeekN-0001vE-TN for submit@debbugs.gnu.org; Thu, 16 Oct 2014 02:41:16 -0400 Received: from mtaout26.012.net.il ([80.179.55.182]:35133) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeekK-0001v0-4b for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 02:41:12 -0400 Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0NDI00N00XZJJO00@mtaout26.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 09:39:27 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDI00FDBYHRA680@mtaout26.012.net.il>; Thu, 16 Oct 2014 09:39:27 +0300 (IDT) Date: Thu, 16 Oct 2014 09:41:12 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <83r3y84iuv.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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 (+) > From: Stefan Monnier > Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org > Date: Wed, 15 Oct 2014 18:48:16 -0400 > > >> It would be helpful to have a hook that would be called before any > >> scrolling command moves the cursor. In other words, I want to be > >> notified when an update to the display will force the location of > >> `point' to change in the current buffer. > > What's wrong with window-scroll-functions? > > But these are also called when point is not affected, right? Yes. But it's easy to detect that situation, I think. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 03:15:11 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 07:15:12 +0000 Received: from localhost ([127.0.0.1]:45180 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XefHD-0002oe-0d for submit@debbugs.gnu.org; Thu, 16 Oct 2014 03:15:11 -0400 Received: from cantor2.suse.de ([195.135.220.15]:47593 helo=mx2.suse.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XefHA-0002oR-Ra for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 03:15:09 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 52402AAF3; Thu, 16 Oct 2014 07:15:08 +0000 (UTC) From: Andreas Schwab To: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor References: <83wq813vyx.fsf@gnu.org> <83tx353usm.fsf@gnu.org> <83siio4j2i.fsf@gnu.org> X-Yow: On SECOND thought, maybe I'll heat up some BAKED BEANS and watch REGIS PHILBIN.. It's GREAT to be ALIVE!! Date: Thu, 16 Oct 2014 09:15:08 +0200 In-Reply-To: <83siio4j2i.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 Oct 2014 09:36:37 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org, Josh Hunsaker 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: -5.0 (-----) Eli Zaretskii writes: >> From: Josh Hunsaker >> Date: Wed, 15 Oct 2014 14:12:49 -0700 >> Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org >> >> > The usual technique in Emacs is to put the mark where you were before >> > scrolling. Then "C-x C-x" will get you back. >> >> This requires the forethought to set the mark before scrolling. > > No, you can do it always. Then you lose the previous mark. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 03:33:25 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 07:33:25 +0000 Received: from localhost ([127.0.0.1]:45216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XefYq-0003JI-Bi for submit@debbugs.gnu.org; Thu, 16 Oct 2014 03:33:24 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]:52614) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XefYn-0003J6-4x for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 03:33:22 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NDJ00M000WQJN00@a-mtaout20.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 10:33:20 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDJ00MXE0ZJ9I80@a-mtaout20.012.net.il>; Thu, 16 Oct 2014 10:33:20 +0300 (IDT) Date: Thu, 16 Oct 2014 10:33:21 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: Andreas Schwab Message-id: <83k3404gfy.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83tx353usm.fsf@gnu.org> <83siio4j2i.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org, josh.huns@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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 (+) > From: Andreas Schwab > Cc: Josh Hunsaker , josh+gnu@nispio.net, 18739@debbugs.gnu.org > Date: Thu, 16 Oct 2014 09:15:08 +0200 > > Eli Zaretskii writes: > > >> From: Josh Hunsaker > >> Date: Wed, 15 Oct 2014 14:12:49 -0700 > >> Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org > >> > >> > The usual technique in Emacs is to put the mark where you were before > >> > scrolling. Then "C-x C-x" will get you back. > >> > >> This requires the forethought to set the mark before scrolling. > > > > No, you can do it always. > > Then you lose the previous mark. Not if it's pushed. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 03:38:28 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 07:38:28 +0000 Received: from localhost ([127.0.0.1]:45223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xefdj-0003RQ-KS for submit@debbugs.gnu.org; Thu, 16 Oct 2014 03:38:27 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48006 helo=mx2.suse.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xefdb-0003RA-F9 for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 03:38:26 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EC4E2AAF3; Thu, 16 Oct 2014 07:38:18 +0000 (UTC) From: Andreas Schwab To: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor References: <83wq813vyx.fsf@gnu.org> <83tx353usm.fsf@gnu.org> <83siio4j2i.fsf@gnu.org> <83k3404gfy.fsf@gnu.org> X-Yow: I am having a CONCEPTION-- Date: Thu, 16 Oct 2014 09:38:18 +0200 In-Reply-To: <83k3404gfy.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 Oct 2014 10:33:21 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org, josh.huns@gmail.com 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: -5.0 (-----) Eli Zaretskii writes: >> From: Andreas Schwab >> Cc: Josh Hunsaker , josh+gnu@nispio.net, 18739@debbugs.gnu.org >> Date: Thu, 16 Oct 2014 09:15:08 +0200 >> >> Eli Zaretskii writes: >> >> >> From: Josh Hunsaker >> >> Date: Wed, 15 Oct 2014 14:12:49 -0700 >> >> Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org >> >> >> >> > The usual technique in Emacs is to put the mark where you were before >> >> > scrolling. Then "C-x C-x" will get you back. >> >> >> >> This requires the forethought to set the mark before scrolling. >> > >> > No, you can do it always. >> >> Then you lose the previous mark. > > Not if it's pushed. C-x C-x only uses the current mark. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 03:51:03 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 07:51:03 +0000 Received: from localhost ([127.0.0.1]:45228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xefpu-0003lN-Vg for submit@debbugs.gnu.org; Thu, 16 Oct 2014 03:51:03 -0400 Received: from mtaout26.012.net.il ([80.179.55.182]:42731) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xefpr-0003kt-Gi for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 03:51:00 -0400 Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0NDJ00A001611C00@mtaout26.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 10:49:14 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDJ001MX1Q2UT80@mtaout26.012.net.il>; Thu, 16 Oct 2014 10:49:14 +0300 (IDT) Date: Thu, 16 Oct 2014 10:50:59 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: Andreas Schwab Message-id: <83h9z44fmk.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83tx353usm.fsf@gnu.org> <83siio4j2i.fsf@gnu.org> <83k3404gfy.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org, josh.huns@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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 (+) > From: Andreas Schwab > Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org, josh.huns@gmail.com > Date: Thu, 16 Oct 2014 09:38:18 +0200 > > Eli Zaretskii writes: > > >> From: Andreas Schwab > >> Cc: Josh Hunsaker , josh+gnu@nispio.net, 18739@debbugs.gnu.org > >> Date: Thu, 16 Oct 2014 09:15:08 +0200 > >> > >> Eli Zaretskii writes: > >> > >> >> From: Josh Hunsaker > >> >> Date: Wed, 15 Oct 2014 14:12:49 -0700 > >> >> Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org > >> >> > >> >> > The usual technique in Emacs is to put the mark where you were before > >> >> > scrolling. Then "C-x C-x" will get you back. > >> >> > >> >> This requires the forethought to set the mark before scrolling. > >> > > >> > No, you can do it always. > >> > >> Then you lose the previous mark. > > > > Not if it's pushed. > > C-x C-x only uses the current mark. Which is what the OP wants. Later, he can restore the other marks from the ring, if that is needed. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 09:44:50 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 13:44:50 +0000 Received: from localhost ([127.0.0.1]:45418 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XelMH-0005hf-Rk for submit@debbugs.gnu.org; Thu, 16 Oct 2014 09:44:50 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:25184) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XelM3-0005hG-IT for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 09:44:48 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIImAQEEViMQCzQSFBgNJIgM0hkXjnoHhDgEqRmBaoFxgVsh X-IPAS-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIImAQEEViMQCzQSFBgNJIgM0hkXjnoHhDgEqRmBaoFxgVsh X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="94346954" Received: from 69-196-168-232.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.232]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 Oct 2014 09:44:34 -0400 Received: by pastel.home (Postfix, from userid 20848) id 4BC9085A2; Thu, 16 Oct 2014 09:44:34 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor Message-ID: References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> Date: Thu, 16 Oct 2014 09:44:34 -0400 In-Reply-To: <83r3y84iuv.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 Oct 2014 09:41:12 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org 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 (/) >> >> It would be helpful to have a hook that would be called before any >> >> scrolling command moves the cursor. In other words, I want to be >> >> notified when an update to the display will force the location of >> >> `point' to change in the current buffer. >> > What's wrong with window-scroll-functions? >> But these are also called when point is not affected, right? > Yes. But it's easy to detect that situation, I think. Is it? I think the main reason why I ask is because I truly have no idea when window-scroll-functions is called. You seem to be somewhat familiar with it, so could you try and clarify it in the docstring? Currently I see "List of functions to call before redisplaying a window with scrolling" and "Note that these functions are also called by `set-window-buffer'". Here are some of the questions this brings up for me: - is it called during set-window-buffer itself, or is it called in the first redisplay after set-window-buffer? - what means "redisplaying a window with scrolling" exactly? Does it mean "redisplay with a different window-start then during the last redisplay"? Does that include the case where window-start is changed so as to follow point or is it only the cases where window-start was changed explicitly by a scrolling command? - how could a window-scroll-function distinguish the 3 cases: "set-window-buffer", "used a scroll command", "moved point out of viewport". I tried already a few times to understand window-scroll-functions, but so far it has eluded me. FWIW, I found 3 kinds of uses: - A crutch from when jit-lock didn't exist (in linum and lazy-lock). - A way to try and keep a window fully empty showing only point-max by calling set-window-start with the same window-start (in follow-mode). Not clear exactly why this should work, and arguably goes against the warning in window-scroll-functions's docstring. - Do fancy auto-scrolling in eshell/em-smart (which does exactly what window-scroll-functions's docstring warns not to do, AFAICT), calling redisplay internally. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 09:53:33 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 13:53:33 +0000 Received: from localhost ([127.0.0.1]:45426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XelUi-0005vL-O5 for submit@debbugs.gnu.org; Thu, 16 Oct 2014 09:53:33 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:53752) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XelUZ-0005v4-Lu for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 09:53:31 -0400 Received: by mail-lb0-f174.google.com with SMTP id p9so2842082lbv.19 for <18739@debbugs.gnu.org>; Thu, 16 Oct 2014 06:53:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=0IBtrk8x2QHhu0g+lkmEtiksGb8tK1ppSzr/igYAOxU=; b=MA2ygSH17jO01/1TBuTJIFiUeLvsN/8tuUUowTbHHK9LIpELBOdD4Ybmhax/Q60pYJ CagCq+tYF0PDOtxXayrWUlgz5vFu0HsOEr7oeaPb2OcL8RAPpQjxYRSwWpsrKylAKfmS UDPPLDvnJcEwYWDxtY2Gp7BuU8Upz3qalWfqBQRl+ehLtnr7XcQKoQ8KNjBMRmendsQR qFvJWJSUpwuv0g/4UU59oFfIUNmjpxZp+dl4ydwacAam1lmGDDBqjpEbimmLfG2eOFqM d5OgXUnuw4HNhchTF8m1ev0VqTGLXkwZTjC9MiiK/KqaOnspgsjJHk0YgaKMgg2UqsS2 sFKQ== X-Gm-Message-State: ALoCoQmAnsiV+Pdq+SKvdcoUDkG2NaGCPDAogEf6OXnzMAyrRpOhhctHYcQ7oRfmufEOj0Qt6fho MIME-Version: 1.0 X-Received: by 10.152.21.226 with SMTP id y2mr1853036lae.70.1413467602482; Thu, 16 Oct 2014 06:53:22 -0700 (PDT) Received: by 10.152.37.202 with HTTP; Thu, 16 Oct 2014 06:53:22 -0700 (PDT) X-Originating-IP: [98.225.99.138] In-Reply-To: References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> Date: Thu, 16 Oct 2014 07:53:22 -0600 X-Google-Sender-Auth: FedNr4EtS4UzSoFuF_Nv5PgSAeo Message-ID: Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor From: Josh To: Eli Zaretskii Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18739 Cc: 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: josh+gnu@nispio.net 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 (/) >>> The usual technique in Emacs is to put the mark where you were before >>> scrolling. Then "C-x C-x" will get you back. >> This requires the forethought to set the mark before scrolling. > No, you can do it always. I don't understand. If I don't set the mark, how will "C-x C-x" know where to jump back to? I have experimented to see if I can replicate the behavior that you are describing, but I cannot: (Copy many paragraphs of lorem ipsum text to the OS clipboard) $ emacs -Q C-y C-x h M-q C-u 12 C-n M-f M-f SPC H E R E (until the cursor is forced to move) (until the word "HERE" is visible again) C-x C-x This does not jump the cursor back to the word "HERE" which is the behavior that I am looking for. I have also tried setting transient-mark-mode to nil, but it does not do what I want either. So again, I assert my claim that using "C-x C-x" requires that I have the forethought to set the mark before I scroll. Please tell me if I am misunderstanding. On Thu, Oct 16, 2014 at 7:44 AM, Stefan Monnier wrote: >>> >> It would be helpful to have a hook that would be called before any >>> >> scrolling command moves the cursor. In other words, I want to be >>> >> notified when an update to the display will force the location of >>> >> `point' to change in the current buffer. >>> > What's wrong with window-scroll-functions? >>> But these are also called when point is not affected, right? >> Yes. But it's easy to detect that situation, I think. > > Is it? > > I think the main reason why I ask is because I truly have no idea when > window-scroll-functions is called. You seem to be somewhat familiar > with it, so could you try and clarify it in the docstring? > > Currently I see "List of functions to call before redisplaying a window > with scrolling" and "Note that these functions are also called by > `set-window-buffer'". > > Here are some of the questions this brings up for me: > - is it called during set-window-buffer itself, or is it called in the > first redisplay after set-window-buffer? > - what means "redisplaying a window with scrolling" exactly? Does it > mean "redisplay with a different window-start then during the last > redisplay"? Does that include the case where window-start is changed > so as to follow point or is it only the cases where window-start was > changed explicitly by a scrolling command? > - how could a window-scroll-function distinguish the 3 cases: > "set-window-buffer", "used a scroll command", "moved point out of viewport". > > I tried already a few times to understand window-scroll-functions, but > so far it has eluded me. FWIW, I found 3 kinds of uses: > - A crutch from when jit-lock didn't exist (in linum and lazy-lock). > - A way to try and keep a window fully empty showing only point-max by > calling set-window-start with the same window-start (in follow-mode). > Not clear exactly why this should work, and arguably goes against the > warning in window-scroll-functions's docstring. > - Do fancy auto-scrolling in eshell/em-smart (which does exactly what > window-scroll-functions's docstring warns not to do, AFAICT), calling > redisplay internally. > > > Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 10:13:45 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 14:13:45 +0000 Received: from localhost ([127.0.0.1]:46037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeloG-0006Xh-F1 for submit@debbugs.gnu.org; Thu, 16 Oct 2014 10:13:45 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:64042) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeloC-0006XX-V0 for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 10:13:42 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NDJ00400JDYRW00@a-mtaout22.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 17:13:39 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDJ004HBJIRS000@a-mtaout22.012.net.il>; Thu, 16 Oct 2014 17:13:39 +0300 (IDT) Date: Thu, 16 Oct 2014 17:13:41 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <831tq83xwq.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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 (+) > From: Stefan Monnier > Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org > Date: Thu, 16 Oct 2014 09:44:34 -0400 > > >> >> It would be helpful to have a hook that would be called before any > >> >> scrolling command moves the cursor. In other words, I want to be > >> >> notified when an update to the display will force the location of > >> >> `point' to change in the current buffer. > >> > What's wrong with window-scroll-functions? > >> But these are also called when point is not affected, right? > > Yes. But it's easy to detect that situation, I think. > > Is it? I think. > I think the main reason why I ask is because I truly have no idea when > window-scroll-functions is called. You seem to be somewhat familiar > with it, so could you try and clarify it in the docstring? When it's clear what to clarify, I will ;-) > Currently I see "List of functions to call before redisplaying a window > with scrolling" and "Note that these functions are also called by > `set-window-buffer'". That's correct. > Here are some of the questions this brings up for me: > - is it called during set-window-buffer itself, or is it called in the > first redisplay after set-window-buffer? The former, see window.c:set_window_buffer. > - what means "redisplaying a window with scrolling" exactly? Does it > mean "redisplay with a different window-start then during the last > redisplay"? Yes, that's one of the causes. For example, if point moved outside the window. > Does that include the case where window-start is changed > so as to follow point or is it only the cases where window-start was > changed explicitly by a scrolling command? Both. > - how could a window-scroll-function distinguish the 3 cases: > "set-window-buffer", "used a scroll command", "moved point out of viewport". I have no idea (but this is not exactly a question about the doc string). > I tried already a few times to understand window-scroll-functions, but > so far it has eluded me. FWIW, I found 3 kinds of uses: > - A crutch from when jit-lock didn't exist (in linum and lazy-lock). > - A way to try and keep a window fully empty showing only point-max by > calling set-window-start with the same window-start (in follow-mode). > Not clear exactly why this should work, and arguably goes against the > warning in window-scroll-functions's docstring. > - Do fancy auto-scrolling in eshell/em-smart (which does exactly what > window-scroll-functions's docstring warns not to do, AFAICT), calling > redisplay internally. Did the above clarifications help you? From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 10:25:19 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 14:25:19 +0000 Received: from localhost ([127.0.0.1]:46047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XelzT-00087W-6H for submit@debbugs.gnu.org; Thu, 16 Oct 2014 10:25:19 -0400 Received: from mtaout28.012.net.il ([80.179.55.184]:34173) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XelzQ-00087L-4v for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 10:25:17 -0400 Received: from conversion-daemon.mtaout28.012.net.il by mtaout28.012.net.il (HyperSendmail v2007.08) id <0NDJ00E00J1QRG00@mtaout28.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 17:23:28 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout28.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDJ00E7AJZ49T30@mtaout28.012.net.il>; Thu, 16 Oct 2014 17:23:28 +0300 (IDT) Date: Thu, 16 Oct 2014 17:25:16 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: josh+gnu@nispio.net Message-id: <83zjcw2isz.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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, 16 Oct 2014 07:53:22 -0600 > From: Josh > Cc: 18739@debbugs.gnu.org > > >>> The usual technique in Emacs is to put the mark where you were before > >>> scrolling. Then "C-x C-x" will get you back. > > >> This requires the forethought to set the mark before scrolling. > > > No, you can do it always. > > I don't understand. If I don't set the mark, how will "C-x C-x" know > where to jump back to? I meant set the mark as part of the command that is run by the wheel scroll, or manually just before you scroll. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 10:35:07 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 14:35:08 +0000 Received: from localhost ([127.0.0.1]:46051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xem8x-0008Mj-8g for submit@debbugs.gnu.org; Thu, 16 Oct 2014 10:35:07 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:59433) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xem8u-0008Ma-To for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 10:35:05 -0400 Received: by mail-la0-f47.google.com with SMTP id pv20so2951134lab.20 for <18739@debbugs.gnu.org>; Thu, 16 Oct 2014 07:35:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=JAKcrbQjVDuoWq3lhf7/el4wgD2ACxie1hvCKROejZg=; b=XAFq+Y0OjN+K+idAmOft3WJX4LxwPglF8bNqw9OcJQLjsQ7kcnZ71OWS8uNuvOJFuj AcTpgfOyyWNtywNsf3rUptk/fitCCyJpMjJ1mRglDTSLXBdV1l+AO8M52tML39Ta1+bI gsT1udzbTMDa+0RQL03oU2pwyoi/+msjO5Zyj5A5Hx/nytJCRODw4EQVXJsqvtLxIJuV bRpYrHZeObElYVZYVsRTsRFWkMN3poUutlQITs/LAQM/VHwE1Y+12M/X0Su/80e1pB9I RvuYitTPhKNcSJI7HafqsP9/kVomk5ybpWiCR2Fnd6sPDLsare7a8CIkUyURWAcUQ4GT k3MQ== X-Gm-Message-State: ALoCoQk/equmHiV3AQgOtQedEM4s6u8kTaCCyWYg6/ki/60bzYCZ5lvXa8ZIuDGj5p5oQ6zD01iD MIME-Version: 1.0 X-Received: by 10.112.118.229 with SMTP id kp5mr1937600lbb.99.1413470103797; Thu, 16 Oct 2014 07:35:03 -0700 (PDT) Received: by 10.152.37.202 with HTTP; Thu, 16 Oct 2014 07:35:03 -0700 (PDT) X-Originating-IP: [98.225.99.138] In-Reply-To: <83zjcw2isz.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <83zjcw2isz.fsf@gnu.org> Date: Thu, 16 Oct 2014 08:35:03 -0600 X-Google-Sender-Auth: KZFLuBhnGiC2fgYb4YvZiGoDIq8 Message-ID: Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor From: Josh To: Eli Zaretskii Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18739 Cc: 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: josh+gnu@nispio.net 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 (/) On Thu, Oct 16, 2014 at 8:25 AM, Eli Zaretskii wrote: >> >>> The usual technique in Emacs is to put the mark where you were before >> >>> scrolling. Then "C-x C-x" will get you back. >> >> >> This requires the forethought to set the mark before scrolling. >> >> > No, you can do it always. >> >> I don't understand. If I don't set the mark, how will "C-x C-x" know >> where to jump back to? > > I meant set the mark as part of the command that is run by the wheel > scroll, or manually just before you scroll. If I configure the scroll wheel to set the mark every time I use it, then imagine how many times I might have to pop the mark to get back where I started if I scrolled down multiple screens. This is not practical. And telling me to set the mark manually before I scroll is avoiding the issue. I want to know where the cursor was *the last time I used it*, and be able to easily jump back to that spot. On Thu, Oct 16, 2014 at 8:25 AM, Eli Zaretskii wrote: >> Date: Thu, 16 Oct 2014 07:53:22 -0600 >> From: Josh >> Cc: 18739@debbugs.gnu.org >> >> >>> The usual technique in Emacs is to put the mark where you were before >> >>> scrolling. Then "C-x C-x" will get you back. >> >> >> This requires the forethought to set the mark before scrolling. >> >> > No, you can do it always. >> >> I don't understand. If I don't set the mark, how will "C-x C-x" know >> where to jump back to? > > I meant set the mark as part of the command that is run by the wheel > scroll, or manually just before you scroll. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 10:46:37 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 14:46:37 +0000 Received: from localhost ([127.0.0.1]:46055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XemK4-0000Ev-On for submit@debbugs.gnu.org; Thu, 16 Oct 2014 10:46:37 -0400 Received: from mtaout20.012.net.il ([80.179.55.166]:50745) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XemK0-0000Eh-K4 for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 10:46:34 -0400 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NDJ00300KF22K00@a-mtaout20.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 17:46:30 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDJ003U6L1I2G10@a-mtaout20.012.net.il>; Thu, 16 Oct 2014 17:46:30 +0300 (IDT) Date: Thu, 16 Oct 2014 17:46:32 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: josh+gnu@nispio.net Message-id: <83y4sg2htj.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <83zjcw2isz.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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, 16 Oct 2014 08:35:03 -0600 > From: Josh > Cc: 18739@debbugs.gnu.org > > > I meant set the mark as part of the command that is run by the wheel > > scroll, or manually just before you scroll. > > If I configure the scroll wheel to set the mark every time I use it, > then imagine how many times I might have to pop the mark to get back > where I started if I scrolled down multiple screens. If repeated use of mouse-wheel scroll is the issue, you can avoid multiple settings or the mark by looking at last-command and this-command. There are already Emacs commands that behave differently depending on whether they are repeated or not; one prominent example is C-n and C-p. So there are examples you could study to see how this technique is applied. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 10:58:31 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 14:58:31 +0000 Received: from localhost ([127.0.0.1]:46081 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XemVa-0000YO-AX for submit@debbugs.gnu.org; Thu, 16 Oct 2014 10:58:30 -0400 Received: from mail-lb0-f171.google.com ([209.85.217.171]:40020) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XemVX-0000YF-LN for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 10:58:28 -0400 Received: by mail-lb0-f171.google.com with SMTP id z12so2951498lbi.2 for <18739@debbugs.gnu.org>; Thu, 16 Oct 2014 07:58:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=8syVti9Cql0ZhL0ObAvV/UcDAR3fAi46GM1fKqMqHp0=; b=XV0SS9xJ7Rs9UhGwOcPUojvaM9InG+iG32GHfq83lh6UIPHfznhKdOzWOm9KPXeBkH I0IxeHdyy8BbtedpFN6JC33o2t2h4A1inIsNbVJSCUD3BXwRogXfd/HRu3XY82oROAf3 FPegJV5fD7uI7hY5lqeinR+g0A0N0y9HyTZ6djTL6h59EOaSF2WmfOb1Xb10pnAEDv6O jH1dLyQMctto/kxf1F125roX9KmKQVFGm1yOOfm7hCZqaJXbawMCeZUme2FaYXUYIW6t /pcbGjkhUcrDaxVGDwliBnaNwD/cXRuEqiBTAPu4y/csvt8+s9NI+o9G5YVOAGbFm4HT vClA== X-Gm-Message-State: ALoCoQlcHT4R8oNaQGa1rD2TwOERO+bmVpUmT01W6D6HA/ZBKCdg3I5ewkSfZepZZgfLr6T4o++w MIME-Version: 1.0 X-Received: by 10.152.178.197 with SMTP id da5mr2150250lac.83.1413471505857; Thu, 16 Oct 2014 07:58:25 -0700 (PDT) Received: by 10.152.37.202 with HTTP; Thu, 16 Oct 2014 07:58:25 -0700 (PDT) X-Originating-IP: [98.225.99.138] In-Reply-To: <83y4sg2htj.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <83zjcw2isz.fsf@gnu.org> <83y4sg2htj.fsf@gnu.org> Date: Thu, 16 Oct 2014 08:58:25 -0600 X-Google-Sender-Auth: FEiLliSwJBtkZW-WSQxwRnhuGcg Message-ID: Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor From: Josh To: Eli Zaretskii Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18739 Cc: 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: josh+gnu@nispio.net 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 (/) On Thu, Oct 16, 2014 at 8:46 AM, Eli Zaretskii wrote: >> > I meant set the mark as part of the command that is run by the wheel >> > scroll, or manually just before you scroll. >> >> If I configure the scroll wheel to set the mark every time I use it, >> then imagine how many times I might have to pop the mark to get back >> where I started if I scrolled down multiple screens. > > If repeated use of mouse-wheel scroll is the issue, you can avoid > multiple settings or the mark by looking at last-command and > this-command. There are already Emacs commands that behave > differently depending on whether they are repeated or not; one > prominent example is C-n and C-p. So there are examples you could > study to see how this technique is applied. I feel like this conversation is missing the point (no pun intended). Let me restate the problem: I am looking for a way to maintain cursor position within a buffer, even when other events cause that position to be moved beyond the edges of the window. There are so many ways that this can happen that it is not possible to advise every function that might do it. It is possible that window-scroll-functions will give me everything I need, but I haven't had time to try it yet. We can resume this conversation at such a time, unless there is someone else who already knows that window-scroll-functions will not work. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 11:00:24 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 15:00:24 +0000 Received: from localhost ([127.0.0.1]:46085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XemXO-0000cu-JN for submit@debbugs.gnu.org; Thu, 16 Oct 2014 11:00:23 -0400 Received: from mtaout24.012.net.il ([80.179.55.180]:55485) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XemXM-0000ck-39 for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 11:00:21 -0400 Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0NDJ00O00KNET400@mtaout24.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 17:53:52 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDJ00G06LDSNTA0@mtaout24.012.net.il>; Thu, 16 Oct 2014 17:53:52 +0300 (IDT) Date: Thu, 16 Oct 2014 18:00:20 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: josh+gnu@nispio.net Message-id: <83vbnk2h6j.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <83zjcw2isz.fsf@gnu.org> <83y4sg2htj.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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, 16 Oct 2014 08:58:25 -0600 > From: Josh > Cc: 18739@debbugs.gnu.org > > Let me restate the problem: I am looking for a way to maintain cursor > position within a buffer, even when other events cause that position > to be moved beyond the edges of the window. > > There are so many ways that this can happen that it is not possible to > advise every function that might do it. It is possible that > window-scroll-functions will give me everything I need, but I haven't > had time to try it yet. We can resume this conversation at such a > time, unless there is someone else who already knows that > window-scroll-functions will not work. Sorry, I thought you only wanted this with a few specific commands. AFAIR, you never mentioned anything but the mouse-wheel scroll. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 11:14:02 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 15:14:03 +0000 Received: from localhost ([127.0.0.1]:46094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xemkb-0000xa-PE for submit@debbugs.gnu.org; Thu, 16 Oct 2014 11:14:02 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:18215) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xemka-0000xE-6o for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 11:14:00 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOegeEOASpGYFqgXGBWyE X-IPAS-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOegeEOASpGYFqgXGBWyE X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="94354460" Received: from 69-196-168-232.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.232]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 Oct 2014 11:13:59 -0400 Received: by pastel.home (Postfix, from userid 20848) id 2D3A385A2; Thu, 16 Oct 2014 11:13:59 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor Message-ID: References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <831tq83xwq.fsf@gnu.org> Date: Thu, 16 Oct 2014 11:13:59 -0400 In-Reply-To: <831tq83xwq.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 Oct 2014 17:13:41 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org 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 (/) >> Does that include the case where window-start is changed >> so as to follow point or is it only the cases where window-start was >> changed explicitly by a scrolling command? > Both. So, could we say that this hook is supposed to be run if and only if the window-start marker is changed? E.g. it is not called if the only change is that text has been inserted before window-start (hence the numeric value of window-start would be changed, but the marker still points to the same place). Of course, like most such hooks, it's OK if there are occasional false positives (i.e. the hook is run even unnecessarily). And as for "when" it is run: any time after the marker's modification and before updating the glyph matrices? Is it run before or after computing the new mode-line (i.e. if the hook changes something that affects the mode-line, will that be reflected right away, or will it be delayed until the next redisplay)? >> - how could a window-scroll-function distinguish the 3 cases: >> "set-window-buffer", "used a scroll command", "moved point out of viewport". > I have no idea (but this is not exactly a question about the doc > string). So, w.r.t the original question in the bug-report, we still don't have an answer. Do you happen to know where is the C code that changes point (in response to scrolling) in the redisplay? > Did the above clarifications help you? Yes, thanks. I still don't really understand how/why follow-mode and em-smart.el work, tho. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 11:32:42 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 15:32:42 +0000 Received: from localhost ([127.0.0.1]:46108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xen2g-0001Rn-3J for submit@debbugs.gnu.org; Thu, 16 Oct 2014 11:32:42 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:63529) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xen2c-0001RY-Qi for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 11:32:39 -0400 Received: by mail-lb0-f174.google.com with SMTP id p9so3050851lbv.33 for <18739@debbugs.gnu.org>; Thu, 16 Oct 2014 08:32:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:sender:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=Uchj/6vx6Wofvpbo83avLSZcXNZ5AsU1SxllTRIuMgo=; b=kXsmN/+yEOLP3oidsp6Zb/leOmVE2n99NZDkmV3+8U2VsuWa9nhhKhLSQl/yNlgiiN kv9UCLn1EABSGHf6XcOE+O9/xLuXnKy6RjoAM2hev49EsnNo4DbTekzZjW3ELRLO6svN oORkKlvnDnmVRoIkSpYJjOdq3/GazoqMB8kUBC8LnstFuR+CruD4g/RDTI2eGvipqdUd tiNsm2vii9z/B6jYtnofPJF9qa6as+O7U3AUrQFRI9LzXmF8q32+zdOpgz+2DWgaHQRM /eFKs4wwp0FXcbTT1YkYOUQaU1mqQ1vmASvfTrp0gbKsA5wX1ql9VD6PGE5ValRhcZoM fCaQ== X-Gm-Message-State: ALoCoQmV+wGwuTprPzsZOShlckGnDPQ4/nGoPgy1QRwR/OCgHPCIO8PzAd+qjhHKMSnGpMY4N9jf MIME-Version: 1.0 X-Received: by 10.112.221.226 with SMTP id qh2mr2462858lbc.5.1413473557560; Thu, 16 Oct 2014 08:32:37 -0700 (PDT) Received: by 10.152.37.202 with HTTP; Thu, 16 Oct 2014 08:32:37 -0700 (PDT) X-Originating-IP: [98.225.99.138] In-Reply-To: References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <831tq83xwq.fsf@gnu.org> Date: Thu, 16 Oct 2014 09:32:37 -0600 X-Google-Sender-Auth: pJr1GwLPoLnQeWoCuDDeZ2-fsBw Message-ID: Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor From: Josh To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 18739 Cc: Eli Zaretskii , 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: josh+gnu@nispio.net 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 (/) On Thu, Oct 16, 2014 at 9:00 AM, Eli Zaretskii wrote: >> There are so many ways that this can happen that it is not possible to >> advise every function that might do it. It is possible that >> window-scroll-functions will give me everything I need, but I haven't >> had time to try it yet. We can resume this conversation at such a >> time, unless there is someone else who already knows that >> window-scroll-functions will not work. > > Sorry, I thought you only wanted this with a few specific commands. > AFAIR, you never mentioned anything but the mouse-wheel scroll. Sorry if I was not clear. The request in the original bug-report was actually: > I want to be notified when an update to the display will force the location of > `point' to change in the current buffer. On Thu, Oct 16, 2014 at 9:13 AM, Stefan Monnier wrote: > So, w.r.t the original question in the bug-report, we still don't have > an answer. Do you happen to know where is the C code that changes point > (in response to scrolling) in the redisplay? I think you may be confusing the bug-report with my question on StackOverflow. :) On Thu, Oct 16, 2014 at 9:13 AM, Stefan Monnier wrote: >>> Does that include the case where window-start is changed >>> so as to follow point or is it only the cases where window-start was >>> changed explicitly by a scrolling command? >> Both. > > So, could we say that this hook is supposed to be run if and only if > the window-start marker is changed? > > E.g. it is not called if the only change is that text has been inserted > before window-start (hence the numeric value of window-start would be > changed, but the marker still points to the same place). > > Of course, like most such hooks, it's OK if there are occasional false > positives (i.e. the hook is run even unnecessarily). > > And as for "when" it is run: any time after the marker's modification > and before updating the glyph matrices? Is it run before or after > computing the new mode-line (i.e. if the hook changes something that > affects the mode-line, will that be reflected right away, or will it be > delayed until the next redisplay)? > >>> - how could a window-scroll-function distinguish the 3 cases: >>> "set-window-buffer", "used a scroll command", "moved point out of viewport". >> I have no idea (but this is not exactly a question about the doc >> string). > > So, w.r.t the original question in the bug-report, we still don't have > an answer. Do you happen to know where is the C code that changes point > (in response to scrolling) in the redisplay? > >> Did the above clarifications help you? > > Yes, thanks. I still don't really understand how/why follow-mode and > em-smart.el work, tho. > > > Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 11:54:04 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 15:54:04 +0000 Received: from localhost ([127.0.0.1]:46137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XenNL-00021X-Oy for submit@debbugs.gnu.org; Thu, 16 Oct 2014 11:54:04 -0400 Received: from mtaout29.012.net.il ([80.179.55.185]:54324) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XenNH-000215-P7 for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 11:54:01 -0400 Received: from conversion-daemon.mtaout29.012.net.il by mtaout29.012.net.il (HyperSendmail v2007.08) id <0NDJ00N00NL3FL00@mtaout29.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 18:52:56 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout29.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDJ00J7GO48VF50@mtaout29.012.net.il>; Thu, 16 Oct 2014 18:52:56 +0300 (IDT) Date: Thu, 16 Oct 2014 18:54:00 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <83r3y82ep3.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <831tq83xwq.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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 (+) > From: Stefan Monnier > Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org > Date: Thu, 16 Oct 2014 11:13:59 -0400 > > >> Does that include the case where window-start is changed > >> so as to follow point or is it only the cases where window-start was > >> changed explicitly by a scrolling command? > > Both. > > So, could we say that this hook is supposed to be run if and only if > the window-start marker is changed? I don't think so, because set-window-buffer and split-window-internal run the hook unconditionally, i.e. they don't check whether the window-start changed. > E.g. it is not called if the only change is that text has been > inserted before window-start (hence the numeric value of > window-start would be changed, but the marker still points to the > same place). As long as the old window-start is valid and point is in view, I don't think the hook will be called, no. But note that inserting text before window-start could cause scrolling, if window-start was originally in a continued line, or if text was added at the beginning of the line that was the window-start. > And as for "when" it is run: any time after the marker's modification > and before updating the glyph matrices? Yes. > Is it run before or after computing the new mode-line Before. > >> - how could a window-scroll-function distinguish the 3 cases: > >> "set-window-buffer", "used a scroll command", "moved point out of viewport". > > I have no idea (but this is not exactly a question about the doc > > string). > > So, w.r.t the original question in the bug-report, we still don't have > an answer. I actually don't really understand what was the question anymore, see the other thread of discussion. > Do you happen to know where is the C code that changes point > (in response to scrolling) in the redisplay? The part that begins under the force_start label in redisplay_window, and is conditioned by the window's force_start flag. > > Did the above clarifications help you? > > Yes, thanks. I still don't really understand how/why follow-mode and > em-smart.el work, tho. Who does? ;-) From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 15:28:26 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 19:28:26 +0000 Received: from localhost ([127.0.0.1]:46218 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xeqio-0000NA-7V for submit@debbugs.gnu.org; Thu, 16 Oct 2014 15:28:26 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:58568) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xeqim-0000Mw-0v for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 15:28:25 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOegeEOASUYpQ3gWqBcYFbIQ X-IPAS-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOegeEOASUYpQ3gWqBcYFbIQ X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="94378497" Received: from 69-196-168-232.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.232]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 Oct 2014 15:28:23 -0400 Received: by pastel.home (Postfix, from userid 20848) id 169E885A2; Thu, 16 Oct 2014 15:28:23 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor Message-ID: References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <831tq83xwq.fsf@gnu.org> <83r3y82ep3.fsf@gnu.org> Date: Thu, 16 Oct 2014 15:28:23 -0400 In-Reply-To: <83r3y82ep3.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 Oct 2014 18:54:00 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org 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 (/) >> So, could we say that this hook is supposed to be run if and only if >> the window-start marker is changed? > I don't think so, because set-window-buffer and split-window-internal > run the hook unconditionally, i.e. they don't check whether the > window-start changed. If the marker used to point into another buffer, it is clearly changed, so the only problem is that the hook may be run a few more times than necessary, e.g. if you set-window-buffer to the buffer that's already displayed in that window. I think this "definition" of the behavior of window-scroll-functions is more useful/precise. >> E.g. it is not called if the only change is that text has been >> inserted before window-start (hence the numeric value of >> window-start would be changed, but the marker still points to the >> same place). > As long as the old window-start is valid and point is in view, I don't > think the hook will be called, no. Good. Consistent with my definition. > But note that inserting text before window-start could cause > scrolling, if window-start was originally in a continued line, or if > text was added at the beginning of the line that was the window-start. Right, in which case window-start would be modified by the redisplay in order to perform the scrolling and window-scroll-functions would be run, right? So, again, consistent with my definition. >> And as for "when" it is run: any time after the marker's modification >> and before updating the glyph matrices? > Yes. >> Is it run before or after computing the new mode-line > Before. Good, thanks. >> Do you happen to know where is the C code that changes point >> (in response to scrolling) in the redisplay? > The part that begins under the force_start label in redisplay_window, > and is conditioned by the window's force_start flag. Right, I see it (in xdisp.c) after the comment that says: /* If we need to move point for either of the above reasons, now actually do it. */ Playing with it, I see that this code is triggered very rarely. `scroll-up' doesn't go through this at all. We also "set point in response to scrolling" in window_scroll_line_based and in window_scroll_pixel_based. There might be others. >> Yes, thanks. I still don't really understand how/why follow-mode and >> em-smart.el work, tho. > Who does? ;-) I think I'm beginning to understand why follow-mode's use of window-scroll-functions works most of the time. I think it relies on the fact that it will first be called on window W1 even though the window it cares about is W2, so it gets to (set-window-start W2 (point-max)) before redisplay gets a chance to change W2's window-start, and afterwards, redisplay can't do that because of force_start. And this "sticks" long enough to end a redisplay cycle. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 16:28:50 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 20:28:50 +0000 Received: from localhost ([127.0.0.1]:46287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XerfF-000219-Nu for submit@debbugs.gnu.org; Thu, 16 Oct 2014 16:28:50 -0400 Received: from mtaout27.012.net.il ([80.179.55.183]:50550) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XerfC-00020y-Ef for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 16:28:48 -0400 Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NDK0010001X8N00@mtaout27.012.net.il> for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 23:23:35 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDK001QE0NAQT10@mtaout27.012.net.il>; Thu, 16 Oct 2014 23:23:35 +0300 (IDT) Date: Thu, 16 Oct 2014 23:28:47 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <83d29r3gjk.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <831tq83xwq.fsf@gnu.org> <83r3y82ep3.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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 (+) > From: Stefan Monnier > Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org > Date: Thu, 16 Oct 2014 15:28:23 -0400 > > >> So, could we say that this hook is supposed to be run if and only if > >> the window-start marker is changed? > > I don't think so, because set-window-buffer and split-window-internal > > run the hook unconditionally, i.e. they don't check whether the > > window-start changed. > > If the marker used to point into another buffer, it is clearly changed, > so the only problem is that the hook may be run a few more times than > necessary, e.g. if you set-window-buffer to the buffer that's already > displayed in that window. Those few more times are in direct contradiction to the definition you suggested. If you don't care about that, what would be the purpose of the definition? > >> E.g. it is not called if the only change is that text has been > >> inserted before window-start (hence the numeric value of > >> window-start would be changed, but the marker still points to the > >> same place). > > As long as the old window-start is valid and point is in view, I don't > > think the hook will be called, no. > > Good. Consistent with my definition. > > > But note that inserting text before window-start could cause > > scrolling, if window-start was originally in a continued line, or if > > text was added at the beginning of the line that was the window-start. > > Right, in which case window-start would be modified by the redisplay in > order to perform the scrolling and window-scroll-functions would be run, > right? So, again, consistent with my definition. Sorry, I'm lost. I no longer understand what "consistency" is being praised here. For that matter, I probably don't understand what you mean by window-start "modified" and "unmodified", as you seem to employ contradicting meanings: one when the marker moves but points to the same text, the other when it doesn't move, but points to a different text. > >> Do you happen to know where is the C code that changes point > >> (in response to scrolling) in the redisplay? > > The part that begins under the force_start label in redisplay_window, > > and is conditioned by the window's force_start flag. > > Right, I see it (in xdisp.c) after the comment that says: > > /* If we need to move point for either of the above reasons, > now actually do it. */ > > Playing with it, I see that this code is triggered very rarely. As it should be. It is mainly meant for scrolling commands. > `scroll-up' doesn't go through this at all. scroll-up calls window_scroll, which calls window_scroll_pixel_based, which does set the force_start flag of the window, and thus does trigger this portion of redisplay_window. The force_start flag is _the_ way by which scrolling commands work: they tell redisplay to heed to what they did. > We also "set point in response to scrolling" in window_scroll_line_based > and in window_scroll_pixel_based. Which are called by scroll-up etc. > There might be others. Should be mostly (or only) scrolling commands. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 16 17:24:46 2014 Received: (at 18739) by debbugs.gnu.org; 16 Oct 2014 21:24:46 +0000 Received: from localhost ([127.0.0.1]:46423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XesXN-0003oe-Pj for submit@debbugs.gnu.org; Thu, 16 Oct 2014 17:24:46 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:51848) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XesXM-0003oW-47 for 18739@debbugs.gnu.org; Thu, 16 Oct 2014 17:24:44 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOFmQHhDgEqRmBaoFxgVshgSw X-IPAS-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOFmQHhDgEqRmBaoFxgVshgSw X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="94386476" Received: from 69-196-168-232.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.232]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 Oct 2014 17:24:43 -0400 Received: by pastel.home (Postfix, from userid 20848) id 33E3A85A2; Thu, 16 Oct 2014 17:24:43 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor Message-ID: References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <831tq83xwq.fsf@gnu.org> <83r3y82ep3.fsf@gnu.org> <83d29r3gjk.fsf@gnu.org> Date: Thu, 16 Oct 2014 17:24:43 -0400 In-Reply-To: <83d29r3gjk.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 16 Oct 2014 23:28:47 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org 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 (/) > Those few more times are in direct contradiction to the definition you > suggested. If you don't care about that, what would be the purpose of > the definition? To know when you can be sure that it should be called and when it might not be called. Most of our hooks that react to changes (like window-configuration-change-hook, menu-bar-update-hook, ...) have the property that they may be called unnecessarily. As long as it's not too frequent, it shouldn't be a problem. It's still useful to know when it should be run and when it shouldn't, so that when we find a bug we can tell whether it's in the hook function or in the caller of the hook. > Sorry, I'm lost. I no longer understand what "consistency" is being > praised here. For that matter, I probably don't understand what you > mean by window-start "modified" and "unmodified", as you seem to > employ contradicting meanings: one when the marker moves but points to > the same text, the other when it doesn't move, but points to a > different text. Maybe I misunderstood your examples, but by "marker moves" I mean that something has done a set-marker: changes to marker-position due to insertion/deletion of text doesn't count as moving the marker. AFAICT all your examples indicate that window-scroll-functions is called if and only if the marker is moved (plus a few spurious calls where we didn't realize that the change was really a no-op). >> Playing with it, I see that this code is triggered very rarely. > As it should be. It is mainly meant for scrolling commands. By "rarely" I meant, "rarely even while scrolling". The only "normal" case where it seems to be triggered is if I scroll by moving the scrollbar's thumb. >> `scroll-up' doesn't go through this at all. > scroll-up calls window_scroll, which calls window_scroll_pixel_based, > which does set the force_start flag of the window, and thus does > trigger this portion of redisplay_window. But by the time redisplay happens, window_scroll_pixel_based has already moved point within the viewport, so the redisplay itself doesn't change point (tho there might be corner cases where window_scroll_pixel_based ends up putting point outside the viewport, of course). > The force_start flag is _the_ way by which scrolling commands work: > they tell redisplay to heed to what they did. Yes, but the force_start flag rarely causes point to be moved, in my experience. >> There might be others. > Should be mostly (or only) scrolling commands. I'm not sure I understand. If I want to catch all (i.e. exhaustively) cases where scrolling moves point, do you think that catching the redisplay_window case plus the window_scroll_pixel/line_based cases is all that's needed? Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 17 02:38:45 2014 Received: (at 18739) by debbugs.gnu.org; 17 Oct 2014 06:38:45 +0000 Received: from localhost ([127.0.0.1]:46527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xf1BT-000344-Um for submit@debbugs.gnu.org; Fri, 17 Oct 2014 02:38:44 -0400 Received: from mtaout27.012.net.il ([80.179.55.183]:54448) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xf1BM-00033n-Ci for 18739@debbugs.gnu.org; Fri, 17 Oct 2014 02:38:38 -0400 Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NDK00200SIO0000@mtaout27.012.net.il> for 18739@debbugs.gnu.org; Fri, 17 Oct 2014 09:33:25 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDK00M41SVP2W60@mtaout27.012.net.il>; Fri, 17 Oct 2014 09:33:25 +0300 (IDT) Date: Fri, 17 Oct 2014 09:38:38 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <837fzz2ob5.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <831tq83xwq.fsf@gnu.org> <83r3y82ep3.fsf@gnu.org> <83d29r3gjk.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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 (+) > From: Stefan Monnier > Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org > Date: Thu, 16 Oct 2014 17:24:43 -0400 > > > Those few more times are in direct contradiction to the definition you > > suggested. If you don't care about that, what would be the purpose of > > the definition? > > To know when you can be sure that it should be called and when it might > not be called. Most of our hooks that react to changes (like > window-configuration-change-hook, menu-bar-update-hook, ...) have the > property that they may be called unnecessarily. As long as it's not too > frequent, it shouldn't be a problem. It's still useful to know when it > should be run and when it shouldn't, so that when we find a bug we can > tell whether it's in the hook function or in the caller of the hook. I'm not sure I get your point. But if you mean to say something that is already said in the doc string, i.e. List of functions to call before redisplaying a window with scrolling. [...] Note that these functions are also called by `set-window-buffer'. then I'm okay with that. > > Sorry, I'm lost. I no longer understand what "consistency" is being > > praised here. For that matter, I probably don't understand what you > > mean by window-start "modified" and "unmodified", as you seem to > > employ contradicting meanings: one when the marker moves but points to > > the same text, the other when it doesn't move, but points to a > > different text. > > Maybe I misunderstood your examples, but by "marker moves" I mean that > something has done a set-marker: changes to marker-position due to > insertion/deletion of text doesn't count as moving the marker. If you insert text at the beginning of a line whose first character was the window-start, then according to the above definition the marker _will_ move, because Emacs will likely reset it to the new beginning of the line, or maybe even to one of the following lines (the latter if point moves out of the view as result of the insertion). > AFAICT all your examples indicate that window-scroll-functions is called > if and only if the marker is moved (plus a few spurious calls where we > didn't realize that the change was really a no-op). I don't like this "conclusion", because it can be interpreted as meaning that moving the window-start marker _causes_ window-scroll-functions to be called. But actually, there's no causality here; both movement of window-start and a call to window-scroll-functions are side effects of Emacs scrolling the window in some sense. > >> Playing with it, I see that this code is triggered very rarely. > > As it should be. It is mainly meant for scrolling commands. > > By "rarely" I meant, "rarely even while scrolling". The only "normal" > case where it seems to be triggered is if I scroll by moving the > scrollbar's thumb. That's not my reading of the code. (Not sure why it matters, though.) > >> `scroll-up' doesn't go through this at all. > > scroll-up calls window_scroll, which calls window_scroll_pixel_based, > > which does set the force_start flag of the window, and thus does > > trigger this portion of redisplay_window. > > But by the time redisplay happens, window_scroll_pixel_based has already > moved point within the viewport, so the redisplay itself doesn't > change point (tho there might be corner cases where > window_scroll_pixel_based ends up putting point outside the viewport, > of course). If the window's force_start flag is set when redisplay is entered, then my reading of the code is that window-scroll-functions will be called even if point doesn't have to move. And that's okay, because this is how scrolling commands cause window-scroll-functions to be called. You will even see comments to that effect in window.c. Again, I'm not sure why it is important whether the hook is called frequently or not in some situation where it has to be called. > > The force_start flag is _the_ way by which scrolling commands work: > > they tell redisplay to heed to what they did. > > Yes, but the force_start flag rarely causes point to be moved, in > my experience. Maybe so, but (a) I again don't understand why the frequency matters, and (b) my reading of the code is that the hook will be called even if point doesn't need to be repositioned. The hook should be called to reflect the fact that we scrolled, even if point didn't move. > >> There might be others. > > Should be mostly (or only) scrolling commands. > > I'm not sure I understand. If I want to catch all (i.e. exhaustively) > cases where scrolling moves point, do you think that catching the > redisplay_window case plus the window_scroll_pixel/line_based cases is > all that's needed? Yes, I think so. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 17 09:04:08 2014 Received: (at 18739) by debbugs.gnu.org; 17 Oct 2014 13:04:08 +0000 Received: from localhost ([127.0.0.1]:46658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xf7CS-00063C-AO for submit@debbugs.gnu.org; Fri, 17 Oct 2014 09:04:08 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:5432) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xf7CQ-000634-0Z for 18739@debbugs.gnu.org; Fri, 17 Oct 2014 09:04:06 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOegeEOASpGYFqgXGBWyE X-IPAS-Result: ArUGAIDvNVNFxKjo/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOegeEOASpGYFqgXGBWyE X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="94440336" Received: from 69-196-168-232.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.232]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Oct 2014 09:04:05 -0400 Received: by pastel.home (Postfix, from userid 20848) id 33BEE859B; Fri, 17 Oct 2014 09:04:05 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor Message-ID: References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <831tq83xwq.fsf@gnu.org> <83r3y82ep3.fsf@gnu.org> <83d29r3gjk.fsf@gnu.org> <837fzz2ob5.fsf@gnu.org> Date: Fri, 17 Oct 2014 09:04:05 -0400 In-Reply-To: <837fzz2ob5.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 17 Oct 2014 09:38:38 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org 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 (/) > I'm not sure I get your point. But if you mean to say something that > is already said in the doc string, i.e. > List of functions to call before redisplaying a window with scrolling. > [...] Note that these functions are also called by `set-window-buffer'. > then I'm okay with that. No, I'm trying to find a definition that justifies *why* set-window-buffer runs the hook. `set-window-buffer' changes the window-start marker to point into another buffer (except when set-window-buffer is basically a no-op), so saying "the hook is run whenever the window-start marker is modified" does explain why set-window-buffer should run the hook. It also explains why split-window should run the hook. > I don't like this "conclusion", because it can be interpreted as > meaning that moving the window-start marker _causes_ > window-scroll-functions to be called. No, it just means that moving the marker creates the need for Emacs to run the hook. >> >> Playing with it, I see that this code is triggered very rarely. >> > As it should be. It is mainly meant for scrolling commands. >> By "rarely" I meant, "rarely even while scrolling". The only "normal" >> case where it seems to be triggered is if I scroll by moving the >> scrollbar's thumb. > That's not my reading of the code. (Not sure why it matters, though.) I don't understand the code nearly enough, so instead I asked fprintf, and she sounded pretty definitive ;-) > If the window's force_start flag is set when redisplay is entered, > then my reading of the code is that window-scroll-functions will be > called even if point doesn't have to move. I'm not talking about calling window-scroll-functions, I'm talking about moving point (a bit further down in the redisplay_window function). > Maybe so, but (a) I again don't understand why the frequency matters, It doesn't. I was just pointing out that this is not the main place where scrolling moves point. >> I'm not sure I understand. If I want to catch all (i.e. exhaustively) >> cases where scrolling moves point, do you think that catching the >> redisplay_window case plus the window_scroll_pixel/line_based cases is >> all that's needed? > Yes, I think so. OK, thanks, Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 17 09:16:20 2014 Received: (at 18739) by debbugs.gnu.org; 17 Oct 2014 13:16:20 +0000 Received: from localhost ([127.0.0.1]:46678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xf7OE-0006MB-GY for submit@debbugs.gnu.org; Fri, 17 Oct 2014 09:16:19 -0400 Received: from mtaout21.012.net.il ([80.179.55.169]:44035) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xf7OA-0006M0-Oe for 18739@debbugs.gnu.org; Fri, 17 Oct 2014 09:16:16 -0400 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0NDL00H00B8JXB00@a-mtaout21.012.net.il> for 18739@debbugs.gnu.org; Fri, 17 Oct 2014 16:16:12 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDL00HVMBJ0T790@a-mtaout21.012.net.il>; Fri, 17 Oct 2014 16:16:12 +0300 (IDT) Date: Fri, 17 Oct 2014 16:16:05 +0300 From: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor In-reply-to: X-012-Sender: halo1@inter.net.il To: Stefan Monnier Message-id: <83y4se25wq.fsf@gnu.org> References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <831tq83xwq.fsf@gnu.org> <83r3y82ep3.fsf@gnu.org> <83d29r3gjk.fsf@gnu.org> <837fzz2ob5.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii 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 (+) > From: Stefan Monnier > Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org > Date: Fri, 17 Oct 2014 09:04:05 -0400 > > > I'm not sure I get your point. But if you mean to say something that > > is already said in the doc string, i.e. > > > List of functions to call before redisplaying a window with scrolling. > > [...] Note that these functions are also called by `set-window-buffer'. > > > then I'm okay with that. > > No, I'm trying to find a definition that justifies *why* > set-window-buffer runs the hook. `set-window-buffer' changes the > window-start marker to point into another buffer (except when > set-window-buffer is basically a no-op) But set-window-buffer is not a no-op when the buffer doesn't change. Moreover, saying that window-scroll-functions will be called when the window-start marker changes will miss those calls when it didn't, and yet set-window-buffer still called the hook. Maybe we should refrain from calling window-scroll-functions when the buffer doesn't change. > saying "the hook is run whenever the window-start marker is > modified" does explain why set-window-buffer should run the hook. > It also explains why split-window should run the hook. If you mean the fact that a new marker is created for the new window, then yes; but that's a technicality that will not be obvious to semi-naive readers of the documentation, and will probably be unexpected by at least some of them. So either we say that explicitly in the doc string, or we should change split-window-internal not to call the hook. (Can you explain why calling it in split-window-internal might be useful?) > > I don't like this "conclusion", because it can be interpreted as > > meaning that moving the window-start marker _causes_ > > window-scroll-functions to be called. > > No, it just means that moving the marker creates the need for Emacs to run > the hook. That's not what "iff" usually means. Moreover, we could modify the code to do one, but not the other in some cases. They are unrelated. > > If the window's force_start flag is set when redisplay is entered, > > then my reading of the code is that window-scroll-functions will be > > called even if point doesn't have to move. > > I'm not talking about calling window-scroll-functions, I'm talking about > moving point (a bit further down in the redisplay_window function). Well, of course point will be moved only if necessary. But this discussion is about the hook and when it is called, not about adjusting point. > > Maybe so, but (a) I again don't understand why the frequency matters, > > It doesn't. I was just pointing out that this is not the main place > where scrolling moves point. The issue we were discussing was the conditions under which the hook is called, wasn't it? > >> I'm not sure I understand. If I want to catch all (i.e. exhaustively) > >> cases where scrolling moves point, do you think that catching the > >> redisplay_window case plus the window_scroll_pixel/line_based cases is > >> all that's needed? > > Yes, I think so. > > OK, thanks, So what, if anything, needs to be clarified in the docs? From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 17 13:02:54 2014 Received: (at 18739) by debbugs.gnu.org; 17 Oct 2014 17:02:54 +0000 Received: from localhost ([127.0.0.1]:47604 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XfAvU-0003ts-Vp for submit@debbugs.gnu.org; Fri, 17 Oct 2014 13:02:53 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:41029) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XfAvS-0003ti-3D for 18739@debbugs.gnu.org; Fri, 17 Oct 2014 13:02:50 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id C58AD850B6; Fri, 17 Oct 2014 13:02:49 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id D749B1E5B74; Fri, 17 Oct 2014 13:02:17 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id BBD03B422F; Fri, 17 Oct 2014 13:02:17 -0400 (EDT) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor Message-ID: References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <831tq83xwq.fsf@gnu.org> <83r3y82ep3.fsf@gnu.org> <83d29r3gjk.fsf@gnu.org> <837fzz2ob5.fsf@gnu.org> <83y4se25wq.fsf@gnu.org> Date: Fri, 17 Oct 2014 13:02:17 -0400 In-Reply-To: <83y4se25wq.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 17 Oct 2014 16:16:05 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.49, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_REPONSE 0.33, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-Spam-Status: No X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 18739 Cc: josh+gnu@nispio.net, 18739@debbugs.gnu.org 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: -2.3 (--) > But set-window-buffer is not a no-op when the buffer doesn't change. I know, but it's pretty close. > Moreover, saying that window-scroll-functions will be called when the > window-start marker changes will miss those calls when it didn't, and > yet set-window-buffer still called the hook. That is allowed by the rule that says that such hooks may get run unnecessarily at times. > Maybe we should refrain from calling window-scroll-functions when the > buffer doesn't change. I think that would be an improvement, yes. Maybe not an important one, tho. > If you mean the fact that a new marker is created for the new window, > then yes; but that's a technicality that will not be obvious to > semi-naive readers of the documentation, and will probably be > unexpected by at least some of them. Agreed, it's the difference between modification and initialization. So currently the hook is run not just when window-start is modified but also when it's initialized. > (Can you explain why calling it in split-window-internal might > be useful?) Not really, no. I can vaguely understand it for the needs of linum.el and lazy-lock.el, tho in practice the corresponding part of the buffer should already have been displayed (and hence processed), so it's probably not really useful there either. For follow-mode and em-smart, I have no idea since I don't understand how they work. >> > I don't like this "conclusion", because it can be interpreted as >> > meaning that moving the window-start marker _causes_ >> > window-scroll-functions to be called. >> No, it just means that moving the marker creates the need for Emacs to run >> the hook. > That's not what "iff" usually means. Moreover, we could modify the > code to do one, but not the other in some cases. They are unrelated. Of course, window-scroll-functions is never run automatically, it's only ever run because we decide it should be run at that point and hence we put the corresponding call in the code. IOW it's not related to anything by its nature and we could just never run it. But that wouldn't match the user(of window-scroll-functions)'s expectations, would it? Now would the problem be in our code or in the user's expectation? To figure that out, we have to read the docstring, and so far I think the docstring is not precise enough, e.g. because "scrolling" is not clear enough. > Well, of course point will be moved only if necessary. But this > discussion is about the hook and when it is called, not about > adjusting point. This sub-discussion was about my question: Do you happen to know where is the C code that changes point (in response to scrolling) in the redisplay? and your helpful answer to it. > The issue we were discussing was the conditions under which the hook > is called, wasn't it? No, that was another sub-discussion. > So what, if anything, needs to be clarified in the docs? I'll update window-scroll-functions's docstring to explain that it's run whenever the window-start changes. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 27 14:45:59 2022 Received: (at 18739) by debbugs.gnu.org; 27 Apr 2022 18:45:59 +0000 Received: from localhost ([127.0.0.1]:44304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njmfn-00055o-0x for submit@debbugs.gnu.org; Wed, 27 Apr 2022 14:45:59 -0400 Received: from quimby.gnus.org ([95.216.78.240]:45968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njmfl-00055X-AT for 18739@debbugs.gnu.org; Wed, 27 Apr 2022 14:45:58 -0400 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=HyId6JcAcwGjkm6ASzjgy5MHoQQmKpB2EJJHWJO7MAM=; b=jo0149TbdIEAn/KZ8HpYJt66Tq x4JPPS7VaIGP4xKZv54j/8uIqmCOc/YW4M8ND7xfFDqWVqhr6vi8aDxNyhnLwyOcTL/1+B6PfBNaF KM717Lab9Mq51SfXAq6Xi4i2wXzbOOlGHesMrbSFWGMBPHYdKZ0BcKgwgxdNhy65pMHY=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njmfb-0008R9-AK; Wed, 27 Apr 2022 20:45:49 +0200 From: Lars Ingebrigtsen To: Josh Subject: Re: bug#18739: 24.3; Request for a hook to be provided when scrolling will move the cursor References: <83wq813vyx.fsf@gnu.org> <83r3y84iuv.fsf@gnu.org> <83zjcw2isz.fsf@gnu.org> <83y4sg2htj.fsf@gnu.org> X-Now-Playing: Heidi Berry's _Miracle_: "The Mountain" Date: Wed, 27 Apr 2022 20:45:42 +0200 In-Reply-To: (Josh's message of "Thu, 16 Oct 2014 08:58:25 -0600") Message-ID: <875ymuqsa1.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: Josh writes: > There are so many ways that this can happen that it is not possible to > advise every function that might do it. It is possible that > window-scroll-functions will give me everything I need, but I h [...] 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: 18739 Cc: Eli Zaretskii , 18739@debbugs.gnu.org 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 (---) Josh writes: > There are so many ways that this can happen that it is not possible to > advise every function that might do it. It is possible that > window-scroll-functions will give me everything I need, but I haven't > had time to try it yet. We can resume this conversation at such a > time, unless there is someone else who already knows that > window-scroll-functions will not work. (I'm going through old bug reports that unfortunately weren't resolved at the time.) This was seven years ago, but no follow-up happened, as far as I can tell. window-scroll-functions is the variable to use when doing stuff if the window start changes (which will often move point). A more general hook, to be run whenever point changes, would be too heavy, because point movement functions are called all the time and have to be efficient. So I'm therefore 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 Wed Apr 27 14:46:04 2022 Received: (at control) by debbugs.gnu.org; 27 Apr 2022 18:46:04 +0000 Received: from localhost ([127.0.0.1]:44308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njmfs-00056c-8M for submit@debbugs.gnu.org; Wed, 27 Apr 2022 14:46:04 -0400 Received: from quimby.gnus.org ([95.216.78.240]:45994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njmfq-00055f-Ah for control@debbugs.gnu.org; Wed, 27 Apr 2022 14:46:02 -0400 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=HTr1Em0s7NOBj+2aaTHa/rApw9YwLkHSSGUXZo0MJ4s=; b=KdeVbVm0iK0p+v7zjuPrc6dkTQ 0ZhdgLk78s0oKiQXVeOFsXq4sAgNbKXUzF2N3JOlCUMysPASwoAGVjdZeng6VMPi+dQ/XKrugfJF9 +BMFnvwJht6eM5iZoKOjU9oeR1jjjrewjZ8FF5aDE5djqouvjDpdnYdIP6imnshjCG3M=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njmfi-0008RG-QK for control@debbugs.gnu.org; Wed, 27 Apr 2022 20:45:56 +0200 Date: Wed, 27 Apr 2022 20:45:51 +0200 Message-Id: <874k2eqs9s.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #18739 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 18739 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 18739 quit From unknown Wed Jun 25 02:09:28 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 26 May 2022 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator