From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/3431 Path: news.gmane.org!not-for-mail From: Michael Slass Newsgroups: gmane.emacs.gnus.user Subject: Re: Newbie question: sharing M-TAB binding between flyspell and bbdb Date: Tue, 27 Jan 2004 00:21:41 GMT Organization: Comcast Online Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1138669551 18965 80.91.229.2 (31 Jan 2006 01:05:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 Jan 2006 01:05:51 +0000 (UTC) Original-X-From: nobody Tue Jan 17 17:32:12 2006 Original-Path: quimby.gnus.org!newsfeed1.e.nsc.no!nsc.no!nextra.com!uio.no!feed.news.tiscali.de!newsfeed.stueberl.de!peer01.cox.net!cox.net!cyclone1.gnilink.net!attbi_feed4!attbi.com!attbi_s04.POSTED!not-for-mail Original-Sender: mikesl@eric.rossnet.com Original-Newsgroups: gnu.emacs.gnus User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-NNTP-Posting-Host: 24.18.253.35 Original-X-Complaints-To: abuse@comcast.net Original-X-Trace: attbi_s04 1075162901 24.18.253.35 (Tue, 27 Jan 2004 00:21:41 GMT) Original-NNTP-Posting-Date: Tue, 27 Jan 2004 00:21:41 GMT Original-Xref: bridgekeeper.physik.uni-ulm.de gnus-emacs-gnus:3572 Original-Lines: 47 X-Gnus-Article-Number: 3572 Tue Jan 17 17:32:12 2006 Xref: news.gmane.org gmane.emacs.gnus.user:3431 Archived-At: Thomas Hunter writes: >I would like to make my M-TAB key act as bbdb-complete-name when I am >in the header in a message file but as flyspell-auto-correct-word when >I am elsewhere in the buffer. Would any of you be willing to offer me >an elegant way to do this? > >Thanks! > >tjh > >-- > I'm guessing you want this when you're composing a message. I don't have BBDB installed, so I can't test that part, but the "Am I in a header?" portion works fine. ------------------------- cut here ------------------------- ;; create a function that does one or the other ;; depending on your position in the buffer (defun bbdb-complete-or-flyspell-auto-correct () "`bbdb-complete-name' in msg header, `flyspell-auto-correct-word' otherwise" (interactive) (if (<= (point) (mail-header-end)) (bbdb-complete-name) (flyspell-auto-correct-word))) ;; add a binding of the new function to ;; message-mode-hook (add-hook 'message-mode-hook (lambda () (define-key message-mode-map (kbd "M-") 'bbdb-complete-or-flyspell-auto-correct))) ------------------------- cut here ------------------------- Lemme know if it works. -- Mike Slass