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 F11B56DE02DD for ; Tue, 25 Oct 2016 07:55:33 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.57 X-Spam-Level: X-Spam-Status: No, score=-0.57 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] 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 twy6nuHBbXJf for ; Tue, 25 Oct 2016 07:55:30 -0700 (PDT) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) by arlo.cworth.org (Postfix) with ESMTPS id A1BA56DE0243 for ; Tue, 25 Oct 2016 07:55:29 -0700 (PDT) Received: by mail-lf0-f54.google.com with SMTP id d20so16174134lfj.5 for ; Tue, 25 Oct 2016 07:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version; bh=6q4I33BElZbUo2cHBh0MicURRk629Edjr+0UHtkpSE8=; b=aan6+tyHmxfrTKSNsTl8RLArW3jtDOU6ghQezOTTztYq/D+LV3aQgV1gGRqOQZU0Uh 1DMq6wMeFNEpXTd7w3nnbVCAWKvKitNUM+tN8nruYoJMEvhn4obLkj3/HEvjtAA7sgyC l1lmD8Y8u/NMrg2dvrLxrVFlmeRhC5I5qjVVs9JsylLUX281+hLju6jOGfoK+6lmewoS fRfq+c2TDXu/T1dTl4M+xGmq1A5YCRvWH3VBkCXJ9XV6HyG/ojGyO9uqn4lbgmnRS0mr Ur6nvZito+gFpHa9EpD5q7KFHwGvcYxB8PH1eBGviu+GGnY5MWlc/8gzP+fpxnypQT4+ LmYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=6q4I33BElZbUo2cHBh0MicURRk629Edjr+0UHtkpSE8=; b=c0jpog4y9+iuCybKr20IMdD97gnaXX/GUNWAHFP5Zp4ZqIuwUeywjql1m7p77dGnof rlc8KW8oobykQso/hZN6AyZT58uG5awqKFJyHq2b7d2JwEud3bsm4RSr7Sy/sTihMQBC Lnp1iOlZX/M/t0aBDx90LKpUdlvZnVzzYB6WgoDAJ2k9X9eqh/h0aA8IeLCoSElVy3xx MzS1B/Hz3+O6ItQrOp3EyEnvr8AaGBn+pZ8X5av0p37k1rPslILKslOf6CBPhi3MULTb VWffGnD/bRAUlGiDdkG+mJNNyz96dO92jg62/fxO5s453mCGm70sl2WRzepsmU+AQszF eLoQ== X-Gm-Message-State: ABUngvdluh3qxIt/SxYWthnQO6fy5kwf9km7av6GJlWycav9vSVKesqVZoM/zYEWxIEstw== X-Received: by 10.25.87.135 with SMTP id l129mr9206472lfb.174.1477407326429; Tue, 25 Oct 2016 07:55:26 -0700 (PDT) Received: from dys5r8yycf7d---w7t57y-3.rev.dnainternet.fi (dys5r8yycf7d---w7t57y-3.rev.dnainternet.fi. [2001:14ba:3f2:ee00:226:c7ff:fe5b:8676]) by smtp.gmail.com with ESMTPSA id n79sm3961913lfb.46.2016.10.25.07.55.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Oct 2016 07:55:25 -0700 (PDT) From: Tomi Ollila X-Google-Original-From: Tomi Ollila To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH v2] completion: complete mimetype: search prefix In-Reply-To: <1477247982-28075-1-git-send-email-jani@nikula.org> References: <1477162534-7814-1-git-send-email-jani@nikula.org> <1477247982-28075-1-git-send-email-jani@nikula.org> User-Agent: Notmuch/0.21+14~g053baf4 (http://notmuchmail.org) Emacs/25.1.1 (x86_64-redhat-linux-gnu) Date: Tue, 25 Oct 2016 17:55:18 +0300 Message-ID: <87a8ds1ns9.fsf@dys5r8yycf7d---w7t57y-3.rev.dnainternet.fi> MIME-Version: 1.0 Content-Type: text/plain X-Mailman-Approved-At: Tue, 25 Oct 2016 07:55:49 -0700 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: Tue, 25 Oct 2016 14:55:34 -0000 Jani Nikula writes: > Use /etc/mime.types if available, with a homebrew sed parser, and fall > back to a handful of common types otherwise. I'd suggest the following line: sed -n '/^[[:alpha:]]/ s/[[:space:]].*//p' /etc/mime.types I tested the sed expression works on Linux and Darwin (macOS sierra). I'd guess that any future 'ietf-token' starts with alpha character, and 'x-token' always starts with 'x'. I agree with Jani that we'd rather used some other solution but so far using sed(1) looks like best tolerable choice there is. Tomi PS: used something like the following to start the emacs to send this email: #!/bin/sh :; exec "${EMACS:-emacs}" --debug-init --load "$0" "$@"; exit (eval-after-load "notmuch" (lambda () (setq notmuch-command (concat (file-name-directory load-file-name) "my-notmuch-remote-command")) (setq smtpmail-smtp-server "smtp.gmail.com" smtpmail-smtp-service 465 smtpmail-stream-type 'tls smtpmail-debug-info t smtpmail-debug-verb t message-send-mail-function 'message-smtpmail-send-it) )) (notmuch) ;; Local Variables: ;; mode: emacs-lisp ;; End: PPS: first send failed, had to visit https://www.google.com/settings/security/lesssecureapps ... it would be nice to know what makes this "less secure" application ... > completion/notmuch-completion.bash | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash > index 78047b5f424d..e7e7d68b04ed 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 -n '/^[^ \t#]/{s/[ \t].*//;p;}' < /etc/mime.types > + else > + cat < +application/gzip > +application/msword > +application/pdf > +application/zip > +audio/mpeg > +audio/ogg > +image/gif > +image/jpeg > +image/png > +message/rfc822 > +text/calendar > +text/html > +text/plain > +text/vcard > +text/x-diff > +text/x-vcalendar > +EOF > + fi > +} > + > _notmuch_search_terms() > { > local cur prev words cword split > @@ -85,6 +113,10 @@ _notmuch_search_terms() > COMPREPLY=( $(compgen -d "$path/${cur##folder:}" | \ > sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) ) > ;; > + mimetype:*) > + compopt -o nospace > + COMPREPLY=( $(compgen -P "mimetype:" -W "`_notmuch_mimetype ${cur}`" -- ${cur##mimetype:}) ) > + ;; > *) > local search_terms="from: to: subject: attachment: mimetype: tag: id: thread: folder: path: date: lastmod:" > compopt -o nospace > -- > 2.1.4