--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 88911431FCB\r
+ for <notmuch@notmuchmail.org>; Thu, 1 Jan 2015 06:34:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id wQm6D63yiOOM for <notmuch@notmuchmail.org>;\r
+ Thu, 1 Jan 2015 06:34:25 -0800 (PST)\r
+Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com\r
+ [209.85.212.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 1B031431FC0\r
+ for <notmuch@notmuchmail.org>; Thu, 1 Jan 2015 06:34:25 -0800 (PST)\r
+Received: by mail-wi0-f182.google.com with SMTP id h11so26668901wiw.9\r
+ for <notmuch@notmuchmail.org>; Thu, 01 Jan 2015 06:34:22 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references;\r
+ bh=htE6h2g+eUYNuT1r2DZHe3TviNUn8x+z9n88Lw2hySw=;\r
+ b=M6OiCsyjsYMIlPOWphwKiZf99Y81QjyX9GKPgRH3Vmhxy1u3szcFbZxm72RmlItmz3\r
+ RqKScsTl8g0MP2cN3Igdg3m3ZE8QXSkGEb9V3QF+nDPPKutLdq4owpQiFImM190mmnU/\r
+ TsKzPJBKze0KtXYd+xfcO3M+fxIbfF8g3VgRl1G33Mr04u7a5bkeh7pMskFUt7dkIfZ8\r
+ FV+58QqJM2ZrYiqngrm+TYOGKPEawyz7Ihjf3BlIh6FcZwFWrj+XfbMgYBbIbFlJmE23\r
+ fZyOdhUio8R9dvC02VbT0z8ZiPZYe9eGml9gA61Ph4wbs/7gcbOdqqu7kWItTBxfcD71\r
+ IYwQ==\r
+X-Gm-Message-State:\r
+ ALoCoQm2YXKPNYdq0PP/3/bhXfXrWfkVrQsIv1I2rS3Q/uiIIm6KYmk5UlAjADmEuAiDwAEy/iCd\r
+X-Received: by 10.194.246.167 with SMTP id\r
+ xx7mr141234961wjc.118.1420122862837; Thu, 01 Jan 2015 06:34:22 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c371-91.dhcp.inet.fi.\r
+ [88.195.113.91]) by mx.google.com with ESMTPSA id\r
+ dc1sm45933654wib.18.2015.01.01.06.34.21\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Thu, 01 Jan 2015 06:34:22 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2] completion: complete notmuch insert --folder to maildir\r
+ folders only\r
+Date: Thu, 1 Jan 2015 16:34:30 +0200\r
+Message-Id: <1420122870-13134-1-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1415648143-19923-2-git-send-email-jani@nikula.org>\r
+References: <1415648143-19923-2-git-send-email-jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 01 Jan 2015 14:34:28 -0000\r
+\r
+The --folder option expects a folder relative from maildir root, so\r
+complete like the folder: search term.\r
+---\r
+ completion/notmuch-completion.bash | 5 ++++-\r
+ 1 file changed, 4 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash\r
+index 386437333742..d58dc8bed60f 100644\r
+--- a/completion/notmuch-completion.bash\r
++++ b/completion/notmuch-completion.bash\r
+@@ -188,7 +188,10 @@ _notmuch_insert()\r
+ $split &&\r
+ case "${prev}" in\r
+ --folder)\r
+- _filedir\r
++ local path=`notmuch config get database.path`\r
++ compopt -o nospace\r
++ COMPREPLY=( $(compgen -d "$path/${cur}" | \\r
++ sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )\r
+ return\r
+ ;;\r
+ esac\r
+-- \r
+2.1.4\r
+\r