unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Is there a way to know if this-command altered the buffer?
@ 2021-05-12  3:33 Marcin Borkowski
  2021-05-12  4:27 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 3+ messages in thread
From: Marcin Borkowski @ 2021-05-12  3:33 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

I want to run some function in a certain hook.  This function will
update some info displayed using an overlay.  The info depends on the
buffer contents and is pretty expensive to compute, so I'd like to only
display it if the buffer really changed.

Is there a way to know if `this-command' actually changed the buffer (as
opposed to e.g. point motion)?

TIA,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is there a way to know if this-command altered the buffer?
  2021-05-12  3:33 Is there a way to know if this-command altered the buffer? Marcin Borkowski
@ 2021-05-12  4:27 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-05-12  5:39   ` Marcin Borkowski
  0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-05-12  4:27 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Borkowski wrote:

> I want to run some function in a certain hook. This function
> will update some info displayed using an overlay. The info
> depends on the buffer contents and is pretty expensive to
> compute, so I'd like to only display it if the buffer
> really changed.
>
> Is there a way to know if `this-command' actually changed
> the buffer (as opposed to e.g. point motion)?

Maybe these

  buffer-chars-modified-tick
  buffer-modified-tick

?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is there a way to know if this-command altered the buffer?
  2021-05-12  4:27 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-05-12  5:39   ` Marcin Borkowski
  0 siblings, 0 replies; 3+ messages in thread
From: Marcin Borkowski @ 2021-05-12  5:39 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs


On 2021-05-12, at 06:27, Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> Marcin Borkowski wrote:
>
>> I want to run some function in a certain hook. This function
>> will update some info displayed using an overlay. The info
>> depends on the buffer contents and is pretty expensive to
>> compute, so I'd like to only display it if the buffer
>> really changed.
>>
>> Is there a way to know if `this-command' actually changed
>> the buffer (as opposed to e.g. point motion)?
>
> Maybe these
>
>   buffer-chars-modified-tick
>   buffer-modified-tick

Wow, I never heard about those!  Interesting!  Though I think I found
the best answer (after-change-functions), this is also very interesting
and possibly useful (though in other circumstances, I think).

Thanks!

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-12  5:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-12  3:33 Is there a way to know if this-command altered the buffer? Marcin Borkowski
2021-05-12  4:27 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-12  5:39   ` Marcin Borkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).