From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jefferson Carpenter Newsgroups: gmane.emacs.devel Subject: Re: show-enclosing-scopes Date: Fri, 18 May 2018 01:13:05 +0000 Message-ID: <0976c552-b2e7-4f5a-ab66-15dbfb05cbc6@gmail.com> References: <5cb3e5a6-310f-1f2a-ceb8-01b929158ebb@gmail.com> <594F9BDF-F041-4B8D-8425-0BE2AABAA448@gnu.org> <258be7dd-0bf6-f5b1-20d1-08ea65a177e8@gmail.com> <83wow2iamm.fsf@gnu.org> <83o9hehz3c.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1526605919 23429 195.159.176.226 (18 May 2018 01:11:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 18 May 2018 01:11:59 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 18 03:11:55 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJTw2-0005wf-1L for ged-emacs-devel@m.gmane.org; Fri, 18 May 2018 03:11:54 +0200 Original-Received: from localhost ([::1]:35751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJTy7-00013h-FO for ged-emacs-devel@m.gmane.org; Thu, 17 May 2018 21:14:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJTxQ-00013L-IP for emacs-devel@gnu.org; Thu, 17 May 2018 21:13:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJTxP-0003Zm-9x for emacs-devel@gnu.org; Thu, 17 May 2018 21:13:20 -0400 Original-Received: from mail-it0-x22a.google.com ([2607:f8b0:4001:c0b::22a]:36957) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJTxP-0003ZM-3b for emacs-devel@gnu.org; Thu, 17 May 2018 21:13:19 -0400 Original-Received: by mail-it0-x22a.google.com with SMTP id 70-v6so11244088ity.2 for ; Thu, 17 May 2018 18:13:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=2ZPj5iEEv8KtdUUg2gVtSmSsbIXRfDSv1mBMDAYwWrk=; b=HHTl1/cD4hh++Sy8xbUxGCDUWwZQwU0mRGnmkG1As9nsQKfdDHS9z3QXvjrmBtober TCAztL8AMSCniJ4N4rUxSKPUdiRsn6ZdCavTo0a3cCCWrao9i4vK6eanNeatSh0JteAY qxEOtiZNjM+jWrrWP9VSuSd58vsHeSLWLD2ZcV8PoGox2f3vVqD9cOPYHnNEr8YRtvIZ E8nLeO2+Irmqvivp6XGydlqUFu/Yip3aB5vfZ7EdLz0EeVnj4z9GxIUVT+qgqgwOelAo qgaILdgmMrViqhcgLUcwq8nJDinHKKP1VT9yuf2bMizqYsi7MeGlsEZEPFxBiCnnfpRX JmSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2ZPj5iEEv8KtdUUg2gVtSmSsbIXRfDSv1mBMDAYwWrk=; b=sDSxN8rzhbqiWDwt4C8lY/7rlXambN1IfM6Em6m0VBlgHvI/r5j1n+CI3adk20CjXg vsMePOYyOh9mt50gdk9r5zvQUZrZp8eTzwOItRi5kTRph7MhglcGGHLtikLZDJ/NiooX BZ2d2/BIscYdkqe2BTVpY18kH2JCKTGeRy7E6ZIC0IH4dRQYsU89hUHQsN/YFPtAr09S KcYSdN98MEdgkF4Hk4YfiJcHTchT3mIM0v08JofJeiivRU7uFGk+5Btm2u7hBns2Ot9U EefQJiMuVDw6P/WgIul0cjt1qiWnmd+WeajipJGDkdOPKtUW16pGzuUAnptzGNNiCUWM cR6Q== X-Gm-Message-State: ALKqPwdkV9MYKiFEpnL60DKkJby1AK5Y/ohxJw0bgsEgQO3UBdzwCe0c 9jZx6cgucj1I3ZpWqp4lkwOqeIXR X-Google-Smtp-Source: AB8JxZoPo70nFuHD9BrrXHk2yYw0cAdnuC7AcGeqkpRQYvBBmFej/UQkiBp8dbbQWzjN1XscUGKG4A== X-Received: by 2002:a24:6e16:: with SMTP id w22-v6mr5154307itc.67.1526605996574; Thu, 17 May 2018 18:13:16 -0700 (PDT) Original-Received: from ?IPv6:2601:441:8680:4631:2456:9adf:efad:ce31? ([2601:441:8680:4631:2456:9adf:efad:ce31]) by smtp.gmail.com with ESMTPSA id y204-v6sm4048125ioy.88.2018.05.17.18.13.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 May 2018 18:13:15 -0700 (PDT) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::22a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225377 Archived-At: Updated based on suggestions from this thread, thank you all! :D * Delete-window no longer scrolls the view at all (rather sets a variable storing the scopes window's height that can be used to scroll the correct amount later). * Split-window now checks whether, after scrolling the needed amount, point would still be on-screen; if yes, it scrolls, if no, it calls (recenter). * All (goto-char) and (redisplay) calls are removed. It still flickers, though. For posterity, here's a link to the original: https://raw.githubusercontent.com/jeffersoncarpenter/emacs.d/cff2aada902e15affd51b79a0cd16de693f6c4bc/show-enclosing-scope.el New version: https://raw.githubusercontent.com/jeffersoncarpenter/emacs.d/f9dcbe2d7636acedcf60ecb41baa1b3b4650e9a7/show-enclosing-scope.el On 5/17/2018 2:31 PM, Stefan Monnier wrote: > > So you have here an ambiguous specification: on the one hand you > specified the window-start via scroll-up, on the other you specified > point with beginning-of-buffer. Since point needs to be within the > visible part of the buffer, the redisplay engine has to choose which of > the two requests to override. > > Now the question is why does your package end up in situations with such > ambiguous specifications? > > Assuming you don't have any control over the scroll-up part and you want > to override it via beginning-of-buffer, there is indeed currently no > easy way to get that, AFAICT: this is controlled by the `force_start` > field in the window which will have been set by scroll-up (and can be > set via set-window-start) but can't be "unset" directly. That makes sense. Setting the window's `start` position and setting `force_start` to true is probably precisely why scroll-up seems to have effects outside of the elisp thunk is in, since these variables are never un-set, and are read come the next redisplay cycle. On 5/17/2018 3:07 PM, Eli Zaretskii wrote:>> From: Stefan Monnier >> Date: Thu, 17 May 2018 10:31:44 -0400 > >> Now the question is why does your package end up in situations with such >> ambiguous specifications? > > I don't understand that, either. I looked at the relevant code in the > package, and my interpretation is this: > > . scroll-up/down is used to prevent text in the window from moving > vertically when the window showing the scopes is deleted: without > the scroll, text would move up, since the window to be deleted is > above the window showing the current buffer. (Why the scopes > window needs to be deleted and recreated anew each command, and > why is it shown above and not below, are two other relevant > questions, but let's assume it's indeed required.) Correct, scroll-up/down is used to prevent text in the main window from moving vertically when the scopes window is deleted or resized. The window is deleted in pre-command-hook so that commands like (switch-window), (balance-windows), and so on do not switch to or balance with the scopes window. However, I'll probably actually change it to use either overlays or header-line-format, since those seem lighter, and I strongly suspect that deleting and recreating the window is what causes the remaining flickering. Why it's shown above and not below is strictly UX - it's because in the source file, the text that is shown in the scopes window is above your buffer position and not below it.