emacs-devel
[Top][All Lists]
Advanced

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

Re: Why is this-command-keys missing?


From: Stefan Monnier
Subject: Re: Why is this-command-keys missing?
Date: Sat, 01 Jan 2011 23:19:43 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> I am trying to use orgstruct-mode for a compilation output buffer.
> orgstruct-mode binds keys like this:

>     ;; Special treatment needed for TAB and RET
>     (org-defkey orgstruct-mode-map [(tab)]
>               (orgstruct-make-binding 'org-cycle 102 [(tab)] "\C-i"))
>     (org-defkey orgstruct-mode-map "\C-i"
>               (orgstruct-make-binding 'org-cycle 103 "\C-i" [(tab)]))

I don't know what this does, nor why it seems to bind both "\C-i" and
[(tab)].

> However I would like to get back the normal TAB handling in the
> compilation output buffer when not on an outline heading.

So, you don't care which command was run, but instead you want to
delegate to the other command which would be run if you ignore the
"currently used" binding.  This is a common need, of course.  With many
different solutions, none of them perfect:
- Use a menu-item binding with a :filter so the binding can be computed
  dynamically (i.e. it's bound to org-cycle if point is on a heading,
  and to nil otherwise).
- lookup with (key-binding (this-command-keys)) disabling your own
  key-binding (easy if it's on a minor-mode map or something similar).
  Usually (this-command-keys) does work, tho you claim it doesn't for
  you (still waiting for details on this problem).
- lookup (key-binding <some-hard-coded-key>).
- use a hard-coded fallback command.
- disable your binding, then push this-command-raw-keys back on
  unread-command-events, while arranging to re-enable the binding
  after the next command.


        Stefan



reply via email to

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