From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lennart Borgman <lennart.borgman@gmail.com>
Cc: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Re: Why is this-command-keys missing?
Date: Sat, 01 Jan 2011 23:19:43 -0500 [thread overview]
Message-ID: <jwvy67454hr.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <AANLkTinpSQz2nEVZnYiQxKXEgdz9Jxg-AFCPEwwjafTv@mail.gmail.com> (Lennart Borgman's message of "Sun, 2 Jan 2011 03:38:51 +0100")
> 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
next prev parent reply other threads:[~2011-01-02 4:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-01 18:59 Why is this-command-keys missing? Lennart Borgman
2011-01-02 1:57 ` Stefan Monnier
2011-01-02 2:38 ` Lennart Borgman
2011-01-02 4:19 ` Stefan Monnier [this message]
2011-01-02 4:29 ` Lennart Borgman
2011-01-02 14:42 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvy67454hr.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.