From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/60966 Path: news.gmane.org!not-for-mail From: Michael Cook Newsgroups: gmane.emacs.gnus.general Subject: Re: mc-expand-mail-abbrev Date: Sat, 17 Sep 2005 14:39:19 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: sea.gmane.org 1126983212 8581 80.91.229.2 (17 Sep 2005 18:53:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 17 Sep 2005 18:53:32 +0000 (UTC) Original-X-From: ding-owner+m9498@lists.math.uh.edu Sat Sep 17 20:53:30 2005 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EGhnZ-0004eX-4A for ding-account@gmane.org; Sat, 17 Sep 2005 20:52:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1EGhnP-0004on-00; Sat, 17 Sep 2005 13:52:19 -0500 Original-Received: from nas01.math.uh.edu ([129.7.128.39]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1EGhb3-0004oi-00 for ding@lists.math.uh.edu; Sat, 17 Sep 2005 13:39:33 -0500 Original-Received: from quimby.gnus.org ([80.91.224.244]) by nas01.math.uh.edu with esmtp (Exim 4.52) id 1EGhb1-0007Dn-VY for ding@lists.math.uh.edu; Sat, 17 Sep 2005 13:39:33 -0500 Original-Received: from smtp01.mrf.mail.rcn.net ([207.172.4.61]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1EGhax-0003Y9-00 for ; Sat, 17 Sep 2005 20:39:27 +0200 Original-Received: from 209-6-214-8.c3-0.lex-ubr2.sbo-lex.ma.cable.rcn.com (HELO pigpen.waxrat.com) ([209.6.214.8]) by smtp01.mrf.mail.rcn.net with ESMTP; 17 Sep 2005 14:39:20 -0400 X-IronPort-AV: i="3.97,119,1125892800"; d="scan'208"; a="83390598:sNHT22061924" Original-Received: from pigpen.waxrat.com (localhost.localdomain [127.0.0.1]) by pigpen.waxrat.com (8.12.11/8.12.11) with ESMTP id j8HIdJKL015589 for ; Sat, 17 Sep 2005 14:39:19 -0400 Original-To: ding@gnus.org In-Reply-To: (Michael Cook's message of "Fri, 09 Sep 2005 21:12:05 -0400") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.3 (gnu/linux) X-Spam-Score: -2.6 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:60966 Archived-At: > when using S D r (gnus-summary-resend-message), it'd be nice to be > able to expand mail aliases and to complete via bbdb. > > so, i took a stab at it. i think my solution is not quite right > yet, but it seems to be close. any thoughts? here's a better version. (defun mc-expand-mail-abbrev (arg) "Expand the mail abbreviation before point." (interactive "P") ;; See what is between point and the preceding newline, colon or comma. ;; If it's a single word, then attempt to expand it using "mail-abbrev". (let* ((end (point)) (beg (save-excursion (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*") (goto-char (match-end 0)) (point))) (typed (buffer-substring beg end))) (when (string-match "^\\w+$" typed) (mail-abbrev-insert-alias typed) (or (= (point) end) (delete-region beg end)))) ;; Now try BBDB completion. (bbdb-complete-name arg)) (define-key minibuffer-local-map "\M-," 'mc-expand-mail-abbrev) (define-key message-mode-map "\M-," 'mc-expand-mail-abbrev) m.