unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Peter John Hartman <peterjohnhartman@gmail.com>
To: notmuch@notmuchmail.org
Subject: fix notmuch.vim NM_compuse_get_user_email() (Patch)
Date: Wed, 26 Jan 2011 00:01:19 -0500	[thread overview]
Message-ID: <20110126050119.GA11761@triltoucheee> (raw)

Here's a bitty patch to the vim plugin; it now calculates the primary email
of the user based on a call to notmuch config.  There's still a lot of work
that needs to get done on notmuch.vim, e.g., the ability to have multiple
emails/accounts.

Best, Peter

--- notmuch.vim	2010-11-18 17:26:14.000000000 -0500
+++ notmuch.vim.mine	2011-01-25 23:57:50.000000000 -0500
@@ -18,7 +18,8 @@
 " along with Notmuch.  If not, see <http://www.gnu.org/licenses/>.
 "
 " Authors: Bart Trojanowski <bart@jukie.net>
-
+" Contributors: Peter Hartman <peterjohnhartman@gmail.com>
+"
 " --- configuration defaults {{{1
 
 let s:notmuch_defaults = {
@@ -1024,11 +1025,9 @@
 " --- --- compose screen helper functions {{{2
 
 function! s:NM_compose_get_user_email()
-        let name = substitute(system('id -u -n'), '\v(^\s*|\s*$|\n)', '', 'g')
-        let fqdn = substitute(system('hostname -f'), '\v(^\s*|\s*$|\n)', '', 'g')
-
-        " TODO: do this properly
-        return name . '@' . fqdn
+        " TODO: do this properly (still), i.e., allow for multiple email accounts
+        let email = substitute(system('notmuch config get user.primary_email'), '\v(^\s*|\s*$|\n)', '', 'g')
+	return email
 endfunction
 
 function! s:NM_compose_find_line_match(start, pattern, failure)

-- 
sic dicit magister P
PhD Candidate
Collaborative Programme in Ancient and Medieval Philosophy
University of Toronto
http://individual.utoronto.ca/peterjh

             reply	other threads:[~2011-01-26  5:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-26  5:01 Peter John Hartman [this message]
2011-01-26  7:01 ` fix notmuch.vim NM_compuse_get_user_email() (Patch) Carl Worth

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=20110126050119.GA11761@triltoucheee \
    --to=peterjohnhartman@gmail.com \
    --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).