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

Previous Next

Package: emacs;

Reported by: MON KEY <monkey <at> sandpframing.com>

Date: Fri, 18 Jun 2010 21:18:01 UTC

Severity: normal

Tags: moreinfo

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6462 in the body.
You can then email your comments to 6462 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6462; Package emacs. (Fri, 18 Jun 2010 21:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to MON KEY <monkey <at> sandpframing.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 18 Jun 2010 21:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: MON KEY <monkey <at> sandpframing.com>
To: bug-gnu-emacs <at> gnu.org
Subject: `disabled-command-function' corrupts the `help-xref-stack'
Date: Fri, 18 Jun 2010 17:17:00 -0400
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\




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6462; Package emacs. (Thu, 03 Mar 2011 17:58:01 GMT) Full text and rfc822 format available.

Message #8 received at 6462 <at> debbugs.gnu.org (full text, mbox):

From: MON KEY <monkey <at> sandpframing.com>
To: 8147 <at> debbugs.gnu.org
Cc: 6462 <at> debbugs.gnu.org, Stephen Berman <stephen.berman <at> gmx.net>,
	Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss
Date: Thu, 3 Mar 2011 12:57:03 -0500
,----
| 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 bug-gnu-emacs <at> gnu.org:
bug#6462; Package emacs. (Thu, 03 Jun 2021 08:44:01 GMT) Full text and rfc822 format available.

Message #11 received at 6462 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: MON KEY <monkey <at> sandpframing.com>
Cc: 6462 <at> debbugs.gnu.org
Subject: Re: bug#6462: `disabled-command-function' corrupts the
 `help-xref-stack'
Date: Thu, 03 Jun 2021 10:43:15 +0200
MON KEY <monkey <at> sandpframing.com> writes:

> 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.

(I'm going through old bug reports that unfortunately got no response at
the time.)

I'm trying to follow the recipe, but you lost me here -- I just get "no
previous help buffer".

Are you still seeing this problem in more recent Emacs versions?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 03 Jun 2021 08:44:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6462; Package emacs. (Thu, 01 Jul 2021 11:44:02 GMT) Full text and rfc822 format available.

Message #16 received at 6462 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: MON KEY <monkey <at> sandpframing.com>
Cc: 6462 <at> debbugs.gnu.org
Subject: Re: bug#6462: `disabled-command-function' corrupts the
 `help-xref-stack'
Date: Thu, 01 Jul 2021 13:43:10 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I'm trying to follow the recipe, but you lost me here -- I just get "no
> previous help buffer".
>
> Are you still seeing this problem in more recent Emacs versions?

More information was requested, but no response was given within a
month, so I'm closing this bug report.  If the problem still exists,
please respond to this email and we'll reopen the bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 6462 <at> debbugs.gnu.org and MON KEY <monkey <at> sandpframing.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 01 Jul 2021 11:44:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 30 Jul 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 325 days ago.

Previous Next


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