unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>
To: Daniel Bergey <bergey@alum.mit.edu>,
	Notmuch Mail List <notmuch@notmuchmail.org>
Subject: Re: [PATCH] emacs: functions to import sender or recipient into BBDB
Date: Fri, 19 Oct 2012 18:52:21 -0400	[thread overview]
Message-ID: <87ipa66pne.fsf@betacantrips.com> (raw)
In-Reply-To: <87lii62sk2.fsf@wonderlust.lan>

Daniel Bergey <bergey@alum.mit.edu> writes:

> From a show buffer, bbdb/notmuch-snarf-from imports the sender into
> bbdb.  bbdb/notmuch-snarf-to attempts to import all recipients.  BBDB
> displays a buffer with each contact; C-g displays the next contact, or
> returns to the notmuch-show buffer.
>
> This is my first notmuch patch.  Comments very welcome.

Hi!

>  emacs/notmuch-show.el |   28 ++++++++++++++++++++++++++++

I don't think this belongs in notmuch-show. My first inclination is that
this should go into a new file contrib/notmuch-bbdb.el (assuming there's
no other notmuch-bbdb integration stuff floating around).

>  1 file changed, 28 insertions(+)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 6335d45..3bc1da0 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1895,6 +1895,34 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."
>                      (button-get button :notmuch-filename)
>                      (button-get button :notmuch-content-type)))))))
>
> +;; bbdb interaction functions, awaiting user keybindings
> +
> +(defun bbdb/snarf-between-commas ()
> +  ; What about names written "Surname, First M" <user@server.tld>?

Most comments in emacslisp start with two semicolons.

I do think more sophisticated parsing is necessary. If you're lucky,
somebody else already has a library to parse email addresses in this
form.

> +  (goto-char (point-min))

I'm not crazy about this. It's probably fine for something limited to
bbdb users (especially since bbdb-snarf uses a very similar technique),
but I think the better approach here is to just take a region and go
from region-beginning and region-end.

> +  (let ((comma (point)))
> +    (while (search-forward "," nil "end")

The third argument of search-forward is NOERROR. I don't understand what
the value "end" means. The help says "Optional third argument, if t..."

> +      (bbdb-snarf-region comma (point))
> +      (setq comma (point)))
> +    (bbdb-snarf-region comma (point)) ; last entry
> +   ))

Doesn't this cause snarf the comma into any of those entries? It seems
like point starts before the first entry but then goes before each
comma. Obviously this wouldn't be here if it didn't work. I thought
bbdb-snarf handled this kind of thing, but it doesn't. Could you explain
this?

Ethan

  reply	other threads:[~2012-10-19 22:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 20:09 [PATCH] emacs: functions to import sender or recipient into BBDB Daniel Bergey
2012-10-19 22:52 ` Ethan Glasser-Camp [this message]
2012-10-20  9:14   ` Tomi Ollila
2012-10-20 18:23     ` Jameson Graef Rollins
2012-10-20 19:35       ` Tomi Ollila
2012-10-20 21:10         ` Jani Nikula
2012-10-21 12:16           ` Tomi Ollila
2012-11-19  0:08   ` Daniel Bergey
2013-02-07 18:51     ` Daniel Bergey
2013-02-19  7:24       ` Tomi Ollila
2013-03-31 18:20         ` Daniel Bergey
2013-03-31 18:40           ` Tomi Ollila
2013-04-06 11:37           ` David Bremner
2013-04-06 19:43             ` David Bremner

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://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ipa66pne.fsf@betacantrips.com \
    --to=ethan.glasser.camp@gmail.com \
    --cc=bergey@alum.mit.edu \
    --cc=notmuch@notmuchmail.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://yhetil.org/notmuch.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).