From: Daniel Clemente <n142857@gmail.com>
To: org-mode Mailinglist <emacs-orgmode@gnu.org>
Subject: org-contacts: match name without formatting
Date: Mon, 02 Jan 2012 21:26:42 +0100 [thread overview]
Message-ID: <8739bxdf5p.wl%n142857@gmail.com> (raw)
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)
next reply other threads:[~2012-01-02 20:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-02 20:26 Daniel Clemente [this message]
2012-01-04 16:43 ` org-contacts: match name without formatting Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8739bxdf5p.wl%n142857@gmail.com \
--to=n142857@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).