From unknown Tue Jun 17 22:21:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Jul 2016 12:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24104 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 24104@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14697942562084 (code B ref -1); Fri, 29 Jul 2016 12:11:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Jul 2016 12:10:56 +0000 Received: from localhost ([127.0.0.1]:50056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT6cy-0000XX-JS for submit@debbugs.gnu.org; Fri, 29 Jul 2016 08:10:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50031) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT6cw-0000XK-UM for submit@debbugs.gnu.org; Fri, 29 Jul 2016 08:10:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bT6cn-0004Q4-Db for submit@debbugs.gnu.org; Fri, 29 Jul 2016 08:10:49 -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,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bT6cn-0004Pv-AZ for submit@debbugs.gnu.org; Fri, 29 Jul 2016 08:10:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bT6ci-0003g6-2J for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2016 08:10:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bT6cc-0004O8-M5 for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2016 08:10:38 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:33704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bT6cc-0004Nn-Dv for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2016 08:10:34 -0400 Received: by mail-pf0-x243.google.com with SMTP id i6so5399466pfe.0 for ; Fri, 29 Jul 2016 05:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:subject:message-id:user-agent:mime-version; bh=r6qxEHe+Iz4X9GLYkkRDWGxpLdgMCudxOI6VOwOHFj4=; b=yap2W+11+jYqUnSrf+jUdbGJO88PEcY6L1H2i9R8qLU45nTFLaCwBxr0M/yIRfv8AT joHfxkinmj9HfQjflVrIqjNXpZ4xDHuWN0YQM8+0JbXS1YWJP7qCRwz24TQqJvfDLn7n ey1hk8QvKxAVj8o3LthtyJWzqK0N+5V+CaoTIhJB45Qlkuac5w/UUUtmPaL1F05Tvnhu 69pBi4wCfNqssGVNvdRjL1NS6IO5+hE//bU2YxUVwuNlWt8GFX+TcsSScx2ELFaa4tEh 8POws62EroSHm/h3zeqXrItavjSjMkjUWVxUmxbZxUrdaADxOl2V4vXLrUq7u6ibTdsX QUlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:subject:message-id:user-agent :mime-version; bh=r6qxEHe+Iz4X9GLYkkRDWGxpLdgMCudxOI6VOwOHFj4=; b=fQdMDZxtDQFZm0lmYCIalDz3ur/2kcA13CklV752S4IcdIG2GPa1GET+mLGQh+fkcO 50D/2MSIKhPcz/zKO7c5fiKmK5y3v1o2LnTg3zOymXdAKWYk73qvZrXlys9PTumms2gC shJvPaEN7CQEEUze5G4LWnjHP99E/9pCP0j7709Cb0EHZm7VTdX2g4SGr0dF7Bw+bxa0 q5gNmXBaGZELrzNfuAJioX3+YbEbB1TUNWcLguBJZSI7KXldtxy9h+COptMM/25BiuC6 PUcHIj0vq86N2phHXIln1Fj2PTD3nbbSznGCQqiSsTN7zmqnZlarzNyJ2mI8moyZ9lwV V8ig== X-Gm-Message-State: AEkoousKiXnjd/xqRD0m0vuYngjKZIGbgQThmkJ9Lmzr0CrrfZne7HlgvFUJ6GV3NLrFXA== X-Received: by 10.98.106.65 with SMTP id f62mr67552155pfc.107.1469794232900; Fri, 29 Jul 2016 05:10:32 -0700 (PDT) Received: from calancha-pc ([103.5.140.173]) by smtp.gmail.com with ESMTPSA id 5sm24545064pac.34.2016.07.29.05.10.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jul 2016 05:10:32 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Fri, 29 Jul 2016 21:10:29 +0900 (JST) X-X-Sender: calancha@calancha-pc Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) 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: -4.0 (----) Assume a buffer BUF, with size, SIZE, returning non-nil for predicate 'buffer-modified-p'; then we write some text on BUF, so that the new size is SIZE_2 != SIZE. In this scenario, 'frame-or-buffer-changed-p' return nil, i.e., the buffer state appears to not have changed. It might be convenient to extend 'frame-or-buffer-changed-p' so that, it also check the buffer size. Then, for instance, Ibuffer operating on auto mode ('ibuffer-auto-mode') would update the listing. emacs -Q --eval="(progn (require 'ibuffer) (ibuffer))" M-x ibuffer-auto-mode RET M-! echo Hi Emacs! RET ;; *Shell Command Output* appear with size 10 M-! echo Could you update Ibuffer for me? ;; It seems not: maybe i should add please next time... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From 1c9ef031b2bd283c6641d5249cbfa7226b764ab1 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Fri, 29 Jul 2016 21:05:23 +0900 Subject: [PATCH] frame-or-buffer-changed-p also check file size * src/dispnew.c (frame-or-buffer-changed-p): Check if buffer size has changed. Update the new file size in VARIABLE (Bug#24104). --- src/dispnew.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dispnew.c b/src/dispnew.c index 82d0b76..0218a68 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5812,7 +5812,7 @@ DEFUN ("frame-or-buffer-changed-p", Fframe_or_buffer_changed_p, VARIABLE is a variable name whose value is either nil or a state vector that will be updated to contain all frames and buffers, aside from buffers whose names start with space, -along with the buffers' read-only and modified flags. This allows a fast +along with the buffers' read-only, modified flags and buffer size. This allows a fast check to see whether buffer menus might need to be recomputed. If this function returns non-nil, it updates the internal vector to reflect the current state. @@ -5864,6 +5864,8 @@ pass nil for VARIABLE. */) goto changed; if (!EQ (AREF (state, idx++), Fbuffer_modified_p (buf))) goto changed; + if (!EQ (AREF (state, idx++), BVAR (XBUFFER (buf), save_length))) + goto changed; } if (idx == ASIZE (state)) goto changed; @@ -5914,6 +5916,8 @@ pass nil for VARIABLE. */) idx++; ASET (state, idx, Fbuffer_modified_p (buf)); idx++; + ASET (state, idx, Fbuffer_size (buf)); + idx++; } /* Fill up the vector with lambdas (always at least one). */ ASET (state, idx, Qlambda); -- 2.8.1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GNU Emacs 25.1.50 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6) of 2016-07-28 Repository revision: 4a5b6e621c68172bb69d60fe8a76932f7c779f81 From unknown Tue Jun 17 22:21:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Jul 2016 13:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24104 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Tino Calancha Cc: 24104@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 24104-submit@debbugs.gnu.org id=B24104.14697984698978 (code B ref 24104); Fri, 29 Jul 2016 13:22:02 +0000 Received: (at 24104) by debbugs.gnu.org; 29 Jul 2016 13:21:09 +0000 Received: from localhost ([127.0.0.1]:50144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT7iu-0002Kj-Ts for submit@debbugs.gnu.org; Fri, 29 Jul 2016 09:21:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35047) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT7it-0002KV-B2 for 24104@debbugs.gnu.org; Fri, 29 Jul 2016 09:21:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bT7ik-0000gr-P8 for 24104@debbugs.gnu.org; Fri, 29 Jul 2016 09:21:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_05,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59957) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bT7ik-0000gX-M4; Fri, 29 Jul 2016 09:20:58 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1551 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bT7if-0001fg-LL; Fri, 29 Jul 2016 09:20:57 -0400 Date: Fri, 29 Jul 2016 16:20:35 +0300 Message-Id: <83fuqsr36k.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Tino Calancha on Fri, 29 Jul 2016 21:10:29 +0900 (JST)) References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.3 (------) 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: -6.3 (------) > From: Tino Calancha > Date: Fri, 29 Jul 2016 21:10:29 +0900 (JST) > > > Assume a buffer BUF, with size, SIZE, returning non-nil for predicate > 'buffer-modified-p'; then we write some text on BUF, so that the > new size is SIZE_2 != SIZE. > In this scenario, 'frame-or-buffer-changed-p' return nil, i.e., > the buffer state appears to not have changed. Because it didn't. The buffer was changed, and it still is. In particular, the original change that caused buffer-modified-p to return non-nil could also be (and normally is) a change in the size of the buffer. > It might be convenient to extend 'frame-or-buffer-changed-p' so that, > it also check the buffer size. This function is used to decide whether we need to recompute menus, so your proposed change will cause extra recomputation of them. I'm not sure we want that, as recomputing menus might be expensive. > Then, for instance, Ibuffer operating > on auto mode ('ibuffer-auto-mode') would update the listing. If Ibuffer has some problem, I suggest to describe that problem and try solving it for Ibuffer alone. Thanks. From unknown Tue Jun 17 22:21:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Jul 2016 13:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24104 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 24104@debbugs.gnu.org, Tino Calancha Received: via spool by 24104-submit@debbugs.gnu.org id=B24104.146980063412980 (code B ref 24104); Fri, 29 Jul 2016 13:58:01 +0000 Received: (at 24104) by debbugs.gnu.org; 29 Jul 2016 13:57:14 +0000 Received: from localhost ([127.0.0.1]:50829 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT8Hq-0003NH-48 for submit@debbugs.gnu.org; Fri, 29 Jul 2016 09:57:14 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:33214) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT8Hp-0003N5-4F for 24104@debbugs.gnu.org; Fri, 29 Jul 2016 09:57:13 -0400 Received: by mail-pa0-f47.google.com with SMTP id ks6so31675175pab.0 for <24104@debbugs.gnu.org>; Fri, 29 Jul 2016 06:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=7m8ruMCI5RSTOtFvxr/LGFaE/Z5HPeF6LqI+vBm6+Dg=; b=MPP64EUk0i5K/AzUS42XrA7aGnA7V2WvQSBSecS1c+FEPJeNpaid6taV8RZR8uEfDM N2v8An1gJbWzcNJsqcvj48VPuYF85hFFEXuShWXp/Ld/xffrArqSvN2g4wteklB6S5P6 ifnddy8tXZR/xM7Jxs9wHVoii9KPBNg67r3nDXSWoO7bofEer8pL2S+CLvxTyx01pmWO CJStmrTVpZ3T0KtKtBz65/v/unXLfhaem77Eqelg9mp8wwTr3FST4/Es6C/t32/vnrFz mhW0mqERom42+seWqxGz3bZE3zYqtMPAQob+bP3fAhqGHP2zc+szX1LFnmpNr5YOVEjP w7lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=7m8ruMCI5RSTOtFvxr/LGFaE/Z5HPeF6LqI+vBm6+Dg=; b=Od2kh9y9EgiwbJ/FNlZrc/DMrkYhTA+v7DHUShWfviPdHnAd4ex8D9LBnd/j/mrDpb JhfSegK2hhDbaQjzLxKi72n3M/mUuFkjM+h9r5l3iMl3qr79U+ESm+exe8mx3ZP4AW0s y8bfWDn6vehTUWgtXt1K1CvibVSkLDfyQB6KLCiKGRGz0Yi1tP5eE6ZlXgdN2bw+KNQe XiDf+gvRHF67PJJeE3CUC01XEnkxc3BSaUuIksj6fy+XX9ADXZ1VEEAXfhlXmJQZUOG5 YMbuRaRwy0fingFY1GBIdLaQ4cJvkVEgmI4v9XHknVcaYPot2KAZKvOfLzQHXM+kUznz ewQw== X-Gm-Message-State: AEkoout/zgUw58/Xggx8llkShxH6ZSbjnGfz5D55R2DouBOirX1sI/Wc8SfXN/Y+Mes3/Q== X-Received: by 10.66.172.237 with SMTP id bf13mr70015177pac.42.1469800627010; Fri, 29 Jul 2016 06:57:07 -0700 (PDT) Received: from calancha-pc ([103.5.140.142]) by smtp.gmail.com with ESMTPSA id v124sm25431092pfb.14.2016.07.29.06.57.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jul 2016 06:57:06 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Fri, 29 Jul 2016 22:57:03 +0900 (JST) X-X-Sender: calancha@calancha-pc In-Reply-To: <83fuqsr36k.fsf@gnu.org> Message-ID: References: <83fuqsr36k.fsf@gnu.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: -0.7 (/) 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: -0.7 (/) On Fri, 29 Jul 2016, Eli Zaretskii wrote: > This function is used to decide whether we need to recompute menus, so > your proposed change will cause extra recomputation of them. I'm not > sure we want that, as recomputing menus might be expensive. Ok. >> Then, for instance, Ibuffer operating >> on auto mode ('ibuffer-auto-mode') would update the listing. > > If Ibuffer has some problem, I suggest to describe that problem and > try solving it for Ibuffer alone. Agreed. In fact, my main target in this report is to enhance 'ibuffer-auto-mode'. I agree that an enhancement in Ibuffer should not come with a penalty in other parts of Emacs. We can close this report. Thank you very much. From unknown Tue Jun 17 22:21:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Jul 2016 14:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24104 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , Tino Calancha Cc: 24104@debbugs.gnu.org Received: via spool by 24104-submit@debbugs.gnu.org id=B24104.146980429618406 (code B ref 24104); Fri, 29 Jul 2016 14:59:01 +0000 Received: (at 24104) by debbugs.gnu.org; 29 Jul 2016 14:58:16 +0000 Received: from localhost ([127.0.0.1]:50862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT9Et-0004mo-QB for submit@debbugs.gnu.org; Fri, 29 Jul 2016 10:58:16 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:25126) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT9Er-0004ma-TV for 24104@debbugs.gnu.org; Fri, 29 Jul 2016 10:58:14 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u6TEw4Pt002478 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 29 Jul 2016 14:58:05 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u6TEw474013285 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 29 Jul 2016 14:58:04 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u6TEw000024814; Fri, 29 Jul 2016 14:58:01 GMT MIME-Version: 1.0 Message-ID: <950031e8-3e82-4cd3-9b39-37e8e4359051@default> Date: Fri, 29 Jul 2016 07:57:59 -0700 (PDT) From: Drew Adams References: <> <<83fuqsr36k.fsf@gnu.org>> In-Reply-To: <<83fuqsr36k.fsf@gnu.org>> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6744.5000 (x86)] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Spam-Score: -3.6 (---) 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.6 (---) > > Assume a buffer BUF, with size, SIZE, returning non-nil for predicate > > 'buffer-modified-p'; then we write some text on BUF, so that the > > new size is SIZE_2 !=3D SIZE. > > In this scenario, 'frame-or-buffer-changed-p' return nil, i.e., > > the buffer state appears to not have changed. >=20 > Because it didn't. The buffer was changed, and it still is. In > particular, the original change that caused buffer-modified-p to > return non-nil could also be (and normally is) a change in the size of > the buffer. If the meaning of `frame-or-buffer-changed-p' in this scenario is, as you suggest, intended to reflect whether or not `buffer-modified-p' has changed (and not whether the buffer has changed), then its doc should say so. Whether `buffer-modified-p' has changed is something different from whether the buffer state has changed. If `buffer-modified-p' is already non-nil then additional changes to the buffer will not cause a change in `buffer-modified-p', as Tino's example illustrates. The name `frame-or-buffer-changed-p', and its current doc, suggest that it should return non-nil if the buffer appears to have changed. The buffer has changed in this case, even if the value of `buffer-modified-p' has not changed (it is still non-nil). But apparently the buffer does not "appear" to have changed. That's OK, but what's involved in this appearing is unclear. Something should be said in the doc about what kinds of changes lead to a change "appearing" to have occurred (or what kinds do not lead to that). IOW, the doc should say something about how the "appearance" of change is judged/detected. If read-only and modified flags determine this (alone), then the doc should say so. Something should be said about just what is meant by (included in) a buffer state change and a frame state change. If all that is meant, for buffer change, is what is said (later) in the doc for VARIABLE, i.e., all that is checked are the (1) read-only and (2) modified flags, then just say that up front, and not only for VARIABLE. That, I think, would make most of the above clear. Except for frame state change - that part is still completely unspecified, AFAICT. Just what is meant by (included in) the frame state, and how is a change in frame state detected/recorded by Emacs ("appear" to have occurred). For buffer changes: read-only and modified flags - OK. What about for frame-state changes? Finally, the doc should not talk about some "internal vector" BEFORE that has been introduced. Assuming that the "an internal variable" of the last paragraph is what holds "the internal vector", it needs to be introduced before we talk about "the internal vector". And the fact that the value of the internal variable is "the internal vector" should be made explicit. The last sentence of the doc is confusing/scary. If a user can call the function without passing an argument, is that different from calling it and passing a nil argument? If the behavior is different then this is REALLY an exception - I've never heard of such a thing. What is this all about? I'm guessing that that last sentence should just be removed. On the other hand, if the first part of the doc is to be believed, VARIABLE, if present, must be a symbol that is a variable - which excludes the symbol `nil'. In that case it's still not clear to me how the absence of VARIABLE is distinguished from the presence of nil as an argument. Perhaps that is done at the C level and this is a real exception to the rule of &optional arguments. If so, that needs to be spelled out clearly. If this is really about passing a symbol, and not its value (see below), then, again, there is no need for the confusing last doc sentence. And in that case if a user _does_ pass nil as the argument then is an error raised saying that nil is a constant and not a variable? (And again, how is this case distinguished from an absence of VARIABLE?) The doc seems to be essentially backward, and it doesn't make explicit the connections that I think the author intended. It should say (IIUC, but I probably do not) that the state of frames and buffers - or of frame and buffer changes (?) is kept in a vector that is the value of an internal variable, and which for buffers records the read-only and modified flags (only), and which for frames records [???]. The function returns non-nil if this recorded state indicates that a change has occurred. It should then say that you can provide a different such variable to use by passing it as optional argument VARIABLE. The doc says that VARIABLE "is a variable name whose value is ...". The value of a _name_ cannot be nil or a vector. Presumably what is meant is that VARIABLE is a variable (symbol) whose value is.... The value of the symbol's _name_ is a string (`symbol-name'). So you pass a symbol and not its value (nil or a vector), I guess. Why is that? In sum, this doc needs some work, I think, for it to help users more and not confuse them more. It confuses me, at least. You can't make good use of a function if you don't know what its intended behavior is. Of course you can try to discover that by trial and error ... but that's what we have doc for. From unknown Tue Jun 17 22:21:56 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Tino Calancha Subject: bug#24104: closed (Re: bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size) Message-ID: References: X-Gnu-PR-Message: they-closed 24104 X-Gnu-PR-Package: emacs Reply-To: 24104@debbugs.gnu.org Date: Wed, 12 Aug 2020 02:00:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1597197603-26704-1" This is a multi-part message in MIME format... ------------=_1597197603-26704-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24104: 25.1.50; frame-or-buffer-changed-p also check file size which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 24104@debbugs.gnu.org. --=20 24104: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24104 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1597197603-26704-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24104-done) by debbugs.gnu.org; 12 Aug 2020 01:59:22 +0000 Received: from localhost ([127.0.0.1]:42252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5g2z-0006vC-OT for submit@debbugs.gnu.org; Tue, 11 Aug 2020 21:59:21 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:33925) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5g2x-0006ux-Jd for 24104-done@debbugs.gnu.org; Tue, 11 Aug 2020 21:59:19 -0400 Received: by mail-yb1-f194.google.com with SMTP id c9so534252ybq.1 for <24104-done@debbugs.gnu.org>; Tue, 11 Aug 2020 18:59:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:user-agent :mime-version:date:message-id:subject:to:cc; bh=QyYQDJJQTCxUmo6cLLVeUp7cv4xSDi+06AaelNrHTAQ=; b=EE+gkNpjfKpQkWb6vwpxWHonNdWG+ZMPV4v9E0LfZppFnrtJagcWftbjyouLSqRztD N6uIV4LUJblYf/d2qIndsdHDkGt5pC4kEKS0EJWy18RIpZKGWmVy0eNkZbNCubEuDUFP KZbGUbb9GGSahZMTi/Yme5JTqZR2g4DGzKV5HiFryvTbi1WFj/0FLjDezX7XvlJ7YHn1 s8taqk7DYYMQLlDAjmWpUEKY8yJj0NnIUWpVzj2EMkb9FRq/qpbAlNUVYMQtMaQUznzy udjHu4mpXwAuC25YVO8z498o3YqSgWoXnM0Y79LYjNzHy+DyvKt11J7cmbqc43BG1S/l 069Q== X-Gm-Message-State: AOAM530GwSvARe6VKFRQp4szl+NF8C4x2JBoVXlZs91xhA9DOtCwpicF NsmLjM6q9Hvdi2f6Y/YGMaW3WrIdVl9Nm+C7NWs= X-Google-Smtp-Source: ABdhPJyRkRY3h+btgF0ZDRHXiX4D8vNW6uSI1kaIksIrUykXne6o7RMNyJ6aqNN3QNBwd/D8XSg6ANNF4Y4433OAzKk= X-Received: by 2002:a25:9843:: with SMTP id k3mr52546901ybo.466.1597197554081; Tue, 11 Aug 2020 18:59:14 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 11 Aug 2020 18:59:13 -0700 From: Stefan Kangas In-Reply-To: (Tino Calancha's message of "Fri, 29 Jul 2016 22:57:03 +0900 (JST)") References: <83fuqsr36k.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Date: Tue, 11 Aug 2020 18:59:13 -0700 Message-ID: Subject: Re: bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size To: Tino Calancha Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24104-done Cc: Eli Zaretskii , 24104-done@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: -1.0 (-) Tino Calancha writes: > On Fri, 29 Jul 2016, Eli Zaretskii wrote: > >> This function is used to decide whether we need to recompute menus, so >> your proposed change will cause extra recomputation of them. I'm not >> sure we want that, as recomputing menus might be expensive. > Ok. [...] > We can close this report. I'm consequently closing this bug report now. Best regards, Stefan Kangas ------------=_1597197603-26704-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 29 Jul 2016 12:10:56 +0000 Received: from localhost ([127.0.0.1]:50056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT6cy-0000XX-JS for submit@debbugs.gnu.org; Fri, 29 Jul 2016 08:10:56 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50031) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bT6cw-0000XK-UM for submit@debbugs.gnu.org; Fri, 29 Jul 2016 08:10:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bT6cn-0004Q4-Db for submit@debbugs.gnu.org; Fri, 29 Jul 2016 08:10:49 -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,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bT6cn-0004Pv-AZ for submit@debbugs.gnu.org; Fri, 29 Jul 2016 08:10:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bT6ci-0003g6-2J for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2016 08:10:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bT6cc-0004O8-M5 for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2016 08:10:38 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:33704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bT6cc-0004Nn-Dv for bug-gnu-emacs@gnu.org; Fri, 29 Jul 2016 08:10:34 -0400 Received: by mail-pf0-x243.google.com with SMTP id i6so5399466pfe.0 for ; Fri, 29 Jul 2016 05:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:subject:message-id:user-agent:mime-version; bh=r6qxEHe+Iz4X9GLYkkRDWGxpLdgMCudxOI6VOwOHFj4=; b=yap2W+11+jYqUnSrf+jUdbGJO88PEcY6L1H2i9R8qLU45nTFLaCwBxr0M/yIRfv8AT joHfxkinmj9HfQjflVrIqjNXpZ4xDHuWN0YQM8+0JbXS1YWJP7qCRwz24TQqJvfDLn7n ey1hk8QvKxAVj8o3LthtyJWzqK0N+5V+CaoTIhJB45Qlkuac5w/UUUtmPaL1F05Tvnhu 69pBi4wCfNqssGVNvdRjL1NS6IO5+hE//bU2YxUVwuNlWt8GFX+TcsSScx2ELFaa4tEh 8POws62EroSHm/h3zeqXrItavjSjMkjUWVxUmxbZxUrdaADxOl2V4vXLrUq7u6ibTdsX QUlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:subject:message-id:user-agent :mime-version; bh=r6qxEHe+Iz4X9GLYkkRDWGxpLdgMCudxOI6VOwOHFj4=; b=fQdMDZxtDQFZm0lmYCIalDz3ur/2kcA13CklV752S4IcdIG2GPa1GET+mLGQh+fkcO 50D/2MSIKhPcz/zKO7c5fiKmK5y3v1o2LnTg3zOymXdAKWYk73qvZrXlys9PTumms2gC shJvPaEN7CQEEUze5G4LWnjHP99E/9pCP0j7709Cb0EHZm7VTdX2g4SGr0dF7Bw+bxa0 q5gNmXBaGZELrzNfuAJioX3+YbEbB1TUNWcLguBJZSI7KXldtxy9h+COptMM/25BiuC6 PUcHIj0vq86N2phHXIln1Fj2PTD3nbbSznGCQqiSsTN7zmqnZlarzNyJ2mI8moyZ9lwV V8ig== X-Gm-Message-State: AEkoousKiXnjd/xqRD0m0vuYngjKZIGbgQThmkJ9Lmzr0CrrfZne7HlgvFUJ6GV3NLrFXA== X-Received: by 10.98.106.65 with SMTP id f62mr67552155pfc.107.1469794232900; Fri, 29 Jul 2016 05:10:32 -0700 (PDT) Received: from calancha-pc ([103.5.140.173]) by smtp.gmail.com with ESMTPSA id 5sm24545064pac.34.2016.07.29.05.10.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jul 2016 05:10:32 -0700 (PDT) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Fri, 29 Jul 2016 21:10:29 +0900 (JST) X-X-Sender: calancha@calancha-pc To: bug-gnu-emacs@gnu.org Subject: 25.1.50; frame-or-buffer-changed-p also check file size Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit 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: -4.0 (----) Assume a buffer BUF, with size, SIZE, returning non-nil for predicate 'buffer-modified-p'; then we write some text on BUF, so that the new size is SIZE_2 != SIZE. In this scenario, 'frame-or-buffer-changed-p' return nil, i.e., the buffer state appears to not have changed. It might be convenient to extend 'frame-or-buffer-changed-p' so that, it also check the buffer size. Then, for instance, Ibuffer operating on auto mode ('ibuffer-auto-mode') would update the listing. emacs -Q --eval="(progn (require 'ibuffer) (ibuffer))" M-x ibuffer-auto-mode RET M-! echo Hi Emacs! RET ;; *Shell Command Output* appear with size 10 M-! echo Could you update Ibuffer for me? ;; It seems not: maybe i should add please next time... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From 1c9ef031b2bd283c6641d5249cbfa7226b764ab1 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Fri, 29 Jul 2016 21:05:23 +0900 Subject: [PATCH] frame-or-buffer-changed-p also check file size * src/dispnew.c (frame-or-buffer-changed-p): Check if buffer size has changed. Update the new file size in VARIABLE (Bug#24104). --- src/dispnew.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/dispnew.c b/src/dispnew.c index 82d0b76..0218a68 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5812,7 +5812,7 @@ DEFUN ("frame-or-buffer-changed-p", Fframe_or_buffer_changed_p, VARIABLE is a variable name whose value is either nil or a state vector that will be updated to contain all frames and buffers, aside from buffers whose names start with space, -along with the buffers' read-only and modified flags. This allows a fast +along with the buffers' read-only, modified flags and buffer size. This allows a fast check to see whether buffer menus might need to be recomputed. If this function returns non-nil, it updates the internal vector to reflect the current state. @@ -5864,6 +5864,8 @@ pass nil for VARIABLE. */) goto changed; if (!EQ (AREF (state, idx++), Fbuffer_modified_p (buf))) goto changed; + if (!EQ (AREF (state, idx++), BVAR (XBUFFER (buf), save_length))) + goto changed; } if (idx == ASIZE (state)) goto changed; @@ -5914,6 +5916,8 @@ pass nil for VARIABLE. */) idx++; ASET (state, idx, Fbuffer_modified_p (buf)); idx++; + ASET (state, idx, Fbuffer_size (buf)); + idx++; } /* Fill up the vector with lambdas (always at least one). */ ASET (state, idx, Qlambda); -- 2.8.1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; GNU Emacs 25.1.50 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6) of 2016-07-28 Repository revision: 4a5b6e621c68172bb69d60fe8a76932f7c779f81 ------------=_1597197603-26704-1--