unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6462: `disabled-command-function' corrupts the `help-xref-stack'
@ 2010-06-18 21:17 MON KEY
  2011-03-03 17:57 ` bug#6462: bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss MON KEY
  2021-06-03  8:43 ` bug#6462: `disabled-command-function' corrupts the `help-xref-stack' Lars Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: MON KEY @ 2010-06-18 21:17 UTC (permalink / raw)
  To: 6462

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\





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6462: bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss
  2010-06-18 21:17 bug#6462: `disabled-command-function' corrupts the `help-xref-stack' MON KEY
@ 2011-03-03 17:57 ` MON KEY
  2021-06-03  8:43 ` bug#6462: `disabled-command-function' corrupts the `help-xref-stack' Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: MON KEY @ 2011-03-03 17:57 UTC (permalink / raw)
  To: 8147; +Cc: 6462, Stephen Berman

,----
| 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\





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6462: `disabled-command-function' corrupts the `help-xref-stack'
  2010-06-18 21:17 bug#6462: `disabled-command-function' corrupts the `help-xref-stack' MON KEY
  2011-03-03 17:57 ` bug#6462: bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss MON KEY
@ 2021-06-03  8:43 ` Lars Ingebrigtsen
  2021-07-01 11:43   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-03  8:43 UTC (permalink / raw)
  To: MON KEY; +Cc: 6462

MON KEY <monkey@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#6462: `disabled-command-function' corrupts the `help-xref-stack'
  2021-06-03  8:43 ` bug#6462: `disabled-command-function' corrupts the `help-xref-stack' Lars Ingebrigtsen
@ 2021-07-01 11:43   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-01 11:43 UTC (permalink / raw)
  To: MON KEY; +Cc: 6462

Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-01 11:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-18 21:17 bug#6462: `disabled-command-function' corrupts the `help-xref-stack' MON KEY
2011-03-03 17:57 ` bug#6462: bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss MON KEY
2021-06-03  8:43 ` bug#6462: `disabled-command-function' corrupts the `help-xref-stack' Lars Ingebrigtsen
2021-07-01 11:43   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).