Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 0065D6DE0275 for ; Wed, 24 Feb 2016 09:22:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -1.011 X-Spam-Level: X-Spam-Status: No, score=-1.011 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.211, 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 vMF0BjWyG4fs for ; Wed, 24 Feb 2016 09:21:56 -0800 (PST) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by arlo.cworth.org (Postfix) with ESMTPS id 9C86B6DE00DF for ; Wed, 24 Feb 2016 09:21:55 -0800 (PST) Received: by mail-pa0-f47.google.com with SMTP id yy13so15823421pab.3 for ; Wed, 24 Feb 2016 09:21:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=DjYYQoFB9+sH8qJ/vU001WzEPJCKaSqRHaV1wrXguVA=; b=SpDkIZTGkbknpcUEaPdDV+58j0Gx2Pkg/dbETiOsylMBVPk8j1Q/sA89x67y0OkqOR EVAH6hg1wx9VUVk8KUmU2f2GxpBH9fnSisFZ8fTsV3FCOwbMbHB2zK029kHCBWzILvvF YJUmxr5lNYPgSqXx8mvZ0xF4d4Oen6YKV+MdtSvVQXEL3+E6nE7oZL+P3Jj3JrkHGMyo 4FX/soK7vKaolY/HPQwk7FZVnJj5SbQR6mGk3dE9k0XH2fjeIbeyJ3C/X5jhe0C1Wprw RZSxr964GPAyrosBltxbaXVqTJ913EADmXz5fe1HtS8fZr3HaKcBpnM9mKl01Sv3frYU r0MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:subject:message-id :mail-followup-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=DjYYQoFB9+sH8qJ/vU001WzEPJCKaSqRHaV1wrXguVA=; b=H1RKjXBoYjB1VqRl3d/UGslaUen2dCHsV30NVX6VHS1SZkY6HqoXlQ+Sa4/oE7KTw3 NBXa0n98pBSEOohvG6iBqYLao+tPNezzWdl91U0nwKlgZfjy8qcVIgAB3RxvIygaBLHk HwYCbjNqzj2DWdg2nT34MShe3OXP8tHDPl88AXvCK+/NOVPI2WHKnQEboTOdWaDwZzzH UhLvcEF/VWJiVsRVg8wq5SLCUU75FZjya4Dq3e9B8i9SMeTGF5Uw45UX+euo0WXSks4m 4Dsju7LeaBSl3us+nP99a41Q4cslO8bR96PyP6zR/6InXzlwxEXXmmtj2eE2hB2lvuaB zwoQ== X-Gm-Message-State: AG10YOTQFxhgsznXIXL1lpTWN1Tf6Q4qN5mU793XboQ5TjAuWy3JjlrKF+IrGnpVJct3dg== X-Received: by 10.67.6.10 with SMTP id cq10mr56341123pad.120.1456334514146; Wed, 24 Feb 2016 09:21:54 -0800 (PST) Received: from chitra.no-ip.org ([111.91.230.10]) by smtp.gmail.com with ESMTPSA id g10sm6374584pfd.92.2016.02.24.09.21.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Feb 2016 09:21:52 -0800 (PST) Sender: Suvayu Ali Date: Wed, 24 Feb 2016 22:51:45 +0530 From: Suvayu Ali To: notmuch@notmuchmail.org Subject: Re: Loading a notmuch email buffer in Emacs from the command line Message-ID: <20160224172145.GD32295@chitra.no-ip.org> Mail-Followup-To: notmuch@notmuchmail.org References: <87egc8nhdh.fsf@nawaz.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="AqsLC8rIMeq19msA" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 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: Wed, 24 Feb 2016 17:22:01 -0000 --AqsLC8rIMeq19msA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Feb 20, 2016 at 12:16:33PM +0200, Tomi Ollila wrote: > On Sat, Feb 20 2016, Neeum Zawan wrote: > > > > Is there a way (e.g. with emacsclient) to load up a particular email > > thread or email message buffer from the command line? > > quick test yields that at least > > emacs -f notmuch --eval '(notmuch-search "id:87egc8nhdh.fsf@nawaz.org")' > > works (maybe not exactly as desired, but based on that more should > be able to be achieved with moderate ease...) I use the attached script to open the mail I'm reading in Mutt in Emacs so that I can link to it in my Org mode notes, etc. You could write a function that calls the required capture templates and use it in place of the call to notmuch-show. Probably you also want to remove the GNU Screen related stuff (call to screen select and the check for $STY). Hope this helps, -- Suvayu Open source is the future. It sets us free. --AqsLC8rIMeq19msA Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=notmuch-emacs #!/bin/bash # set -o xtrace # FIXME: handle cases when not invoked from within screen declare -a emacsen=(/tmp/emacs$UID/*) screens=(/var/run/screen/S-$USER/*) # NOTE: look at screen -Q for querying # FIXME: cleaner way of switching to threads (something like mutt-search) declare thread=$1 [[ -n $STY ]] && { \ screen -X select nwc; # emacsclient window name for me # NB: reading from PIPE; and it's ok to remove all <, >, or # spaces, they are not allowed in a Message-ID msgid=$(formail -c -x Message-ID | sed -e 's/[<> ]//g') if [[ -n $thread ]]; then query=$(notmuch search --output=threads -- "id:$msgid") emacsclient --eval "(notmuch-tree \"$query\")" else query="id:$msgid" emacsclient --eval "(notmuch-show \"$query\")" fi } --AqsLC8rIMeq19msA--