GNU bug report logs - #24104
25.1.50; frame-or-buffer-changed-p also check file size

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Fri, 29 Jul 2016 12:11:02 UTC

Severity: minor

Found in version 25.1.50

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 24104 <at> debbugs.gnu.org
Subject: bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size
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.

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 <tino.calancha <at> gmail.com>
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




This bug report was last modified 4 years and 282 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.