emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* patch for org-contacts to ignore <<<radio_marks>>> when completing
@ 2013-01-01  3:06 Daniel Clemente
  2013-01-01 22:57 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Clemente @ 2013-01-01  3:06 UTC (permalink / raw)
  To: org-mode Mailinglist


Hi, I send a patch which allows org-complete to complete if you do „J o h n TAB“ even if your contact was written as <<<John>>> (now you would have to type < < < J TAB).
  It can be extended to remove emphasis, strongs, etc. if someone needs it.

Thanks


diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index 7e3cbb7..0173f1d 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -388,12 +388,17 @@ 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)
+  "Format a person name to remove radio marks."
+  (replace-regexp-in-string org-radio-target-regexp "\\1" name)
+  )
+
 (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] 4+ messages in thread

* Re: patch for org-contacts to ignore <<<radio_marks>>> when completing
  2013-01-01  3:06 patch for org-contacts to ignore <<<radio_marks>>> when completing Daniel Clemente
@ 2013-01-01 22:57 ` Bastien
  2013-01-02  0:44   ` Daniel Clemente
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2013-01-01 22:57 UTC (permalink / raw)
  To: Daniel Clemente; +Cc: org-mode Mailinglist

Hi Daniel,

Daniel Clemente <n142857@gmail.com> writes:

> Hi, I send a patch which allows org-complete to complete if you do „J o h n TAB“ even if your contact was written as <<<John>>> (now you would have to type < < < J TAB).
>   It can be extended to remove emphasis, strongs, etc. if someone
> needs it.

The function you introduced is used within `org-contacts-format-email',
where using a bare name makes more sense IMHO.

But I don't know org-contacts.el very much, I might be wrong.

Best,

-- 
 Bastien

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

* Re: patch for org-contacts to ignore <<<radio_marks>>> when completing
  2013-01-01 22:57 ` Bastien
@ 2013-01-02  0:44   ` Daniel Clemente
  2013-01-02  9:23     ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Clemente @ 2013-01-02  0:44 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode Mailinglist

El Tue, 01 Jan 2013 23:57:27 +0100 Bastien va escriure:
> 
> The function you introduced is used within `org-contacts-format-email',
> where using a bare name makes more sense IMHO.
> 
  Exactly. It says:
(concat name " <" email ">")
  But name is <<<John>>> and you will get:     <<<John>>> <john@email.com>
  With the patch you get a bare name:  John <john@email.com>
  So that new function should „clean“ the name: remove radio marks, emphasis, bold, etc. I did only radio marks..


  I also don't know org-contacts very much, but it seems that org-contacts-format-email returns not only the e-mail, but also the name; it could be called org-contacts-format-name-and-email.

  Greetings

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

* Re: patch for org-contacts to ignore <<<radio_marks>>> when completing
  2013-01-02  0:44   ` Daniel Clemente
@ 2013-01-02  9:23     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2013-01-02  9:23 UTC (permalink / raw)
  To: Daniel Clemente; +Cc: org-mode Mailinglist

Hi Daniel,

Daniel Clemente <n142857@gmail.com> writes:

>   But name is <<<John>>> and you will get:     <<<John>>> <john@email.com>
>   With the patch you get a bare name:  John <john@email.com>
>   So that new function should „clean“ the name: remove radio marks, emphasis, bold, etc. I did only radio marks..

I see.  I applied a slightly modified patch in master, thanks.

-- 
 Bastien

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

end of thread, other threads:[~2013-01-02  9:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-01  3:06 patch for org-contacts to ignore <<<radio_marks>>> when completing Daniel Clemente
2013-01-01 22:57 ` Bastien
2013-01-02  0:44   ` Daniel Clemente
2013-01-02  9:23     ` 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).