From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Clemente Subject: org-contacts: match name without formatting Date: Mon, 02 Jan 2012 21:26:42 +0100 Message-ID: <8739bxdf5p.wl%n142857@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhoT1-0002pZ-7P for emacs-orgmode@gnu.org; Mon, 02 Jan 2012 15:26:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RhoT0-0000ma-2g for emacs-orgmode@gnu.org; Mon, 02 Jan 2012 15:26:47 -0500 Received: from mail-ww0-f41.google.com ([74.125.82.41]:47759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RhoSz-0000mW-PI for emacs-orgmode@gnu.org; Mon, 02 Jan 2012 15:26:45 -0500 Received: by wgbdt12 with SMTP id dt12so23954457wgb.0 for ; Mon, 02 Jan 2012 12:26:44 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode Mailinglist I use radio headers in my contacts data base, like: * <<>> * <<>> (Alice's brother) org-contacts was presenting the names with <<< before, so you needed to type <<< to match them. I attach a patch to remove this particular formatting before presenting the completions; in this way you can match them by Al or B Removing bold/italic/underline/pre is harder. If there is any better function to remove formatting, please use it. -- Daniel ---------------------------------------------------------------------------------------------------------------------- diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 74d68dc..156fa66 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -375,12 +375,18 @@ This function should be called from `gnus-article-prepare-hook'." (org-completing-read prompt (org-contacts-filter) predicate t initial-input hist def inherit-input-method)) +(defun org-contacts-format-name (name) + "Remove some formatting marks from contact name" + (replace-regexp-in-string org-radio-target-regexp "\\1" name) + ; TODO also remove emphasis (org-emphasis-alist) +) + (defun org-contacts-format-email (name email) "Format a mail address." (unless email (error "`email' cannot be nul")) (if name - (concat name " <" email ">") + (concat (org-contacts-format-name name) " <" email ">") email)) (defun org-contacts-check-mail-address (mail)