unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15567: Point jumps around madly in XML file when undoing while auto-revert-mode updates buffer
@ 2013-10-08 23:07 Barry OReilly
  2013-10-09 12:29 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Barry OReilly @ 2013-10-08 23:07 UTC (permalink / raw)
  To: 15567

[-- Attachment #1: Type: text/plain, Size: 2936 bytes --]

I had an XML file open, specifically the XML output file of a Valgrind
run. I ran Valgrind again which caused the XML file to become empty
and populate with new content. Since I wanted to view the old output,
I did undo in Emacs. I navigated to where I wanted to go, but then
shortly point jumps to a wrong part of the buffer. If I wait, it jumps
back and forth every second or two between where I wanted to be and
elsewhere in the buffer. I ended up killing the buffer and revisiting
the file to get back to something usable.

I have been running Emacs with debug statements to walk the specpdl
stack during redisplay and look for save_excursion_restore markers
that mismatch current marker at redisplay. See
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15045#29 for why and the
debugging patch. I was spammed with this output:

2013-10-08T18:24:21.068155000|pid:21060|tid:47198260320512|dispnew.c|5807|
DEBUG: Found save_excursion_restore with mismatched point markers
  redisplay()
  sit-for(0)
  rng-validate-while-idle-continue-p()
  rng-do-some-validation-1(rng-validate-while-idle-continue-p)
Ê\x1eˎÌ!.e("Æ ‡" [rng-dt-namespace-context-getter modified
buffer-undo-list inhibit-read-only inhibit-modification-hooks
deactivate-mark rng-validate-prepare (nxml-ns-get-context)
buffer-modified-p t nil ((byte-code ÁÂ!ˆÂ‡" [modified
restore-buffer-modified-p nil] 2)) rng-do-some-validation-1
buffer-file-name buffer-file-truename continue-p-function] 3)
  rng-do-some-validation(rng-validate-while-idle-continue-p)
  rng-validate-while-idle(#<buffer REDACTED_UnitTests_valgrind.xml>)
  apply(rng-validate-while-idle #<buffer REDACTED_UnitTests_valgrind.xml>)
  byte-code("rÂÃH\"ˆ)Á‡" [timer apply 5 6] 4)
  timer-event-handler([t 0 1 500000 t rng-validate-while-idle (#<buffer
REDACTED_UnitTests_valgrind.xml>) idle 0])
  input-pending-p()
  rng-validate-while-idle-continue-p()
  rng-do-some-validation-1(rng-validate-while-idle-continue-p)
Ê\x1eˎÌ!.e("Æ ‡" [rng-dt-namespace-context-getter modified
buffer-undo-list inhibit-read-only inhibit-modification-hooks
deactivate-mark rng-validate-prepare (nxml-ns-get-context)
buffer-modified-p t nil ((byte-code ÁÂ!ˆÂ‡" [modified
restore-buffer-modified-p nil] 2)) rng-do-some-validation-1
buffer-file-name buffer-file-truename continue-p-function] 3)
  rng-do-some-validation(rng-validate-while-idle-continue-p)
  rng-validate-while-idle(#<buffer REDACTED_UnitTests_valgrind.xml>)
  apply(rng-validate-while-idle #<buffer REDACTED_UnitTests_valgrind.xml>)
  byte-code("rÂÃH\"ˆ)Á‡" [timer apply 5 6] 4)
  timer-event-handler([t 0 1 500000 t rng-validate-while-idle (#<buffer
REDACTED_UnitTests_valgrind.xml>) idle 0])
#<marker at 591026 in REDACTED_UnitTests_valgrind.xml>#<marker at 152113 in
REDACTED_UnitTests_valgrind.xml>

Normally this debug statement is silent. It indicates redisplay
occurred when point was on an excursion.

[-- Attachment #2: Type: text/html, Size: 3226 bytes --]

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

* bug#15567: Point jumps around madly in XML file when undoing while auto-revert-mode updates buffer
  2013-10-08 23:07 bug#15567: Point jumps around madly in XML file when undoing while auto-revert-mode updates buffer Barry OReilly
@ 2013-10-09 12:29 ` Stefan Monnier
  2013-10-10 14:14   ` Barry OReilly
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2013-10-09 12:29 UTC (permalink / raw)
  To: Barry OReilly; +Cc: 15567

> shortly point jumps to a wrong part of the buffer. If I wait, it jumps
> back and forth every second or two between where I wanted to be and
> elsewhere in the buffer. I ended up killing the buffer and revisiting
> the file to get back to something usable.

> I have been running Emacs with debug statements to walk the specpdl
> stack during redisplay and look for save_excursion_restore markers
> that mismatch current marker at redisplay. See
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15045#29 for why and the
> debugging patch. I was spammed with this output:

Thank you very much, this backtrace is very welcome.  Haven't looked at
how best to fix the problem, but at least the problem is clear.


        Stefan





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

* bug#15567: Point jumps around madly in XML file when undoing while auto-revert-mode updates buffer
  2013-10-09 12:29 ` Stefan Monnier
@ 2013-10-10 14:14   ` Barry OReilly
  2013-10-18 14:04     ` Barry OReilly
  2021-08-20 15:28     ` Lars Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: Barry OReilly @ 2013-10-10 14:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15567

[-- Attachment #1: Type: text/plain, Size: 3031 bytes --]

There may be two bugs here:

   1: That the rng-validate-while-idle timer calls input-pending-p
   when point is on an excursion, regardless of what the inner timer
   is. ie another instance of bug 15045.

   2: That there are more than one rng-validate-while-idle timers.

In order to more directly verify bug 2, I ran with this:

diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el
index fb8bd03..9fb5a7b 100644
--- a/lisp/nxml/rng-valid.el
+++ b/lisp/nxml/rng-valid.el
@@ -137,6 +137,8 @@ A quick validation validates at most one chunk."

 ;; Global variables

+(defvar rng-validate-timers '())
+
 (defvar rng-validate-timer nil)
 (make-variable-buffer-local 'rng-validate-timer)
 ;; ensure that we can cancel the timer even after a
kill-all-local-variables
@@ -389,6 +391,7 @@ The schema is set like `rng-auto-set-schema'."
       (cancel-timer rng-validate-quick-timer))
     (kill-local-variable 'rng-validate-quick-timer)))

+(require 'cl-lib)
 (defun rng-activate-timers ()
   (unless rng-validate-timer
     (let ((inhibit-quit t))
@@ -401,7 +404,8 @@ The schema is set like `rng-auto-set-schema'."
            (run-with-idle-timer rng-validate-quick-delay
                                 t
                                 'rng-validate-quick-while-idle
-                                (current-buffer))))))
+                                (current-buffer)))
+      (cl-pushnew rng-validate-timer rng-validate-timers))))

 (defun rng-validate-clear ()
   (rng-validate-mode 1 t))
