GNU bug report logs - #6462
`disabled-command-function' corrupts the `help-xref-stack'

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: MON KEY <monkey@HIDDEN>; dated Fri, 18 Jun 2010 21:18:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 6462 <at> debbugs.gnu.org:


Received: (at 6462) by debbugs.gnu.org; 3 Mar 2011 17:57:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 12:57:11 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PvClz-0007np-E6
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2011 12:57:11 -0500
Received: from mail-ww0-f46.google.com ([74.125.82.46])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <stan@HIDDEN>)
	id 1PvClx-0007nZ-HK; Thu, 03 Mar 2011 12:57:10 -0500
Received: by wwc33 with SMTP id 33so1665716wwc.15
	for <multiple recipients>; Thu, 03 Mar 2011 09:57:03 -0800 (PST)
MIME-Version: 1.0
Received: by 10.216.182.212 with SMTP id o62mr903116wem.52.1299175023456; Thu,
	03 Mar 2011 09:57:03 -0800 (PST)
Received: by 10.216.26.4 with HTTP; Thu, 3 Mar 2011 09:57:03 -0800 (PST)
Date: Thu, 3 Mar 2011 12:57:03 -0500
X-Google-Sender-Auth: wDq8_sPVBDwOdk46GeKwm9HqlEs
Message-ID: <AANLkTin_2u6FWzV1MtK1ErgAqxFOaF26XicC8wxvd5DX@HIDDEN>
Subject: Re: bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss
From: MON KEY <monkey@HIDDEN>
To: 8147 <at> debbugs.gnu.org
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -3.7 (---)
X-Debbugs-Envelope-To: 6462
Cc: 6462 <at> debbugs.gnu.org, Stephen Berman <stephen.berman@HIDDEN>,
	Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.7 (---)

,----
| 5. Click on one of the buttons in the inserted text that links to
|    another doc string, e.g. `try-completion'.
`----

Unmentioned, but probably relevant is that clicking on these buttons
will likely corrupt the `help-xref-stack' as well...

See for example bug #6462
 `disabled-command-function' corrupts the `help-xref-stack'
 http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6462

--
/s_P\




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6462; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Jun 2010 21:17:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 18 17:17:18 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OPiwA-0007W0-A3
	for submit <at> debbugs.gnu.org; Fri, 18 Jun 2010 17:17:18 -0400
Received: from mx10.gnu.org ([199.232.76.166])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <stan@HIDDEN>) id 1OPiw8-0007Vv-4B
	for submit <at> debbugs.gnu.org; Fri, 18 Jun 2010 17:17:16 -0400
Received: from lists.gnu.org ([199.232.76.165]:38509)
	by monty-python.gnu.org with esmtps
	(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
	(envelope-from <stan@HIDDEN>) id 1OPiw3-00025P-QV
	for submit <at> debbugs.gnu.org; Fri, 18 Jun 2010 17:17:11 -0400
Received: from [140.186.70.92] (port=36145 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OPivy-000575-RV
	for bug-gnu-emacs@HIDDEN; Fri, 18 Jun 2010 17:17:11 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE
	autolearn=unavailable version=3.3.1
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <stan@HIDDEN>) id 1OPivu-00032p-4Y
	for bug-gnu-emacs@HIDDEN; Fri, 18 Jun 2010 17:17:06 -0400
Received: from mail-yw0-f192.google.com ([209.85.211.192]:61955)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <stan@HIDDEN>) id 1OPivu-00032V-0M
	for bug-gnu-emacs@HIDDEN; Fri, 18 Jun 2010 17:17:02 -0400
Received: by ywh30 with SMTP id 30so1497647ywh.24
	for <bug-gnu-emacs@HIDDEN>; Fri, 18 Jun 2010 14:17:01 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.150.104.2 with SMTP id b2mr1701133ybc.162.1276895820869; Fri, 
	18 Jun 2010 14:17:00 -0700 (PDT)
