From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#57837: 29.0.50; fit-window-to-buffer should reposition the buffer Date: Thu, 15 Sep 2022 21:03:33 +0300 Message-ID: <838rmkzf9m.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27478"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57837@debbugs.gnu.org To: sds@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 15 20:05:15 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 1oYtEh-0006vy-3s for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Sep 2022 20:05:15 +0200 Original-Received: from localhost ([::1]:58992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYtEg-0008WT-3F for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Sep 2022 14:05:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYtDX-0008DK-PY for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2022 14:04:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42213) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oYtDW-0001oX-HY for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2022 14:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oYtDW-0000x2-6B for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2022 14:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Sep 2022 18:04:02 +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.16632650313639 (code B ref 57837); Thu, 15 Sep 2022 18:04:02 +0000 Original-Received: (at 57837) by debbugs.gnu.org; 15 Sep 2022 18:03:51 +0000 Original-Received: from localhost ([127.0.0.1]:59145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYtDL-0000wd-91 for submit@debbugs.gnu.org; Thu, 15 Sep 2022 14:03:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYtDJ-0000wK-E3 for 57837@debbugs.gnu.org; Thu, 15 Sep 2022 14:03:49 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:60240) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYtDB-0001lE-VV; Thu, 15 Sep 2022 14:03:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ZsHv8dcwlB8mYLi0GvL5CU4hxDOmlEgaPnz9pS0ub14=; b=RyFejmiXY4s+ kyBOvh5jmjHO4uU0m6C4zdTPYPZn54b6E3eFhasNZ//MQp6z8YIYyyiCbODm5HL/FWvVwfzb8yaHg QC1CpzBVIY6cybVoYeiWM9YdZy0zqYTzTHhI66yOxHwEHtFFu+GgfPO44xMRh/SC07ZK8gJwR6QXl HGDIaAAreJm7+QtR+yp6sGAhYXuX430VsaS7Hoao2PcMhf403uLyHTkzLJ0dcpkKs2ZSNLdVgctBJ tOp+Q4Qu2CVk3WuejINSgGV2tKk40gQLSZAEhtz+tvKMjXQk//OYszn0IYBPY9HneG3+m5gqifIm2 Uk5F0NGyOOcgF5zUMqKtGg==; Original-Received: from [87.69.77.57] (port=4121 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYtDB-0002qN-Bm; Thu, 15 Sep 2022 14:03:41 -0400 In-Reply-To: (message from Sam Steingold on Thu, 15 Sep 2022 13:31:48 -0400) 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:242627 Archived-At: > 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. 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. So I don't think there's a bug here. > 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.