From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anupam Sengupta Newsgroups: gmane.emacs.help Subject: Re: Resolving Key Sequence conflict between icicles and org-mode Date: Wed, 23 May 2007 21:31:31 -0700 Organization: Cox Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1180013563 12372 80.91.229.12 (24 May 2007 13:32:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 24 May 2007 13:32:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 24 15:32:38 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HrDQk-0008Dv-A5 for geh-help-gnu-emacs@m.gmane.org; Thu, 24 May 2007 15:32:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HrDQm-0001dk-QD for geh-help-gnu-emacs@m.gmane.org; Thu, 24 May 2007 09:32:40 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news3.google.com!out03a.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!in03.usenetserver.com!news.usenetserver.com!hwmnpeer01.phx!news.highwinds-media.com!hw-filter.phx!newsfe17.phx.POSTED!53ab2750!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (darwin) Cancel-Lock: sha1:NNJhC7gVkIwiAO98++DqHsAYh8U= Original-Lines: 90 Original-NNTP-Posting-Host: 72.222.192.8 Original-X-Complaints-To: admin@cox.net Original-X-Trace: newsfe17.phx 1179981092 72.222.192.8 (Wed, 23 May 2007 21:31:32 MST) Original-NNTP-Posting-Date: Wed, 23 May 2007 21:31:32 MST Original-Xref: shelby.stanford.edu gnu.emacs.help:148773 X-Mailman-Approved-At: Thu, 24 May 2007 09:32:24 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:44382 Archived-At: >> 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 ). >> >> Org-Mode uses 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 in Org-Mode buffers to >> be the original org-shifttab function? >> >> I did try M-x local-set-key to try binding 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 "" '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