* restore bbdb keys
@ 2000-01-11 14:22 Didier Verna
2000-01-14 7:12 ` Manuel.Serrano
0 siblings, 1 reply; 2+ messages in thread
From: Didier Verna @ 2000-01-11 14:22 UTC (permalink / raw)
Cc: Manuel Serrano
Hi!
For those of you who use both BBDB in Gnus and flyspell, you've probably
noticed that flyspell overrides the bbdb completion key (M-Tab), which is
annoying in mail headers. So I've written this small function for XEmacs, that
you might find useful. Put it in message-setup-hook. It will restore the
message mode keymap in the headers that expect to have bbdb completion, and
leave the flyspell keymap anywhere else.
(defun restore-bbdb-keys ()
"*When composing a message, if both bbdb and flyspell are used, restore the
bbdb key bindings in all headers likely to need name expansion."
(interactive)
(map-extents (lambda (e unused) (delete-extent e))
nil nil nil nil nil 'restore-bbdb-keys t)
(when (and (eq major-mode 'message-mode)
(eq (lookup-key message-mode-map [(meta tab)])
'bbdb-complete-name)
(eq (key-binding [(meta tab)]) 'flyspell-auto-correct-word))
(save-excursion
(let ((limit (progn (search-forward mail-header-separator)
(point-at-bol))))
(make-local-hook 'kill-buffer-hook)
(goto-char 1)
(while (re-search-forward "^\\(\
\\(From\\|Sender\\)\\|\
\\(\\(Mail-Copies-\\)?To\\)\\|\
\\([GBF]?[Cc][Cc]\\)\\|\
\\(Reply-[Tt]o\\)\\)\
: "
limit t)
(let* ((start (point))
(end (or (and (re-search-forward "^[A-Z][^: \n\t]+: " limit t)
(goto-char (point-at-bol)))
limit))
(extent (make-extent start end)))
(set-extent-property extent 'keymap message-mode-map)
(set-extent-property extent 'restore-bbdb-keys t)
(add-hook 'kill-buffer-hook `(lambda () (delete-extent ,extent))
nil t)))
))
))
--
/ / _ _ Didier Verna http://www.inf.enst.fr/~verna/
- / / - / / /_/ / EPITA / LRDE mailto:didier@epita.fr
/_/ / /_/ / /__ / 14-16 rue Voltaire Tel. +33 (1) 44 08 01 77
94276 Kremlin-Bicêtre cedex Fax. +33 (1) 44 08 01 99
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: restore bbdb keys
2000-01-11 14:22 restore bbdb keys Didier Verna
@ 2000-01-14 7:12 ` Manuel.Serrano
0 siblings, 0 replies; 2+ messages in thread
From: Manuel.Serrano @ 2000-01-14 7:12 UTC (permalink / raw)
Cc: BBDB List, Gnus List
> For those of you who use both BBDB in Gnus and flyspell, you've probably
> noticed that flyspell overrides the bbdb completion key (M-Tab), which is
> annoying in mail headers. So I've written this small function for XEmacs, that
> you might find useful. Put it in message-setup-hook. It will restore the
> message mode keymap in the headers that expect to have bbdb completion, and
> leave the flyspell keymap anywhere else.
The current development version flyspell1.5 does not use M-Tab anymore.
The new version can be found at:
http://www.kaolin.unice.fr~/serrano/
Anyhow, may thanks for your message and for your help.
--Manuel Serrano--
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-01-14 7:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-11 14:22 restore bbdb keys Didier Verna
2000-01-14 7:12 ` Manuel.Serrano
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).