Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Newbie question:  sharing M-TAB binding between flyspell and bbdb
@ 2004-01-26 22:45 Thomas Hunter
  2004-01-27  0:21 ` Michael Slass
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Hunter @ 2004-01-26 22:45 UTC (permalink / raw)



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

-- 


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

* Re: Newbie question:  sharing M-TAB binding between flyspell and bbdb
  2004-01-26 22:45 Newbie question: sharing M-TAB binding between flyspell and bbdb Thomas Hunter
@ 2004-01-27  0:21 ` Michael Slass
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Slass @ 2004-01-27  0:21 UTC (permalink / raw)


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


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

end of thread, other threads:[~2004-01-27  0:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-26 22:45 Newbie question: sharing M-TAB binding between flyspell and bbdb Thomas Hunter
2004-01-27  0:21 ` Michael Slass

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