Subject: bug#24104: closed (Re: bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 12 Aug 2020 02:00:03 +0000

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 [email-masked].

-- 
24104: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24104
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size
From: Stefan Kangas <[email-masked]>
To: Tino Calancha <[email-masked]>
Cc: Eli Zaretskii <[email-masked]>, [email-masked]
Date: Tue, 11 Aug 2020 18:59:13 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Tino Calancha <[email-masked]> 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

Subject: 25.1.50; frame-or-buffer-changed-p also check file size
From: Tino Calancha <[email-masked]>
To: [email-masked]
Date: Fri, 29 Jul 2016 21:10:29 +0900 (JST)
List-Id: <debbugs-submit.debbugs.gnu.org>

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 <[email-masked]>
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