* 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
* Re: org-contacts: match name without formatting
2012-01-02 20:26 org-contacts: match name without formatting Daniel Clemente
@ 2012-01-04 16:43 ` Bastien
0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2012-01-04 16:43 UTC (permalink / raw)
To: Daniel Clemente; +Cc: org-mode Mailinglist
Hi Daniel,
thanks for the patch.
Daniel Clemente <n142857@gmail.com> writes:
> +(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)
> +)
(I'd suggest ̀org-contacts-cleanup-name' instead of
`org-contacts-format-name'.)
Also, let's carefully check that such cleanups don't
slow down things -- I'm not using org-contacts (yet)
but I remember speed can be a problem with big database.
Thanks,
--
Bastien
^ permalink raw reply [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).