Received: by 10.151.10.5 with HTTP; Fri, 18 Jun 2010 14:17:00 -0700 (PDT)
Date: Fri, 18 Jun 2010 17:17:00 -0400
X-Google-Sender-Auth: Mx7BUResOaah1R1osQWas6AZC9o
Message-ID: <AANLkTikU8xXHqUPDksxtYcMOoZPqC6Wr9t1CXkYCOH5j@HIDDEN>
Subject: `disabled-command-function' corrupts the `help-xref-stack'
From: MON KEY <monkey@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
	seldom 2.4 (older, 4)
X-Spam-Score: -3.7 (---)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.0 (-----)

The `disabled-command-function's window-excursion via
`help-setup-xref'->`with-output-to-temp-buffer' can corrupt the
`help-xref-stack' b/c/ of with these lines:

,----
| (help-setup-xref (list 'disabled-command-function cmd keys) nil)
|       (with-output-to-temp-buffer "*Disabled Command*" ;; (help-buffer)
`----

The present functionality is brainded because the "*Disabled Command*"
stays on the `help-xref-stack'.

This is stupid because `disabled-command-function' grabs all keyboard
input except `keyboard-quit' so it is not realistic for the user to
inspect the `goal-column' variable via `help-mode's xrefs anyway.

Moreover, because `with-output-to-temp-buffer' spits its message to the
"*Disabled-Command*" buffer we now have a broken/compromized
`help-xref-stack' _and_ a lingering "*Disabled-Command*" buffer which
lacks any buttonized navigation (though these buttons wouldn't
function correctly even if they were there)

Noteic, the commented sources above indicate that at some point the
output may have gone to the value of (help-buffer). Though, I don't
quite get why `disabled-command-function' is be piggybacking on
`help-setup-xref' in the first place.

Regardless, disabled-command-function should take care better care to
clean up after itself by:

 a) removing itself from the `help-xref-stack'

 b) detecting inside an unwind-protect whether `last-command' was a
    `keyboard-quit' and if so automatically deleting itself (no
    questions asked). You've already stolen my keyboard out from under
    me, there is no reason to leave this buffer laying around esp. as
    its gonna keep popping up again and again anyways.

A recipe to reproduce the offending behavior:

(progn
  (when (get-buffer "*Help*")
    (kill-buffer (get-buffer "*Help*")))
  (unless (get 'set-goal-column 'disabled)
    (put 'set-goal-column 'disabled t))
  (describe-function  'enable-command)
  (with-current-buffer (get-buffer "*Help*")
    (describe-function  'disabled-command-function)
    (help-go-back))
  (pop-to-buffer (get-buffer "*Help*")))

Tickle the command-loop to trigger on `set-goal-column' by typing:

 "C-x C-n"

Tell the `disabled-command-function' to get f*cked by typing:

 "n"

Remap `set-goal-column' to something irrelevant:

 (define-key ctl-x-map [remap set-goal-column]  'ignore)

Now navigate through the `help-xref-stack' with either:
 "C-c C-b" `help-go-back'
 "C-C C-f" `help-go-forward'

You should eventually run into the "*Disabled Command*" buffer.

At which point `disabled-command-function' should then proceed to grab
your keyboard and ask you to "select Y/N SPC !".

Tell it to get f*cked again. (try "C-k" this time just for kicks)

Scratch head for a moment before determining that while the following
will fix one problem it will create others:

 (setq disabled-command-function  'ignore) ;; 'undefined)

Cleanup the mess we've made by putting `set-goal-column' back on the
ctl-x-map and enable/disable it:

 (define-key ctl-x-map "\C-n" 'set-goal-column)

 (put 'set-goal-column 'disabled { nil | t } ))


Verified with Emacs "23.2.1" emacs -Q

Verified current through lisp/novice.el sources circa bzr revision 100577

--
/s_P\




Acknowledgement sent to MON KEY <monkey@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6462; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.