@@ -433,6 +437,7 @@ The schema is set like `rng-auto-set-schema'."
 ;; validation process down.

 (defun rng-validate-while-idle (buffer)
+  (my-msg "DEBUG: size of rng-validate-timers: %s" (length
rng-validate-timers))
   (when (buffer-live-p buffer)         ; bug#13999
     (with-current-buffer buffer
       (if rng-validate-mode

I also have message statements in mode hooks. Here's the output when I
reproduced the issue:

2013-10-10T10:00:11.404643 Inside my-text-mode-hook for buffer
REDACTED_UnitTests_valgrind.xml
2013-10-10T10:00:11.404814 Inside my-nxml-mode-hook for buffer
REDACTED_UnitTests_valgrind.xml
Mark set [2 times]
2013-10-10T10:00:15.717636 DEBUG: size of rng-validate-timers: 1
Mark set [3 times]
Using vacuous schema
2013-10-10T10:00:37.920625 DEBUG: size of rng-validate-timers: 2
2013-10-10T10:00:38.227798 Inside my-text-mode-hook for buffer
REDACTED_UnitTests_valgrind.xml
2013-10-10T10:00:38.227983 Inside my-nxml-mode-hook for buffer
REDACTED_UnitTests_valgrind.xml
user-error: No further undo information
2013-10-10T10:00:43.442746 DEBUG: size of rng-validate-timers: 2
Reverting buffer `REDACTED_UnitTests_valgrind.xml'.
2013-10-10T10:01:01.231729 DEBUG: size of rng-validate-timers: 3
Reverting buffer `REDACTED_UnitTests_valgrind.xml'.
2013-10-10T10:01:11.217973 DEBUG: size of rng-validate-timers: 4
Reverting buffer `REDACTED_UnitTests_valgrind.xml'.
Mark set
2013-10-10T10:01:20.598804 DEBUG: size of rng-validate-timers: 5
2013-10-10T10:01:20.602859 DEBUG: size of rng-validate-timers: 5

