Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Michael Slass <miknrene@drizzle.com>
Subject: Re: Newbie question:  sharing M-TAB binding between flyspell and bbdb
Date: Tue, 27 Jan 2004 00:21:41 GMT	[thread overview]
Message-ID: <m37jzew8a2.fsf@eric.rossnet.com> (raw)
In-Reply-To: <m37jzeqqgv.fsf@d200.dupont02.swarthmore.edu>

Thomas Hunter <thunter1@swarthmore.edu> 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-<tab>")
     'bbdb-complete-or-flyspell-auto-correct)))

------------------------- cut here -------------------------


Lemme know if it works.

-- 
Mike Slass


      reply	other threads:[~2004-01-27  0:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-26 22:45 Thomas Hunter
2004-01-27  0:21 ` Michael Slass [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m37jzew8a2.fsf@eric.rossnet.com \
    --to=miknrene@drizzle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).