all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Resolving Key Sequence conflict between icicles and org-mode
@ 2007-05-23  7:07 Anupam Sengupta
  2007-05-23 15:18 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Anupam Sengupta @ 2007-05-23  7:07 UTC (permalink / raw)
  To: help-gnu-emacs


I use Org-mode extensively for most of my daily note taking along with IDO mode
for buffer/file switching. 

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).

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. 

Any suggestions would be really welcome, as Icicles is a feature which looks
pretty useful.

Thanks!
-- 
Anupam

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Resolving Key Sequence conflict between icicles and org-mode
  2007-05-23  7:07 Resolving Key Sequence conflict between icicles and org-mode Anupam Sengupta
@ 2007-05-23 15:18 ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2007-05-23 15:18 UTC (permalink / raw)
  To: Anupam Sengupta, help-gnu-emacs

> 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.

> 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.

> 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 2) use
a different key for Icicle mode ;-). 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.

If you decide not to change any key bindings, you can always turn off Icicle
mode whenever you are in Org mode, foregoing use of Icicles features when in
that mode. You can turn off Icicle mode manually each time you use Org mode,
or you can do that automatically in the Org mode hook.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Resolving Key Sequence conflict between icicles and org-mode
       [not found] <mailman.1087.1179933678.32220.help-gnu-emacs@gnu.org>
@ 2007-05-24  4:31 ` Anupam Sengupta
  0 siblings, 0 replies; 3+ messages in thread
From: Anupam Sengupta @ 2007-05-24  4:31 UTC (permalink / raw)
  To: help-gnu-emacs


>> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-24  4:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-23  7:07 Resolving Key Sequence conflict between icicles and org-mode Anupam Sengupta
2007-05-23 15:18 ` Drew Adams
     [not found] <mailman.1087.1179933678.32220.help-gnu-emacs@gnu.org>
2007-05-24  4:31 ` Anupam Sengupta

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.