bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17007: 24.3.50; describe-key/function evaluates documentation functi


From: João Távora
Subject: bug#17007: 24.3.50; describe-key/function evaluates documentation function in the wrong buffer
Date: Sun, 16 Mar 2014 13:27:50 +0000

On Sun, Mar 16, 2014 at 10:02 AM, martin rudalics <rudalics@gmx.at> 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))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]