Subject: bug#29348: 26.0.50; shr.el heisenbug

From: Devon Sean McCullough <[email-masked]>
Date: Sun, 19 Nov 2017 18:56:14 -0500

cd /tmp
cURL -O http://jovi.net/shr.txz
tar -xp < shr.txz
cd shr
Open -n -a Emacs --args -Q --funcall toggle-debug-on-error --chdir /tmp/shr CNWebGL.js --load opengl-help.el --load shr-bug.el --funcall shr-trace

In the CNWebGL.js buffer, press the [f12] function key to view the next OpenGL call with documentation...
The first keypress or so should produce a good *Help* buffer with a proper title and name
but after three or four keypresses, mangled *Help* buffers will appear
with the C prototype at the top and the title at the bottom
because the table renderer bashed point in *Help*.

Example with annotated trace:

 CNWebGL.js
	gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);

 *Help*
 void glClear(  GLbitfield mask);  
 
Parameters
... here follows the rest of the doc ... then finally the misplaced first few lines:
glClear

Name

glClear — clear buffers to preset values

C Specification

 *trace-output*
======================================================================
1 -> (shr-render-region 1 6499) 20171119-164938.962420 •*Help*…❮6499❯⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…

| 2 -> (shr-pixel-column) 20171119-164938.963020 *Help*⊣❮1❯⊢• *temp*⊣-⊂2⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 -> (current-window-configuration) 20171119-164938.963084 *Help*⊣❮1❯⊢• *temp*⊣-⊂2⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 <- current-window-configuration: #<window-configuration> 20171119-164938.963137 *Help*⊣❮1❯⊢• *temp*⊣-⊂2⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 -> (set-window-configuration #<window-configuration>) 20171119-164938.963212 *Help*⊣❮1❯⊢⧉• *temp*⊣-❮2❯⊢
;;; moot
| | 3 <- set-window-configuration: t 20171119-164938.963316 *Help*⊣❮1❯⊢• *temp*⊣-⊂2⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| 2 <- shr-pixel-column: 7 20171119-164938.963362 *Help*⊣❮1❯⊢• *temp*⊣-⊂2⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…

| 2 -> (shr-pixel-column) 20171119-164938.963420 *Help*⊣❮1❯⊢• *temp*⊣* ⊂3⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 -> (current-window-configuration) 20171119-164938.963468 *Help*⊣❮1❯⊢• *temp*⊣* ⊂3⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 <- current-window-configuration: #<window-configuration> 20171119-164938.963513 *Help*⊣❮1❯⊢• *temp*⊣* ⊂3⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 -> (set-window-configuration #<window-configuration>) 20171119-164938.963570 *Help*⊣❮1❯⊢⧉• *temp*⊣* ❮3❯⊢
;;; moot
| | 3 <- set-window-configuration: t 20171119-164938.963660 *Help*⊣❮1❯⊢• *temp*⊣* ⊂3⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| 2 <- shr-pixel-column: 14 20171119-164938.963702 *Help*⊣❮1❯⊢• *temp*⊣* ⊂3⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…

| 2 -> (shr-render-td-1 (td nil (code ((class . "funcdef")) "void " (strong ((class . "fsfunc")) "glClear") "(")) 325 nil) 20171119-164938.963916 •*Help*…❮75❯⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 -> (current-window-configuration) 20171119-164938.964003 *Help*…❮75❯⊢• *temp*⊣void glClear(⊂14⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 <- current-window-configuration: #<window-configuration> 20171119-164938.964067 *Help*…❮75❯⊢• *temp*⊣void glClear(⊂14⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 -> (shr-pixel-buffer-width) 20171119-164938.964130 *Help*…❮75❯⊢⧉• *temp*⊣void glClear(❮14❯⊢
| | 3 <- shr-pixel-buffer-width: 71 20171119-164938.964196 *Help*…❮75❯⊢⧉• *temp*⊣void glClear(❮14❯⊢
| | 3 -> (set-window-configuration #<window-configuration>) 20171119-164938.964238 *Help*…❮75❯⊢⧉• *temp*⊣void glClear(❮14❯⊢

;;; ***BUG***
;;; Before
;;;	*Help* is visible in the other window
;;;	 *temp* is the current buffer in the selected window, presumably undisplayed but hypothetically "visible"
;;;	CNWebGL.js is neither current nor visible in any window
;;; *** `set-window-configuration' clobbers *Help* point from 75 at EoB to 1 at BoB ***
;;; After
;;;	*Help* is visible in the other window
;;;	 *temp* is the current buffer not visible in any window
;;;	CNWebGL.js is visible in the selected window
;;; ***BUG***

| | 3 <- set-window-configuration: t 20171119-164938.964342 *Help*⊣❮1❯glClear…• *temp*⊣void glClear(⊂14⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| 2 <- shr-render-td-1: (71 71 1 (#("void glClear(" 0 1 (face variable-pitch shr-indentation 0) 1 5 (face variable-pitch) 5 12 (face (variable-pitch bold)) 12 13 (face variable-pitch))) 1 nil nil) 20171119-164938.964426 •*Help*⊣❮1❯glClear…⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…

| 2 -> (shr-render-td-1 (td nil "GLbitfield " (var ((class . "pdparam")) "mask") (code nil ")") ";") 325 nil) 20171119-164938.964499 •*Help*⊣❮1❯glClear…⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 -> (current-window-configuration) 20171119-164938.964583 *Help*⊣❮1❯glClear…• *temp*…tfield mask);⊂18⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 <- current-window-configuration: #<window-configuration> 20171119-164938.964688 *Help*⊣❮1❯glClear…• *temp*…tfield mask);⊂18⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| | 3 -> (shr-pixel-buffer-width) 20171119-164938.964759 *Help*⊣❮1❯glClear…⧉• *temp*…tfield mask);❮18❯⊢
| | 3 <- shr-pixel-buffer-width: 91 20171119-164938.964837 *Help*⊣❮1❯glClear…⧉• *temp*…tfield mask);❮18❯⊢
| | 3 -> (set-window-configuration #<window-configuration>) 20171119-164938.964888 *Help*⊣❮1❯glClear…⧉• *temp*…tfield mask);❮18❯⊢
;;; equivocal
| | 3 <- set-window-configuration: t 20171119-164938.964996 *Help*⊣❮1❯glClear…• *temp*…tfield mask);⊂18⊃⊢⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…
| 2 <- shr-render-td-1: (91 91 1 (#("GLbitfield mask);" 0 1 (face variable-pitch shr-indentation 0) 1 11 (face variable-pitch) 11 15 (face variable-pitch) 15 16 (face variable-pitch) 16 17 (face variable-pitch))) 1 nil nil) 20171119-164938.965075 •*Help*⊣❮1❯glClear…⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…

1 <- shr-render-region: nil 20171119-164938.968888 •*Help*…❮1669❯glClear…⧉CNWebGL.js…	gl.❮4220❯clear(gl.COLO…