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: Fri, 16 Sep 2022 17:25:18 -0400 Message-ID: References: <84acc36e7e03e4cba89d@heytings.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="32159"; 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: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 16 23:26:11 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 1oZIqh-0008A2-6v for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Sep 2022 23:26:11 +0200 Original-Received: from localhost ([::1]:58222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oZIqf-0006zz-Ct for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Sep 2022 17:26:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZIqZ-0006zl-3L for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2022 17:26:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45409) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oZIqY-0005IR-Lj for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2022 17:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oZIqY-00017S-BI for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2022 17:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sam Steingold Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Sep 2022 21:26: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.16633635294260 (code B ref 57837); Fri, 16 Sep 2022 21:26:02 +0000 Original-Received: (at 57837) by debbugs.gnu.org; 16 Sep 2022 21:25:29 +0000 Original-Received: from localhost ([127.0.0.1]:44487 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZIq0-00016d-O5 for submit@debbugs.gnu.org; Fri, 16 Sep 2022 17:25:29 -0400 Original-Received: from mail-qk1-f181.google.com ([209.85.222.181]:41529) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZIpx-00016P-Os for 57837@debbugs.gnu.org; Fri, 16 Sep 2022 17:25:26 -0400 Original-Received: by mail-qk1-f181.google.com with SMTP id k12so16719209qkj.8 for <57837@debbugs.gnu.org>; Fri, 16 Sep 2022 14:25:25 -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=oLD8z4mh9XZmSdVRujfrGj5Aw1PZrve0/76ojbDranM=; b=STnDrH1kGYm8mcTNLio1iyxAgyO6hREIxgjionY0NolG/ZJX2SnjXcn22SGzzP6cgi i1Ml0kHenSAF1KLgvj/iEcfIrLZ2fhm/5dTiKn0dec9YNLMG3QVvhOgVCLzqUdjf1cMo NCrQ/f1zP/qISC0TGlxdc4l5BaxSpxEj7F6AjkuHbGtjDicFjh46SttVWF5sFD4ZPWe5 T3QSrFeJ4+jipf49vs4Xin5Tm7ZoDGDFOGZCpI9EuZmakfZao45x/PGjeV1lbVLcTgDJ StzkzoIYr+6llgMnlWfyETHNm7XRdUjd6CaxBaSsG+FbIc6DpUWnRU2ttmb4i3sBPFsV QxJw== 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=oLD8z4mh9XZmSdVRujfrGj5Aw1PZrve0/76ojbDranM=; b=oKCIHWnyXcoxZhVTuNMrcc4mlbnTBmlA62qKWz2bPM+h+ID3B9RmA30PULPZF55qv5 GNB7/PRhmz5W+vNdhTbZ+jqzHB07c5XaqPl2i9zJaQ0ER2VUhYlSMH6yRRmCvEGEmGtQ ZaWmf9ed9q4dY3g9QYrUnUrvxxft4gkZ54E3n8RUD8Rg0SKGloK3cSzldX1wYpTfoxId u4dJrsrT5iMuAVB+zWa06jpKzpAvUAuqmczxW5dYAUnPnwA4qGaKXlKik1AWdaJEc4IE dSQDBRyW2N3toWE4kO+NBlBHaM/hYM6TAibrwyUMwl7FUnIQdExmMbXZO2au/qAikW8H igVg== X-Gm-Message-State: ACrzQf2iRPmSJ8XiUVtczG8TcgZKwGe+CQPygSzzH2TrnPgfTLUWB/U2 ZBuJKfZrpVYTy4VK6VGDCg== X-Google-Smtp-Source: AMsMyM6aJGIP7WPAEN7+0Mz/hk5RYvBemnhcuvXkZRwNnpu/iF77nP+TBsS30m9kWlSmtTagRxKp0g== X-Received: by 2002:a05:620a:2191:b0:6ce:cc43:8de0 with SMTP id g17-20020a05620a219100b006cecc438de0mr2639173qka.646.1663363520095; Fri, 16 Sep 2022 14:25:20 -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 y6-20020a05620a25c600b006ccc96c78easm7541284qko.134.2022.09.16.14.25.19 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Sep 2022 14:25:19 -0700 (PDT) In-Reply-To: <84acc36e7e03e4cba89d@heytings.org> (Gregory Heytings's message of "Fri, 16 Sep 2022 19:34:41 +0000") 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:242814 Archived-At: > * Gregory Heytings [2022-09-16 19:34:41 +0000]: > >>>>> (advice-add 'fit-window-to-buffer :after >>>>> (lambda () (and (= (count-lines (point-min) (point-max)) (1- (window-height))) >>>>> (or (< (point) (point-max)) (forward-line -1) t) >>>>> (set-window-start nil (point-min))))) >>>> >>>> Why shouldn't this be the default behavior? >>> >>> I think because fit-window-to-buffer isn't supposed to move point, and point >>> would become invisible if it is not moved. >> >> Is that a problem? I mean, is it possible for the point to be invisible? > > No, Emacs does its best to ensure that point is always visible. what does "does its best" mean? is it possible for Emacs return nil from (pos-visible-in-window-p (point)) > That's the reason of the scrolling you see: without scrolling (which > hides the first half of the buffer) point would be invisible. Both invisible point and point moved before the EOB are, IMO, preferable over showing a half empty window after C-x w -. -- Sam Steingold (https://aphar.dreamwidth.org/) on darwin Ns 10.3.2113 https://lastingimpactpsychology.com https://steingoldpsychology.com https://www.peaceandtolerance.org/ https://fairforall.org All extremists should be taken out and shot.