emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] org-contacts: match name without formatting


From: Daniel Clemente
Subject: [O] org-contacts: match name without formatting
Date: Mon, 02 Jan 2012 21:26:42 +0100
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.8 Emacs/24.0.92 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

I use radio headers in my contacts data base, like:
* <<<Alice>>>
* <<<Bob>>> (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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]