[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Resolving Key Sequence conflict between icicles and org-mode
From: |
Anupam Sengupta |
Subject: |
Re: Resolving Key Sequence conflict between icicles and org-mode |
Date: |
Wed, 23 May 2007 21:31:31 -0700 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (darwin) |
>> Recently, I came across Icicles mode, which seems to offer
>> features far beyond IDO. However, there is a key sequence
>> conflict between the Org-Mode and Icicles packages - on
> Shift-Tab <s-tab>).
>>
>> Org-Mode uses <s-tab> for the org-shifttab function to cycle
>> global visibility of the outline, whereas Icicles binds this
>> key to icicle-generic-S-tab for completions.
>>
>> Is there a way to locally rebind <s-tab> in Org-Mode buffers to
>> be the original org-shifttab function?
>>
>> I did try M-x local-set-key to try binding <s-tab> to org-shifttab in a
>> org-mode buffer, however, this does not seem to help (the binding
>> still remains with Icicles).
>
> That is because the Icicles binding is a minor-mode binding. Whenever
> you
> are in Icicle mode, the bindings in `icicle-mode-map' are in effect.
> Minor
> mode bindings override global and local bindings.
Hmm ... did not know that.
>> I also tried (define-key org-mode-map "<S-tab>" 'org-shifttab)
>> in my .emacs after Org-mode and Icicles was loaded, but this
>> does not work either.
>
> I assume that Org mode is a major mode. Minor mode bindings take
> precedence.
>
You are right. Org-mode *is* the major mode here.
>> Any suggestions would be really welcome, as Icicles is a feature
>> which looks pretty useful.
>
> I see two choices:
> 1) use a different key for the Org mode command or
Not an option :-( Muscle memory is too strong here :-)
> 2) use a different key for Icicle mode ;-).
Workable, as long as it is applicable for only the Org-mode. I am happy with
[S-tab] for all other Icicle operations.
> For information about Icicles key bindings, see
> http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Key_Bindings.
>
> For information about customizing Icicles key bindings, see
>
>
> http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Customizing_Key_Bindings.
>
> Other possibilities include:
> 1) redefining `icicle-generic-S-tab' to call `org-shifttab' when in Org
> mode
> 2) binding S-TAB to a command that calls `org-shifttab' when in Org
> mode and
> `icicle-generic-S-tab' otherwise.
Thanks !This option seems the best one right now. See code below for the
solution I cam
up with. Quite possibly not the best lisp-code out there, but works ;-)
(require 'icicles)
(require 'icicles-menu)
;; Add a work around for the [S-tab] conflict between Org-Mode and
;; Icicles
(add-hook 'icicle-mode-hook 'bind-my-icicle-keys)
(defun bind-my-icicle-keys ()
"Add the custom binding for [S-tab] when Icicles is used"
(define-key icicle-mode-map [S-tab] 'bind-my-s-tab-for-org-mode))
(defun bind-my-s-tab-for-org-mode (&optional arg)
"Binds [S-tab] to cycle the outline in Org-Mode
and use the icicle mode functions otherwise."
(interactive "P")
(if (string= mode-name "Org")
(org-shifttab arg)
(icicle-generic-S-tab)))
;; End of the work around
(icicle-mode 1)
Thanks a lot for the detailed post! This really helped me out.
--
Anupam