From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sam Steingold Newsgroups: gmane.emacs.bugs Subject: bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer Date: Thu, 15 Sep 2022 14:30:36 -0400 Message-ID: References: <838rmkzf9m.fsf@gnu.org> Reply-To: sds@gnu.org Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38283"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) Cc: 57837@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 15 20:31:21 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYtdx-0009nt-2C for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Sep 2022 20:31:21 +0200 Original-Received: from localhost ([::1]:51102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYtdw-0002qg-1X for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Sep 2022 14:31:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYtde-0002ok-GJ for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2022 14:31:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oYtde-00081O-4q for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2022 14:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oYtdd-0001co-LB for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2022 14:31:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sam Steingold Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Sep 2022 18:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57837 X-GNU-PR-Package: emacs Original-Received: via spool by 57837-submit@debbugs.gnu.org id=B57837.16632666486224 (code B ref 57837); Thu, 15 Sep 2022 18:31:01 +0000 Original-Received: (at 57837) by debbugs.gnu.org; 15 Sep 2022 18:30:48 +0000 Original-Received: from localhost ([127.0.0.1]:59152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYtdP-0001cK-NW for submit@debbugs.gnu.org; Thu, 15 Sep 2022 14:30:48 -0400 Original-Received: from mail-qt1-f176.google.com ([209.85.160.176]:39876) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYtdM-0001c1-CS for 57837@debbugs.gnu.org; Thu, 15 Sep 2022 14:30:46 -0400 Original-Received: by mail-qt1-f176.google.com with SMTP id s18so11306339qtx.6 for <57837@debbugs.gnu.org>; Thu, 15 Sep 2022 11:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:reply-to:return-receipt-to:user-agent :references:in-reply-to:subject:cc:to:from:sender:from:to:cc:subject :date; bh=Olw0NV6u2Jk10w1ZAAzctK10oBlTfeswSdfrS1ALHkU=; b=mREveTxrxqgZNmDK+2rYMCPvJyEs+1XVxiNaWX+LkMA3MAfXShWpBHTC6UWAkKpEUj 0a0xbzsheTeOGaol6iPdMcPgng6h5MFBPfWb9rZhamFxSJQQEDKPsGmMp8HTAdS+3wMW DXizyPulVc9O17Gk79YrcMt08dONyXkvdLnyDoN2m0o1UAXqaTkvznSKL/KJtp1eM67z WdCfUjXxK50SKJawrjNbxfVeKz4ImbAiAM3Chw0yNgTavhpGnwuUIGOElxYu3cefVGqM AEHJ4Flx00wceE4lcgQYzdrF0GyS+Tx39tJnOc6+q23hmzFdjWqks1v7ENl+/5BvcKLn cTTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:reply-to:return-receipt-to:user-agent :references:in-reply-to:subject:cc:to:from:sender:x-gm-message-state :from:to:cc:subject:date; bh=Olw0NV6u2Jk10w1ZAAzctK10oBlTfeswSdfrS1ALHkU=; b=Q7t58jXVjWXd8aDxKZ8S0t3foLevEEqW4icfG2zeKnGiiahPUHt3EUMbD41+nyv07r iidylrgM3edCopNYNh7pBsn7QxwJ4MNiYtoC43p+szMbK+m2dX4wz33P9AMlsjj8YWcA MA+Q8bKVNONxoToTpI3HwrPGWori6JAwv03yQkrB/wLwnQQSZyThqKorCSUnSH4qPGRu han/hi6YBC03pRfjCklnabQI/rpMKCRt6svXat6kz+W1srhwz7xJ85lrNX8klwhK0Nmn j99wLeZDog32VY/JWC/EwqaDZVLJayTPiQpiV4tc7ywc+0IkF/ooj/LAk4482b0sXFqU Ec+Q== X-Gm-Message-State: ACrzQf1eEMAFMqpGrX4MnyLEOyr2GJ8YUC+APCN9y3ettXT+FX/bokck CCQpdEnfHvhtRsAL+HVofsuudkvXj4T4 X-Google-Smtp-Source: AMsMyM4BxdUB8yOEUFiujfslspsukX3cOdZ7AsPmZSi3rUOzUf3DDY4saTlfXLExX/sbpexXVdRbnA== X-Received: by 2002:a05:622a:138b:b0:35b:b619:b87d with SMTP id o11-20020a05622a138b00b0035bb619b87dmr1196327qtk.146.1663266638813; Thu, 15 Sep 2022 11:30:38 -0700 (PDT) Original-Received: from 3c22fb11fdab.ant.amazon.com (pool-71-125-32-130.nycmny.fios.verizon.net. [71.125.32.130]) by smtp.gmail.com with ESMTPSA id f8-20020a05620a408800b006bb82221013sm5214409qko.0.2022.09.15.11.30.37 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Sep 2022 11:30:38 -0700 (PDT) In-Reply-To: <838rmkzf9m.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 15 Sep 2022 21:03:33 +0300") X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:242628 Archived-At: > * Eli Zaretskii [2022-09-15 21:03:33 +0300]: > >> From: Sam Steingold >> Date: Thu, 15 Sep 2022 13:31:48 -0400 >> >> When the buffer is smaller than the window, move the point to the end >> and do `C-x w -` (fit-window-to-buffer). >> The window shrinks, but it is empty - the whole buffer is above. >> One has to move the point to the beginning-of-buffer to make the buffer >> visible. >> >> I think this is a bug - the window should show the whole buffer; after >> all this is the raison d'etre of `fit-window-to-buffer', right? > > Yes, but by having point at EOB (and assuming the last line ends in a > newline), you've made point be outside of the window's text. Yes, this is a corner case. > Instead of moving point to the end, move it to last line of the > buffer, and then "C-x w -" will leave the entire buffer text on > display. Indeed, this function mostly works. >> Basically, after `fit-window-to-buffer' is called, the following should >> evaluate to t: >> >> --8<---------------cut here---------------start------------->8--- >> (and (pos-visible-in-window-p (point-min)) >> (pos-visible-in-window-p (point-max))) >> --8<---------------cut here---------------end--------------->8--- > > No, because point-max is after the last newline, and thus effectively > one line beyond the window's text. As I said, if `fit-window-to-buffer' has a "contract", it's the invariant above. Violating it, albeit in a corner case, is, IMO, a bug. I am not sure how this should be fixed - either by allowing the point to be outside of the window (if that is possible) or extending the window by 1 extra line in this corner case - but it _should_ be possible to fix it. Thank you. -- Sam Steingold (https://aphar.dreamwidth.org/) on darwin Ns 10.3.2113 https://lastingimpactpsychology.com https://steingoldpsychology.com https://www.peaceandtolerance.org/ https://jihadwatch.org https://camera.org I haven't lost my mind -- it's backed up on tape somewhere.