all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: emacs-devel@gnu.org, Tassilo Horn <tassilo@member.fsf.org>
Subject: Re: A simple implementation of context-sensitive keys
Date: Wed, 10 Sep 2008 12:36:10 +0200	[thread overview]
Message-ID: <48C7A31A.3000500@gmail.com> (raw)
In-Reply-To: <87y72079mg.fsf@thinkpad.tsdh.de>

Tassilo Horn wrote:
> Hi all,
> 
> to get the full power out of emacs, I use quite a lot of different minor
> modes with a ton of home-brewn functions.  To make them quickly
> accessible, I've bound them to some key.  But "good" keys are rare, and
> so I started writing special dispatching commands which DTRT dependend
> on the context they're used in.  But that's quite cumbersome, because
> ideally you have to recognize each command which would normally be bound
> to the key, too.
> 
> So I've come up with this macro, which creates such a dispatching
> command automagically.  If none of the context predicates match, the
> default command bound to the key will be executed.
> 
> --8<---------------cut here---------------start------------->8---
> (defmacro define-context-key (mode key preds-funs)
>   "Bind KEY to an anonymous dispatching command in MODE.
> PREDS-FUNS is an alist with elements of the form


Hi Tassilo

I think there are a number of packages out there doing quite similar
things: smart-tab, tabkey2, hippi-expand.

Those are all focused on completion, but that is more a conceptual focus
(which I think is good). By default they bind the Tab key (which you
also did in your example). Maybe it would be good to generalize that as
you did here.

In tabkey2.el (did you notice it when I sent it to this list?) I have
tried to write the supporting functions needed to make the key bindings
transparent to the user. You are welcome to contribute to it if you want
too. The latest version is always in nXhtml on Launchpad.

BTW Yasnippet is a kind of completion function.




  reply	other threads:[~2008-09-10 10:36 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-10  7:17 A simple implementation of context-sensitive keys Tassilo Horn
2008-09-10 10:36 ` Lennart Borgman (gmail) [this message]
2008-09-10 10:57   ` Tassilo Horn
2008-09-10 16:43     ` Ted Zlatanov
2008-09-10 14:14 ` Sean O'Rourke
2008-09-10 14:48   ` Miles Bader
2008-09-10 14:53     ` Juanma Barranquero
2008-09-10 15:17       ` Sean O'Rourke
2008-09-10 15:32         ` Juanma Barranquero
2008-09-11  7:35     ` Tassilo Horn
2008-09-11  8:17       ` Miles Bader
2008-09-11  8:48         ` Tassilo Horn
2008-09-10 17:49 ` Stefan Monnier
2008-09-10 19:21   ` Tassilo Horn
2008-09-11  1:41     ` Stefan Monnier
2008-09-11  7:17       ` Tassilo Horn
2008-09-11 14:40         ` Ted Zlatanov
2008-09-11 15:53           ` Tassilo Horn
2008-09-11 13:41       ` Lennart Borgman (gmail)
2008-09-11 13:48         ` Lennart Borgman (gmail)
2008-09-11 14:22           ` Tassilo Horn
2008-09-11 20:38             ` Lennart Borgman (gmail)
2008-09-12  6:58               ` Tassilo Horn
2008-09-12  8:34                 ` Lennart Borgman (gmail)
2008-09-12  9:47                   ` Tassilo Horn
2008-09-12 11:00                     ` Lennart Borgman
2008-09-12 16:13                       ` Tassilo Horn
2008-09-12 23:46                         ` Lennart Borgman (gmail)
2008-09-13  7:28                           ` Tassilo Horn
2008-09-13  9:32                             ` Lennart Borgman (gmail)
2008-09-15  7:26                               ` Tassilo Horn
2008-09-15 22:39                                 ` Lennart Borgman (gmail)
2008-09-11 20:44         ` Stefan Monnier
2008-09-11 21:14           ` Lennart Borgman (gmail)
2008-09-12  1:33             ` Stefan Monnier
2008-09-12  8:29               ` Lennart Borgman (gmail)

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=48C7A31A.3000500@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=tassilo@member.fsf.org \
    /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.