all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size
@ 2016-07-29 12:10 Tino Calancha
  2016-07-29 13:20 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Tino Calancha @ 2016-07-29 12:10 UTC (permalink / raw)
  To: 24104


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@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





^ permalink raw reply related	[flat|nested] 5+ messages in thread
[parent not found: <<alpine.DEB.2.20.1607292109340.27947@calancha-pc>]

end of thread, other threads:[~2020-08-12  1:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-29 12:10 bug#24104: 25.1.50; frame-or-buffer-changed-p also check file size Tino Calancha
2016-07-29 13:20 ` Eli Zaretskii
2016-07-29 13:57   ` Tino Calancha
2020-08-12  1:59     ` Stefan Kangas
     [not found] <<alpine.DEB.2.20.1607292109340.27947@calancha-pc>
     [not found] ` <<83fuqsr36k.fsf@gnu.org>
2016-07-29 14:57   ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.