[-- Attachment #2: Type: text/html, Size: 3388 bytes --]

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

* bug#15567: Point jumps around madly in XML file when undoing while auto-revert-mode updates buffer
  2013-10-10 14:14   ` Barry OReilly
@ 2013-10-18 14:04     ` Barry OReilly
  2021-08-20 15:28     ` Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Barry OReilly @ 2013-10-18 14:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15567

[-- Attachment #1: Type: text/plain, Size: 82 bytes --]

Rev 114704 addresses bug 1 described earlier. Leaving this open to
address bug 2.

[-- Attachment #2: Type: text/html, Size: 114 bytes --]

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

* bug#15567: Point jumps around madly in XML file when undoing while auto-revert-mode updates buffer
  2013-10-10 14:14   ` Barry OReilly
  2013-10-18 14:04     ` Barry OReilly
@ 2021-08-20 15:28     ` Lars Ingebrigtsen
  2021-09-17 16:01       ` Lars Ingebrigtsen
  1 sibling, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-20 15:28 UTC (permalink / raw)
  To: Barry OReilly; +Cc: 15567, Stefan Monnier

Barry OReilly <gundaetiapo@gmail.com> writes:

>    2: That there are more than one rng-validate-while-idle timers.
>
> In order to more directly verify bug 2, I ran with this:

[...]

> +(defvar rng-validate-timers '())

[...]

> +      (cl-pushnew rng-validate-timer rng-validate-timers))))

Barry OReilly <gundaetiapo@gmail.com> writes:

> Rev 114704 addresses bug 1 described earlier. Leaving this open to
> address bug 2.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I've tried to reproduce bug 2, but I'm not able to (in Emacs 28)...  but
I'm not quite sure I understand the test case.

rng-validate-timer is buffer-local, rng-validate-timers isn't, so if you
have more than two xml buffers, you'll end up with two timers on that
list (as you should, I think?)  Or do I misunderstand what the problem
is (if it still exists -- this is a seven year old bug report).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#15567: Point jumps around madly in XML file when undoing while auto-revert-mode updates buffer
  2021-08-20 15:28     ` Lars Ingebrigtsen
@ 2021-09-17 16:01       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-17 16:01 UTC (permalink / raw)
  To: Barry OReilly; +Cc: 15567, Stefan Monnier

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I've tried to reproduce bug 2, but I'm not able to (in Emacs 28)...  but
> I'm not quite sure I understand the test case.
>
> rng-validate-timer is buffer-local, rng-validate-timers isn't, so if you
> have more than two xml buffers, you'll end up with two timers on that
> list (as you should, I think?)  Or do I misunderstand what the problem
> is (if it still exists -- this is a seven year old bug report).

More information was requested, but no response was given within a
month, so I'm closing this bug report.  If the problem still exists,
please respond to this email and we'll reopen the bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-09-17 16:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-08 23:07 bug#15567: Point jumps around madly in XML file when undoing while auto-revert-mode updates buffer Barry OReilly
2013-10-09 12:29 ` Stefan Monnier
2013-10-10 14:14   ` Barry OReilly
2013-10-18 14:04     ` Barry OReilly
2021-08-20 15:28     ` Lars Ingebrigtsen
2021-09-17 16:01       ` Lars Ingebrigtsen

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