From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: binding a key for keyword completion in all modes Date: Wed, 4 Mar 2009 14:18:46 -0800 (PST) Organization: http://groups.google.com Message-ID: <238ec42a-c6ee-4661-9b11-6e3b1ca58a35@u18g2000pro.googlegroups.com> References: <8b351a00-6fa4-45f3-b240-eb7d53ed2d4c@e18g2000yqo.googlegroups.com> <87wsbdwr81.fsf@thinkpad.tsdh.de> <87skm012ln.fsf@mundaneum.com> <87r61j62k0.fsf@thinkpad.tsdh.de> <58e57903-4b47-443c-b84d-e41662071482@e36g2000prg.googlegroups.com> <87ocwkavg0.fsf@thinkpad.tsdh.de> <23f18594-f0c7-4050-ba73-fd94c0dc43fa@v5g2000prm.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1236245945 17042 80.91.229.12 (5 Mar 2009 09:39:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Mar 2009 09:39:05 +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 Mar 05 10:40:21 2009 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 1LfA3w-0006DM-DJ for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Mar 2009 10:40:20 +0100 Original-Received: from localhost ([127.0.0.1]:46547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LfA2b-0005wR-4Q for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Mar 2009 04:38:57 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!u18g2000pro.googlegroups.com!not-for-mail Original-Newsgroups: comp.emacs,gnu.emacs.help Original-Lines: 49 Original-NNTP-Posting-Host: 24.6.175.142 Original-X-Trace: posting.google.com 1236205126 24348 127.0.0.1 (4 Mar 2009 22:18:46 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 4 Mar 2009 22:18:46 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u18g2000pro.googlegroups.com; posting-host=24.6.175.142; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu comp.emacs:97925 gnu.emacs.help:167300 X-Mailman-Approved-At: Thu, 05 Mar 2009 04:35:25 -0500 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:62613 Archived-At: On Mar 4, 4:04 am, TomSW wrote: > > M-t runs the command #[nil "\300\301\302!!\207" [call-interactively > > key-binding [134217737]] 3 nil nil] > > which is an interactive compiled Lisp function. > > It is bound to M-t. > > (anonymous) > > > Is there a more robust solution? > > Yes. If Alt-Tab is bound, it will be bound to an interactive command, > which you can bind Ctrl-Tab to directly: > > (let ((binding (or (key-binding (kbd "")) > (key-binding (kbd "M-TAB"))))) > (when binding > (local-set-key (kbd "") binding))))) > > This will give better results with describe-key. Thanks. This does not seems to solve it though still. if i have (local-set-key (kbd "") (or (key-binding (kbd "")) (key-binding (kbd "M-TAB")))) then the key is changed for local buffer. If i use global-set-key, then it's wrong because a specifical completion command name is used for all. e.g. I get ispell-complete-word for all. just to make message more clear and independent of the thread, what i wanted is to set Ctrl+Tab for command completion that works in all major modes, and avoding adding a custome hook to each and every mode. Right now i adopted this implementation. ; keyword completion, because Alt+Tab is used by OS (global-set-key (kbd "M-t") 'call-command-completion) (defun call-keyword-completion () "Call the function with keyboard shortcut M-TAB." (interactive) (call-interactively (key-binding (kbd "M-TAB"))) ) Xah =E2=88=91 http://xahlee.org/ =E2=98=84