[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suggestion: Simple way to make conditional key bindings.
From: |
David PONCE |
Subject: |
Re: Suggestion: Simple way to make conditional key bindings. |
Date: |
Fri, 23 Aug 2002 14:52:10 +0200 (MET DST) |
Hi Kim,
> Sometimes you would like a specific key binding to be controlled
> by some global or local state, but you really don't want to mess
> with minor-mode keymaps etc.
>
[...]
>
> One use would be to bind C-y to `yank' except when the first element
> in the kill-ring is a table, in which case we want to run
> `yank-with-properties':
>
>
> (global-set-key "\C-y"
> '(cond
> ((and kill-ring (table-recognize-table (car kill-ring)))
> yank-with-properties)
> (t yank)))
>
>
> One advantage (IMO) is that C-h k C-y will report yank or
> yank-with-properties depending on the actual function taken if
> you hit C-y.
>
> WDYT ?
It seems that you can do something similar this way:
(global-set-key "\C-y" '(menu-item "my-filter" :filter my-filter))
(defun my-filter (&rest ignore)
(cond
((and kill-ring (table-recognize-table (car kill-ring)))
'yank-with-properties)
(t 'yank)))
Am I wrong?
Sincerely,
David
- Suggestion: Simple way to make conditional key bindings., Kim F. Storm, 2002/08/23
- Re: Suggestion: Simple way to make conditional key bindings.,
David PONCE <=
- Re: Suggestion: Simple way to make conditional key bindings., Kim F. Storm, 2002/08/23
- Re: Suggestion: Simple way to make conditional key bindings., Stefan Monnier, 2002/08/23
- Re: Suggestion: Simple way to make conditional key bindings., Kim F. Storm, 2002/08/25
- Re: Suggestion: Simple way to make conditional key bindings., Stefan Monnier, 2002/08/26
- Re: Suggestion: Simple way to make conditional key bindings., Miles Bader, 2002/08/26
- Re: Suggestion: Simple way to make conditional key bindings., Richard Stallman, 2002/08/27
- Re: Suggestion: Simple way to make conditional key bindings., Kim F. Storm, 2002/08/27
- Re: Suggestion: Simple way to make conditional key bindings., Richard Stallman, 2002/08/28
- Re: Suggestion: Simple way to make conditional key bindings., Kim F. Storm, 2002/08/29
- Re: Suggestion: Simple way to make conditional key bindings., Miles Bader, 2002/08/27