emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-contacts: match name without formatting
@ 2012-01-02 20:26 Daniel Clemente
  2012-01-04 16:43 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Clemente @ 2012-01-02 20:26 UTC (permalink / raw)
  To: org-mode Mailinglist


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)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-04 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-02 20:26 org-contacts: match name without formatting Daniel Clemente
2012-01-04 16:43 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).