From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 7CCB56DE0A73 for ; Sat, 22 Oct 2016 11:57:29 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.229 X-Spam-Level: X-Spam-Status: No, score=-0.229 tagged_above=-999 required=5 tests=[AWL=-0.209, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hT1zVFVhFqQS for ; Sat, 22 Oct 2016 11:57:29 -0700 (PDT) Received: from mail-lf0-f45.google.com (mail-lf0-f45.google.com [209.85.215.45]) by arlo.cworth.org (Postfix) with ESMTPS id 7B6CD6DE02DA for ; Sat, 22 Oct 2016 11:57:28 -0700 (PDT) Received: by mail-lf0-f45.google.com with SMTP id b81so160428379lfe.1 for ; Sat, 22 Oct 2016 11:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=bMCHdOOuDgREewD8XWh2yYScZGvVrCTnIiJnRFsyeEk=; b=oyhOH9UTllIrluyQGQObJTiW9aU2il4c6/Uy0bvfa65Ybldf8S86eV0wq9CRrxbtBz HjXXNymEF/ogx6kNUIoQXajm1XQubObMFVTo3kUabsMJa2yAFT7+G33aHsDI+uJR2a/5 ujAUfASIW2V98YoKAULC9PemZplaAUI890sqaPxwl5/Ctw3IDzAb1slP30L01JcbBoK5 9d5ZTueeDurT3VUbwpaBi9PxDYtE1rTAL48ZMzpDOPvfFWkaE2urg9mv/JD1IzG1DzGq MFO0usPQ3OZiYmPigbA4kq/xxYftj0l2ucoQ/cBL6+AvA8nKIqMWsxmTtZDonbnS6Vkn XR+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bMCHdOOuDgREewD8XWh2yYScZGvVrCTnIiJnRFsyeEk=; b=CMLC63Ft76hyVrZxetI78+upccHxm0esyC/gscx1CqkndrMToBChMqIKJl+UlcwkDv vsvVaguZH8iMdb+5W1nkt/iaAZTeidlizQs93HSNEkhkdAA0PBLJIar8yyjVTpAjjPDX rnAGCAYJFwIRHtFTaExDewr642vGpbMSvsqy4Q4QGbtD45/HbNi9xX/bzbPuyFSckUrS LWrs8nWu7ZaPh/XUwV/6kMfo0P5dU0Jhi2XBNsOCBpFGZU3oWrvH3ccaJV5RuFagOEyZ NoWA9HmEeDzxuECxNzcrcahH0W6FUYZ26hBz8waXVVYAjUsYjAaCldFnt36D+JeBX3F+ jnaA== X-Gm-Message-State: ABUngvct0xXMSxVJgdxB3tLFjlwXDfa2aHUL5Wh0it5+zg0jrEzIZvZAwexmgCuq9RO5DQ== X-Received: by 10.25.16.208 with SMTP id 77mr2763778lfq.167.1477162646161; Sat, 22 Oct 2016 11:57:26 -0700 (PDT) Received: from localhost (mobile-access-bceef0-89.dhcp.inet.fi. [188.238.240.89]) by smtp.gmail.com with ESMTPSA id 69sm1501334lfq.39.2016.10.22.11.57.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Oct 2016 11:57:25 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH] completion: complete mimetype: search prefix Date: Sat, 22 Oct 2016 21:55:34 +0300 Message-Id: <1477162534-7814-1-git-send-email-jani@nikula.org> X-Mailer: git-send-email 2.1.4 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2016 18:57:29 -0000 Use /etc/mime.types if available, with a homebrew sed parser, and fall back to a handful of common types otherwise. --- completion/notmuch-completion.bash | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash index 78047b5f424d..c75eb483a9f3 100644 --- a/completion/notmuch-completion.bash +++ b/completion/notmuch-completion.bash @@ -58,6 +58,34 @@ _notmuch_email() sed 's/[^<]*<\([^>]*\)>/\1/' | tr "[:upper:]" "[:lower:]" | sort -u } +_notmuch_mimetype() +{ + # use mime types from mime-support package if available, and fall + # back to a handful of common ones otherwise + if [ -r "/etc/mime.types" ]; then + sed -e '/^[ \t]*\(#.*\)\?$/d;s/^\([^ \t]\+\).*$/\1/' < /etc/mime.types + else + cat <