Gnus development mailing list
 help / color / mirror / Atom feed
From: Didier Verna <didier@xemacs.org>
Cc: Manuel Serrano <Manuel.Serrano@unice.fr>
Subject: restore bbdb keys
Date: 11 Jan 2000 15:22:47 +0100	[thread overview]
Message-ID: <muxu2kkn0w8.fsf@uzeb.lrde.epita.fr> (raw)



        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



             reply	other threads:[~2000-01-11 14:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-11 14:22 Didier Verna [this message]
2000-01-14  7:12 ` Manuel.Serrano

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=muxu2kkn0w8.fsf@uzeb.lrde.epita.fr \
    --to=didier@xemacs.org \
    --cc=Manuel.Serrano@unice.fr \
    /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).