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 A8BF96DE1734 for ; Sun, 6 Sep 2015 23:49:41 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.199 X-Spam-Level: X-Spam-Status: No, score=0.199 tagged_above=-999 required=5 tests=[AWL=0.739, RP_MATCHES_RCVD=-0.55, T_HEADER_FROM_DIFFERENT_DOMAINS=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 jtJHl5GzHOSj for ; Sun, 6 Sep 2015 23:49:39 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 201026DE1704 for ; Sun, 6 Sep 2015 23:49:39 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id 65549100080; Mon, 7 Sep 2015 09:48:12 +0300 (EEST) From: Tomi Ollila To: notmuch@notmuchmail.org Subject: [PATCH] emacs: add emacs/try-emacs-mua.sh Date: Mon, 7 Sep 2015 09:48:10 +0300 Message-Id: <1441608490-9413-1-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 2.0.0 Cc: tomi.ollila@iki.fi X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 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: Mon, 07 Sep 2015 06:49:41 -0000 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 *scratch* buffer is filled with some code user can execute before running notmuch code. --- I developed this when doing series starting from id:1441204482-26509-1-git-send-email-tomi.ollila@iki.fi and found this useful when testing id:1441574945-28437-1-git-send-email-uli@scholler.net emacs/try-emacs-mua.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 emacs/try-emacs-mua.sh diff --git a/emacs/try-emacs-mua.sh b/emacs/try-emacs-mua.sh new file mode 100755 index 000000000000..923137b41de6 --- /dev/null +++ b/emacs/try-emacs-mua.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +# This script provides an easy way to try and experiment with the +# notmuch emacs client provided in this 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 + 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" +elwd=$PWD + +# ensure we don't load .elc files that are older than corresponding .el file +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"; + } +}' + +cd "$pwd" + +# note: whitespace in $EMACS splits to command and args +exec ${EMACS:-emacs} $opt -L "$elwd" -l "$d0"/notmuch.el "$@" --eval ' +(with-current-buffer "*scratch*" + (let ((pdir (expand-file-name "'"$elwd/.."'"))) + (insert " +Go to the end of the following lines and type C-x C-e to evaluate + +To \"disable\" mail sending, evaluate +(setq message-send-mail-function (lambda () t)) + +To enable address completion, evaluate +(notmuch-address-message-insinuate) + +To use accompanied notmuch binary from the same source, evaluate +(setq exec-path (cons \"" pdir "\" exec-path)) +Note: Evaluating the above may be followed by unintended database +upgrade and getting back to old version may require dump & restore. + +To start notmuch (hello) screen, evaluate +(notmuch-hello)")) (set-buffer-modified-p nil))' -- 2.0.0