unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH] emacs: add a function to heuristically test if the CLI is configured OK.
Date: Sun, 26 Jan 2014 21:54:24 +0200	[thread overview]
Message-ID: <m28uu25xjj.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <1390763615-24477-1-git-send-email-david@tethera.net>

On Sun, Jan 26 2014, David Bremner <david@tethera.net> wrote:

> We cache the result so that we can call the function many places
> without worrying about the cost.
> ---
> thanks to Tomi for catching the typos (uncommitted changes on my end).

Series LGTM.

Tomi

>
>  emacs/notmuch-lib.el | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 2be409b..140d760 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -168,6 +168,17 @@ Otherwise the output will be returned"
>        (notmuch-check-exit-status status (cons notmuch-command args) output)
>        output)))
>  
> +(defvar notmuch--cli-sane-p nil
> +  "Cache whether the CLI seems to be configured sanely.")
> +
> +(defun notmuch-cli-sane-p ()
> +  "Return t if the cli seems to be configured sanely."
> +  (unless notmuch--cli-sane-p
> +    (let ((status (call-process notmuch-command nil nil nil
> +				"config" "get" "user.primary_email")))
> +      (setq notmuch--cli-sane-p (= status 0))))
> +  notmuch--cli-sane-p)
> +
>  (defun notmuch-version ()
>    "Return a string with the notmuch version number."
>    (let ((long-string
> -- 
> 1.8.5.2
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  parent reply	other threads:[~2014-01-26 19:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 14:43 notmuch emacs mode could be friendlier when the user has never run "notmuch setup" Daniel Kahn Gillmor
2014-01-26 18:54 ` [PATCH 1/3] emacs: add a function to heuristically test if the CLI is configured OK David Bremner
2014-01-26 18:54   ` [PATCH 2/3] emacs: add function notmuch-assert-cli-sane David Bremner
2014-01-26 18:54   ` [PATCH 3/3] emacs: add notmuch-assert-cli-sane to notmuch-hello David Bremner
2014-01-26 19:13   ` [PATCH] emacs: add a function to heuristically test if the CLI is configured OK David Bremner
2014-01-26 19:41     ` Mark Walters
2014-01-26 19:54     ` Tomi Ollila [this message]
2014-01-27 13:11 ` notmuch emacs mode could be friendlier when the user has never run "notmuch setup" 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=m28uu25xjj.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=david@tethera.net \
    --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).