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

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

bug#6462: `disabled-command-function' corrupts the `help-xref-stack'


From: MON KEY
Subject: bug#6462: `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\





reply via email to

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