From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <5322E8C0.5020106@gmx.at> <5323137D.2020103@gmx.at> <87txb0g6r7.fsf@yahoo.fr> <532576A7.6090600@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c124f62a62e304f4b94636 X-Trace: ger.gmane.org 1394976549 19807 80.91.229.3 (16 Mar 2014 13:29:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Mar 2014 13:29:09 +0000 (UTC) Cc: Nicolas Richard , 17007@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 16 14:29:17 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WPB7s-0000Up-QM for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Mar 2014 14:29:17 +0100 Original-Received: from localhost ([::1]:53325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPB7s-00044Q-Br for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Mar 2014 09:29:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPB7k-00044K-R7 for bug-gnu-emacs@gnu.org; Sun, 16 Mar 2014 09:29:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPB7g-00013H-1o for bug-gnu-emacs@gnu.org; Sun, 16 Mar 2014 09:29:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36805) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPB7f-00013D-Qn for bug-gnu-emacs@gnu.org; Sun, 16 Mar 2014 09:29:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WPB7f-0006L3-4R for bug-gnu-emacs@gnu.org; Sun, 16 Mar 2014 09:29:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Mar 2014 13:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17007 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17007-submit@debbugs.gnu.org id=B17007.139497649824303 (code B ref 17007); Sun, 16 Mar 2014 13:29:02 +0000 Original-Received: (at 17007) by debbugs.gnu.org; 16 Mar 2014 13:28:18 +0000 Original-Received: from localhost ([127.0.0.1]:37987 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPB6t-0006Jp-MH for submit@debbugs.gnu.org; Sun, 16 Mar 2014 09:28:16 -0400 Original-Received: from mail-qa0-f50.google.com ([209.85.216.50]:61102) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPB6o-0006Jb-LO for 17007@debbugs.gnu.org; Sun, 16 Mar 2014 09:28:13 -0400 Original-Received: by mail-qa0-f50.google.com with SMTP id o15so4263381qap.23 for <17007@debbugs.gnu.org>; Sun, 16 Mar 2014 06:28:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=nEmcfu/kWpKxHxhKm1aEV85viVDX6BdifZPrxlQVsj8=; b=ZAtB0gPySWwaYCM3roeDeIiwoeTAr+NykmzXpGQcmuEanHzH1+Bjm4UXjLI6nblGL8 dMTL5gMl3KzGuwfYbmCzQ0eLQtBHN0WJg8tGTqp8G0G8zjTuEl7pbVj/G5bd1DHf0LZJ GnT4h5WV2SBwbNaJ4J6Uc5Nny0DDGHBiWaeg/Qn+lAqruMuoqOITbtiLJnMVCtPQUEgi Yv2g8p6WKFoK0nRJ9/UWyOn82cmLoLXl+Si95Zjc9LrlEZHvvCfjwI+oi/N+9pnz3AuH EiyLXEkVjTXRc3vskRKpGfUOXpSilPXTyab+Cs8LSUWEh4ZxATbXday3/JW5+akryvwy zgOw== X-Received: by 10.140.20.17 with SMTP id 17mr21186352qgi.28.1394976490150; Sun, 16 Mar 2014 06:28:10 -0700 (PDT) Original-Received: by 10.229.47.201 with HTTP; Sun, 16 Mar 2014 06:27:50 -0700 (PDT) In-Reply-To: <532576A7.6090600@gmx.at> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:86894 Archived-At: --001a11c124f62a62e304f4b94636 Content-Type: text/plain; charset=ISO-8859-1 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)))) --001a11c124f62a62e304f4b94636 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Sun, Mar 16, 2014 at 10:02 AM, martin rudalics <rud= alics@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? =A0After all, you wer= e 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 o= ne 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-buffe= r
=A0 =A0 ()
=A0 "Check if `function-documentation= ' is eval'ed in right
=A0 buffer."
=A0 (defun help-foo ())
=A0 (def= un help-foo-doc ()
=A0 =A0 (format "Does nothing, but your t= ab does `%s'"
=A0 =A0 =A0 =A0 =A0 =A0 (key-binding "= ;\t")))
=A0 (put 'help-foo 'function-documentation '(foo-doc))
=A0 (let* ((selected-window-before (selected-window))
=A0 = =A0 =A0 =A0 =A0(text (describe-function 'help-foo))
=A0 =A0 = =A0 =A0 =A0(help-windows (get-buffer-window-list "*Help*")))
=A0 =A0 (unwind-protect
=A0 =A0 =A0 =A0 (progn=A0
= =A0 =A0 =A0 =A0 =A0 (should (eq selected-window-before (selected-window)))<= /div>
=A0 =A0 =A0 =A0 =A0 (should (=3D 1 (length help-windows)))
<= div>=A0 =A0 =A0 =A0 =A0 (with-selected-window
=A0 =A0 =A0 =A0 =A0 =A0 =A0 (car help-windows)
=A0 =A0 =A0 = =A0 =A0 =A0 (should-error (search-forward "forward-button"))))
=A0 =A0 =A0 (delete-other-windows))))
--001a11c124f62a62e304f4b94636--