On Sun, Mar 16, 2014 at 10:02 AM, martin rudalics wrote: > > The 24.3 version of with-help-window used with-output-to-temp-buffer > > AFAICT. > > `with-temp-buffer-window' code some checking? After all, you were the > one who detected the inconsistency that was the root of all evil here > and I trust that you could detect any remaining inconsistencies as well. > > Thanks, martin > Thanks, will do, as soon as I have time to make a new build. I wonder if one could write unit tests for these scenarios... Just a thought, not thoroughly tested, and could be brittle: (ert-deftest help-window-describe-function-in-correct-buffer () "Check if `function-documentation' is eval'ed in right buffer." (defun help-foo ()) (defun help-foo-doc () (format "Does nothing, but your tab does `%s'" (key-binding "\t"))) (put 'help-foo 'function-documentation '(foo-doc)) (let* ((selected-window-before (selected-window)) (text (describe-function 'help-foo)) (help-windows (get-buffer-window-list "*Help*"))) (unwind-protect (progn (should (eq selected-window-before (selected-window))) (should (= 1 (length help-windows))) (with-selected-window (car help-windows) (should-error (search-forward "forward-button")))) (delete-other-windows))))