[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes w
From: |
Eli Zaretskii |
Subject: |
bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods |
Date: |
Thu, 11 Nov 2021 17:19:15 +0200 |
> From: Ihor Radchenko <yantar92@gmail.com>
> Date: Thu, 11 Nov 2021 21:56:46 +0800
>
> According to buffer-chars-modified-tick docstring:
> "By comparing the values returned by two individual calls of
> buffer-chars-modified-tick, you can tell whether a character change
> occurred in that buffer in between these calls"
>
> However, the return value can change even when no visible change is made
> to buffer text.
>
> Steps to reproduce:
> 1. emacs -Q
> 2. Evaluate the following code:
>
> (defun print-tick-before ()
> (when (eq this-command 'self-insert-command)
> (warn "Tick before: %S" (buffer-chars-modified-tick))))
> (defun print-tick-after ()
> (when (eq this-command 'self-insert-command)
> (warn "Tick after: %S" (buffer-chars-modified-tick))))
> (add-hook 'pre-command-hook #'print-tick-before)
> (add-hook 'post-command-hook #'print-tick-after)
>
> 3. Insert a latin symbol ?a twice. The warning buffer will print
> something like
>
> Warning (emacs): Tick before: 1698 Disable showing Disable logging
> Warning (emacs): Tick after: 1699 Disable showing Disable logging
> Warning (emacs): Tick before: 1699 Disable showing Disable logging
> Warning (emacs): Tick after: 1702 Disable showing Disable logging
>
> Note that second and third line show the same buffer-chars-modified-tick
> value.
>
> 4. Change input method (C-\) to russian-computer or i.e. arabic
> 5. Insert a non-latin symbol ?ф twice. The warning buffer will print
> something like
>
> Warning (emacs): Tick before: 1706 Disable showing Disable logging
> Warning (emacs): Tick after: 1707 Disable showing Disable logging
> Warning (emacs): Tick before: 1711 Disable showing Disable logging
> Warning (emacs): Tick after: 1712 Disable showing Disable logging
>
> Note that second and third line _do not_ show the same
> buffer-chars-modified-tick value even though buffer text has not been
> changed between the two self-insert commands
>
> Expected behaviour: return value of buffer-chars-modified-tick does not
> change when no changes in buffer text are made.
How do you know there was no changes in the buffer? You call your
function from pre/post-command-hook, but why is it guaranteed that
there was no change in the buffer between post-command-hook and the
following pre-command-hook?
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Ihor Radchenko, 2021/11/11
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods,
Eli Zaretskii <=
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Ihor Radchenko, 2021/11/11
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Eli Zaretskii, 2021/11/11
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Ihor Radchenko, 2021/11/12
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Eli Zaretskii, 2021/11/12
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Ihor Radchenko, 2021/11/12
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Eli Zaretskii, 2021/11/12
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Ihor Radchenko, 2021/11/12
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Eli Zaretskii, 2021/11/12
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Ihor Radchenko, 2021/11/13
- bug#51766: 29.0.50; Return value of buffer-chars-modified-tick changes when buffer text is not yet changed before inserting a character for non-latin input methods, Eli Zaretskii, 2021/11/13