unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Detect all changes in a buffer
@ 2016-07-15 16:37 Lars Tveito
  2016-07-15 21:07 ` Karl Fogel
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Tveito @ 2016-07-15 16:37 UTC (permalink / raw)
  To: emacs-devel

Hi!

I am developing a minor mode that enables real-time collaboration. I
wish to detect /all/ changes made to a buffer. So far I'm using
`before-change-functions' to detect deletions and
`after-change-functions' to detect insertions.

The problem is that some functions utilizes
`inhibit-modification-hooks', even though they make changes to the
buffer. An example is `eshell-send-input'.

The first question is whether you have any suggestions as to how to get
around this? The second is whether it is considered OK for functions to
use this hook even though the function makes changes to the buffer? The
documentation for change hooks states "These hook variables let you
arrange to take notice of all changes in all buffers" which is not
really true if changes are done whilst `inhibit-modification-hooks' is
non-nil.

- Lars



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

* Re: Detect all changes in a buffer
  2016-07-15 16:37 Detect all changes in a buffer Lars Tveito
@ 2016-07-15 21:07 ` Karl Fogel
  2016-07-16  2:24   ` raman
  2016-07-16  3:43   ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Karl Fogel @ 2016-07-15 21:07 UTC (permalink / raw)
  To: Lars Tveito; +Cc: emacs-devel

Lars Tveito <larstvei@ifi.uio.no> writes:
>I am developing a minor mode that enables real-time collaboration. I
>wish to detect /all/ changes made to a buffer. So far I'm using
>`before-change-functions' to detect deletions and
>`after-change-functions' to detect insertions.

You might already know about these, but just in case:

There was some work on this in the past -- the effort I remember was based on a collaboration protocol called "Obby", but now that I look at https://www.emacswiki.org/emacs/CollaborativeEditing I see there were some other efforts as well.

I don't know if anything there would save you time, but wanted to point it out just in case.

(You raise a good question about `inhibit-modification-hooks', and I don't know the answer to it.)

Best regards,
-Karl

>The problem is that some functions utilizes
>`inhibit-modification-hooks', even though they make changes to the
>buffer. An example is `eshell-send-input'.
>
>The first question is whether you have any suggestions as to how to get
>around this? The second is whether it is considered OK for functions to
>use this hook even though the function makes changes to the buffer? The
>documentation for change hooks states "These hook variables let you
>arrange to take notice of all changes in all buffers" which is not
>really true if changes are done whilst `inhibit-modification-hooks' is
>non-nil.
>
>- Lars



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

* Re: Detect all changes in a buffer
  2016-07-15 21:07 ` Karl Fogel
@ 2016-07-16  2:24   ` raman
  2016-07-16  3:43   ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: raman @ 2016-07-16  2:24 UTC (permalink / raw)
  To: Karl Fogel; +Cc: Lars Tveito, emacs-devel

Karl Fogel <kfogel@red-bean.com> writes:

there was also an effort based around erlang > Lars Tveito <larstvei@ifi.uio.no> writes:
>>I am developing a minor mode that enables real-time collaboration. I
>>wish to detect /all/ changes made to a buffer. So far I'm using
>>`before-change-functions' to detect deletions and
>>`after-change-functions' to detect insertions.
>
> You might already know about these, but just in case:
>
> There was some work on this in the past -- the effort I remember was based on a collaboration protocol called "Obby", but now that I look at https://www.emacswiki.org/emacs/CollaborativeEditing I see there were some other efforts as well.
>
> I don't know if anything there would save you time, but wanted to point it out just in case.
>
> (You raise a good question about `inhibit-modification-hooks', and I don't know the answer to it.)
>
> Best regards,
> -Karl
>
>>The problem is that some functions utilizes
>>`inhibit-modification-hooks', even though they make changes to the
>>buffer. An example is `eshell-send-input'.
>>
>>The first question is whether you have any suggestions as to how to get
>>around this? The second is whether it is considered OK for functions to
>>use this hook even though the function makes changes to the buffer? The
>>documentation for change hooks states "These hook variables let you
>>arrange to take notice of all changes in all buffers" which is not
>>really true if changes are done whilst `inhibit-modification-hooks' is
>>non-nil.
>>
>>- Lars
>

-- 



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

* Re: Detect all changes in a buffer
  2016-07-15 21:07 ` Karl Fogel
  2016-07-16  2:24   ` raman
@ 2016-07-16  3:43   ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2016-07-16  3:43 UTC (permalink / raw)
  To: emacs-devel

> There was some work on this in the past -- the effort I remember was based
> on a collaboration protocol called "Obby", but now that I look at
> https://www.emacswiki.org/emacs/CollaborativeEditing I see there were some
> other efforts as well.

GNU ELPA has Rudel which indeed supports the Obby protocol.

> (You raise a good question about `inhibit-modification-hooks', and
>  I don't know the answer to it.)

Making "real" modifications to the buffer while binding
inhibit-modification-hooks to a non-nil value sounds like a bug.

BTW, after-change-functions should work just as well for deletions as
for insertions.


        Stefan




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

end of thread, other threads:[~2016-07-16  3:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15 16:37 Detect all changes in a buffer Lars Tveito
2016-07-15 21:07 ` Karl Fogel
2016-07-16  2:24   ` raman
2016-07-16  3:43   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

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).