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 2C5626DE192D for ; Thu, 12 Nov 2015 00:22:33 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.169 X-Spam-Level: X-Spam-Status: No, score=-0.169 tagged_above=-999 required=5 tests=[AWL=0.401, 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 yktzz5ewBwg6 for ; Thu, 12 Nov 2015 00:22:30 -0800 (PST) Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by arlo.cworth.org (Postfix) with ESMTPS id 3AC566DE14F2 for ; Thu, 12 Nov 2015 00:22:30 -0800 (PST) Received: by wmec201 with SMTP id c201so20537374wme.0 for ; Thu, 12 Nov 2015 00:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=JA/Gabfs+zBTurDeA4YmLhx5RVygsTZ4jyyCRJu4ykM=; b=bDmWmG1aT76sYdTF4u8u02WtOdE5QALzpK/VoqPetUbORTha7Mz8rV1DRbJWpFPrc/ v3yLp5a/Ra5RYCWB9GVW03B54Uwlun/imSzP9zQ6Se9zC46VPTfr1Nr54Itu/2b5kgoV LldSyhyU3TjgmHmS/1w7BjdhFzorOWgCp31ak7qJETbVqs5V4pFZTWy+1uQy/BBqjIlZ PTjxlLgn/UrBFJJjpPHuRLAZn1Xe9Au3CcS6RYwdaP0jDGu62VWrUI/wuYstU9OBUpZi /eEiH+dqr6vI+rFhUC6hedcE/ls3OxxGrOsbfMpvNY4wcVy8+q4PejaTyceWnyg3CijG cfFg== X-Received: by 10.28.47.212 with SMTP id v203mr270743wmv.37.1447316548173; Thu, 12 Nov 2015 00:22:28 -0800 (PST) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by smtp.gmail.com with ESMTPSA id ej10sm12236481wjd.32.2015.11.12.00.22.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Nov 2015 00:22:27 -0800 (PST) From: Mark Walters To: Tomi Ollila , notmuch@notmuchmail.org Cc: tomi.ollila@iki.fi Subject: Re: [PATCH] devel/emacs: add devel/try-emacs-mua.sh In-Reply-To: <1446390985-20989-1-git-send-email-tomi.ollila@iki.fi> References: <1446390985-20989-1-git-send-email-tomi.ollila@iki.fi> User-Agent: Notmuch/0.21~rc1+46~gbcd385e (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Thu, 12 Nov 2015 08:22:25 +0000 Message-ID: <87si4bwrsu.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Thu, 12 Nov 2015 08:22:33 -0000 > devel/try-emacs-mua.sh provides an easy way to try and experiment with > the notmuch emacs client provided in emacs subdirectory of notmuch > source tree. > > User is required to choose whether to run emacs with -q, -Q or neither > -- and experienced ones may add other command line options, like > '-f notmuch'. > > This script ensures that no .el files are newer than corresponding .elc > files so that user (/developer!) does not accidentally experiment with > outdated elisp files. The emacs variable to have the same effect, > `load-prefer-newer' is not available until emacs 24.4. > > The *scratch* buffer is filled with some code user can execute before > running notmuch code. I like this -- a nice simple way to get to a working but uncustomised test environment. I don't know how easy the following would be but one addition that I would find very useful would be a way to make this use the test corpus. This would be useful for giving a completely standard environment for interactive testing, but also for debugging what is going on when tests fail. Of course that is a feature request and should not delay the feature. Finally, I think there is a bug: > --- > > Addressed David's comments in id:87d1xdtim1.fsf@maritornes.cs.unb.ca > with 2 updates: > 1) removed "address completion insinuate" > 2) added code to initialize package system when using -q or -Q > > devel/try-emacs-mua.sh | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 92 insertions(+) > create mode 100755 devel/try-emacs-mua.sh > > diff --git a/devel/try-emacs-mua.sh b/devel/try-emacs-mua.sh > new file mode 100755 > index 000000000000..71be152c2346 > --- /dev/null > +++ b/devel/try-emacs-mua.sh > @@ -0,0 +1,92 @@ > +#!/bin/sh > + > +# This script provides an easy way to try and experiment with the > +# notmuch emacs client provided in notmuch/emacs directory. > + > +set -eu > + > +test $# -gt 0 || { > + exec >&2 > + echo > + echo "Usage: $0 '' | q | Q [other-emacs-args]" > + echo > + printf " $0 %s\n" "'' starts emacs without either -q or -Q option" \ > + "q starts emacs with -q" \ > + "Q starts emacs with -Q" > + echo > + echo Note that if there are notmuch-emacs .elc files that are older than > + echo their corresponding .el files those older .elcs will be removed. > + echo > + exit 1 > +} > + > +case $1 in '') opt= > + ;; q | -q) opt=-q > + ;; Q | -Q) opt=-Q > + ;; *) echo "option '$1' not '', 'q' nor 'Q'" >&2; exit 1 > +esac > +shift > + > +case $0 in > + *\"*) echo "'$0' contain one or more '\"'s" >&2; exit 1 ;; > + */*) d0=${0%/*} ;; > + *) d0=. > +esac > + > +pwd=$PWD > +cd "$d0/.." > +nmd=$PWD > +emd=$PWD/emacs > + > +test -f "$nmd"/emacs/notmuch-lib.el || { > + echo "Cannot find notmuch-emacs source directory" > + exit 1 > +} > + > +if test -x "$nmd"/notmuch > +then > + nmin=' > +To use accompanied notmuch binary from the same source, evaluate > +(setq exec-path (cons \"'"$nmd"'\" exec-path)) > +Note: Evaluating the above may be followed by unintended database > +upgrade and getting back to old version may require dump & restore. > +' > +else > + nmin= > +fi > + > +if test "$opt" = '-q' || test "$opt" = '-Q' > +then > + pkgin=' > +If you want to use packages (like company from elpa) evaluate > +(progn (require '\''package) (package-initialize)) > +' > +else > + pkgin= > +fi As far as I can see at this point we are in $nmd not $emd so the following does not delete stale .elc files. > + > +# ensure we don't load .elc files that are older than corresponding .el file > +# the emacs variable `load-prefer-newer' is not available until emacs 24.4 > +perl -e 'use strict; use warnings; > +while (<*.elc>) { > + my $elc = $_; s/elc$/el/; > + if (-M $_ < -M $elc) { > + warn "$_ is newer than $elc. Removing $elc\n"; > + unlink $elc or die "Failed to remove '\''$elc'\'': $!\n"; > + } > +}' Best wishes Mark > + > +cd "$pwd" > + > +# note: whitespace in $EMACS splits to command and args > +exec ${EMACS:-emacs} $opt -L "$emd" -l "$emd"/notmuch.el "$@" --eval ' > +(with-current-buffer "*scratch*" > + (insert " > +Go to the end of the following lines and type C-x C-e to evaluate > +(or C-j which is shorter but inserts evaluation results into buffer) > + > +To \"disable\" mail sending, evaluate > +(setq message-send-mail-function (lambda () t)) > +'"$nmin$pkgin"' > +To start notmuch (hello) screen, evaluate > +(notmuch-hello)") (set-buffer-modified-p nil))' > -- > 2.0.0 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch