Re: Loading a notmuch email buffer in Emacs from the command line

2016-02-20 Thread Tomi Ollila
On Sat, Feb 20 2016, Neeum Zawan  wrote:

> Hi,
>
> 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@nawaz.org")'

works (maybe not exactly as desired, but based on that more should
be able to be achieved with moderate ease...)

>
> Also, for those familiar with Org mode, I'd like to do something
> similar: Suppose I have the ID of an email. Can I, from the command
> line, launch a capture template with a prepopulated link to the notmuch
> message?
>
> The rationale: I'd like to switch to using alot for reading emails as
> opposed to the Emacs interface. However, there will be times where I'd
> like to make Org mode notes about an email or view it within Emacs. So
> I'd like to set up a command from alot to open it in Emacs.
>
> -- 
> A neutrino walks into a bar. The bartender asks him if he wants 
> anything to drink. "No thanks, just passing through."
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Lost updates to Notmuch database

2016-02-18 Thread Tomi Ollila
On Thu, Feb 18 2016, David Bremner  wrote:

> Eric J  writes:
>
>> However, if I do it twice, in different processes, at the same time, one
>> file is added and tagged properly, the other is not (totally unfindable
>> by notmuch search). Neither process reports any error, and they both log
>> their actions normally. Actually a third simultaneous process also fails
>> to leave any result in the database.
>
> It should be impossible for more than one process to open a Xapian
> database for writing at the same time. So if the processes are really
> running in parallel, you should be getting error codes from the later
> calls to notmuch_database_open{_verbose}. You claim that's not
> happening, which is puzzling. Maybe you can try to duplicate your
> problem with a tiny C program.

In addition to that (or even before), you could

1) be able to reproduce the problem
2) try to reproduce it prefixing the command with ltrace -tt
3) examine carefully the ltrace logs to figure out where the proble lies

Tomi

Hmm, Interestingly when I run

LD_LIBRARY_PATH=~/vc/ext/notmuch/lib ltrace -f -tt 
~/vc/ext/notmuch/notmuch-shared new

I did not see any Xapian references, but when I did

ltrace -f -tt ~/vc/ext/notmuch/notmuch new

I did. Interestingly when using libnotmuch.so.4 the xapian interface
is hidden (is it baked inside ~/vc/ext/notmuch/lib/libnotmuch.so.4.3.0 :O)


___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v5 0/7] emacs: Improve the cited message included in replies

2016-02-14 Thread Tomi Ollila
On Sun, Feb 14 2016, Mark Walters  wrote:

> This is a slight update and a rebase of this patch set (previous
> version at
> id:1446894276-7814-1-git-send-email-markwalters1...@gmail.com )
>
> The only change from last time (apart from fixing rebasing to master)
> is the rewording of couple of minor comments inline with dme's review
> of the previous version.
>
> Although I am submitting it is primarily dme's series, with minor
> updates from me.
>
> One particular motivation for this series is that it fixes a long
> standing bug we have that replying to a message with an rfc822 part
> completely omits that part. It also fixes the bug whereby we don't
> include application/octet-stream parts which are actually text/plain
> (and thus are displayed in show mode).
>
> This series makes the reply code use the same code as the show code so
> everything works as expected: the reply buffer looks essentially the
> same as the show buffer.
>
> There is one slight difference: the user might want different part
> headers displayed when replying; both because the audience is
> different (a non-notmuch using recipient) and because the buttons
> don't "work" (you can't click on them to show or view a part).
>
> Dme and I disagree on which of these we would like to see so make that
> customisable.

Does *NOT* look bad, works and (relevant) tests pass.

We'd need at least David to verify that Mark got his (David's that is)
patches properly rebased...

Tomi

>
> The key change is patch 3 which switches how reply works. Also note
> that patch 2 is almost all whitespace change as the changes modify the
> indentation.
>
> Best wishes
>
> Mark
>
>
> David Edmondson (6):
>   emacs/show: Re-arrange determination if a part header is necessary
>   emacs/show: Accommodate the lack of part header buttons
>   emacs/mua: Generate improved cited text for replies
>   emacs/show: Remove the 'no-buttons option of
> `notmuch-show-insert-bodypart'
>   emacs/show: Make the insertion of part headers overridable.
>   emacs/mua: Let user specify which parts get a header in citations.
>
> Mark Walters (1):
>   test: fix the tests for the new reply code
>
>  emacs/notmuch-mua.el  |  60 ++---
>  emacs/notmuch-show.el | 144 
> +++---
>  test/T310-emacs.sh|  32 +++
>  test/test-lib.el  |   4 ++
>  4 files changed, 156 insertions(+), 84 deletions(-)
>
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] test/README: have matching test script file names

2016-02-12 Thread Tomi Ollila
A while ago test script names were changed to format
Tddd-basename.sh. Update README to reflect that.

While at it, included some small requirements updates.
---

'A while ago' here means like 25 months (change was done Jan 2014).
I started doing this change in March 2014 but dropped after got
too exhaustive thoughts of how to continue. Now I did minor change
to make TEST_EMACS=my-emacs TEST_EMACSCLIENT=my-emacsclient make test
lines fit on 80 columns...

 test/README | 34 ++
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/test/README b/test/README
index e54e36b..bd9ab54 100644
--- a/test/README
+++ b/test/README
@@ -8,10 +8,17 @@ enhance.
 
 Prerequisites
 -
+The test system itself requires:
+
+  - bash(1) version 4.0 or newer
+
+Without bash 4.0+ the tests just refuse to run.
+
 Some tests require external dependencies to run. Without them, they
 will be skipped, or (rarely) marked failed. Please install these, so
 that you know if you break anything.
 
+  - GNU tar(1)
   - dtach(1)
   - emacs(1)
   - emacsclient(1)
@@ -19,14 +26,21 @@ that you know if you break anything.
   - gpg(1)
   - python(1)
 
+If your system lacks these tools or have older, non-upgreable versions
+of these, please (possibly compile and) install these to some other
+path, for example /usr/local/bin or /opt/gnu/bin. Then prepend the
+chosen directory to your PATH before running the tests.
+
+e.g. env PATH=/opt/gnu/bin:$PATH make test
+
 Running Tests
 -
 The easiest way to run tests is to say "make test", (or simply run the
 notmuch-test script). Either command will run all available tests.
 
 Alternately, you can run a specific subset of tests by simply invoking
-one of the executable scripts in this directory, (such as ./search,
-./reply, etc). Note that you will probably want "make test-binaries"
+one of the executable scripts in this directory, (such as ./T*-search.sh,
+./T*-reply.sh, etc). Note that you will probably want "make test-binaries"
 before running individual tests.
 
 The following command-line options are available when running tests:
@@ -80,9 +94,9 @@ can be specified as follows:
 You can choose an emacs binary (and corresponding emacsclient) to run
 the tests in one of the following ways.
 
-   TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient make test
-   TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient ./emacs
-   make test TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient
+   TEST_EMACS=my-emacs TEST_EMACSCLIENT=my-emacsclient make test
+   TEST_EMACS=my-emacs TEST_EMACSCLIENT=my-emacsclient ./T*-emacs.sh
+   make test TEST_EMACS=my-emacs TEST_EMACSCLIENT=my-emacsclient
 
 Some tests may require a c compiler. You can choose the name and flags 
similarly
 to with emacs, e.g.
@@ -126,9 +140,13 @@ skipped by the user, as failures.
 
 Writing Tests
 -
-The test script is written as a shell script.  It should start with
-the standard "#!/usr/bin/env bash" with copyright notices, and an
-assignment to variable 'test_description', like this:
+The test script is written as a shell script. It is to be named as
+Tddd-testname.sh where 'ddd' is three digits and 'testname' the "bare"
+name of your test. Tests will be run in order the 'ddd' part determines.
+
+The test script should start with the standard "#!/usr/bin/env bash"
+with copyright notices, and an assignment to variable 'test_description',
+like this:
 
#!/usr/bin/env bash
#
-- 
1.9.3

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v3] emacs: Report a lack of matches when calling `notmuch-show'.

2016-02-12 Thread Tomi Ollila
On Thu, Feb 11 2016, David Edmondson  wrote:

> If the basic query passed to `notmuch-show' generates no results, ring
> the bell and inform the user that no messages matched the query rather
> than displaying an empty buffer and showing an obscure error.

Looks good (the parts I understood) and works fine (testing with
devel/try-emacs-mua). 

FYI: when testing with (eval-last-sexp) interactively (c-x c-e)
message does not appear in minibuffer -- since the following 'nil'
will take its place -- the msg is in *Messages* buffer

Tomi

>
> Similarly when refreshing a `notmuch-show' buffer and no messages match.
> ---
>  emacs/notmuch-show.el | 144 
> +-
>  emacs/notmuch.el  |   6 ++-
>  2 files changed, 89 insertions(+), 61 deletions(-)
>
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v3 06/16] Prefer gpg2 in the test suite if available

2016-02-10 Thread Tomi Ollila
On Wed, Feb 10 2016, Daniel Kahn Gillmor  wrote:

> On Wed 2016-02-10 06:54:12 -0500, David Bremner wrote:
>> Daniel Kahn Gillmor  writes:
>>
>>>  
>>> +# choose the preferred GnuPG binary:
>>> +if command -v gpg2 > /dev/null; then
>>> +GPG=gpg2
>>> +else
>>> +GPG=gpg
>>> +fi
>>
>> It feels like this should maybe be in configure, to centralize the choice
>> of GPG default. At least, that would be consistent with python / python2
>
> I'm not sure what to do here.  Ultimately, i don't want there to be a
> choice because i plan on having /usr/bin/gpg provided by gpg2, so this
> will all be moot.

Code searches through PATH, so IMO this test could do the same (with
reasonable similarity (like above)). This could add check whether GPG
is already defined that definition is used...


>
> So i'm not inclined to spend much more time/engineering effort on it,
> but if someone wants to propose moving these choices into configure, i'd
> be willing to review.
>
>--dkg
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [Gaudenz Steinlin] Bug#810784: should match email adress case insensitive when sending encrypted mail

2016-02-10 Thread Tomi Ollila
On Tue, Feb 09 2016, David Edmondson  wrote:

> On Mon, Feb 08 2016, David Edmondson wrote:
>> On Mon, Feb 08 2016, David Edmondson wrote:
>>> On Fri, Jan 15 2016, Daniel Kahn Gillmor wrote:
 So where is the case-insensitive lookup happening?  Is this a bug in
 mml-mode, or in notmuch-emacs?
>>>
>>> It's caused by behaviour in mml2015.el (hence upstream).
>>>
>>> `mml2015-epg-check-user-id' uses `equal' to compare the recipient from
>>> the composition buffer with the addresses from the matching key.
>>>
>>> The simplest way to get the desired behaviour would be to `downcase'
>>> both strings before comparing.
>>
>> Reported as bug#22603 in emacs.
>
> Fixed in the emacs-25 branch.

We could perhaps add defadvice to **wiki** for those who want to 
do global change in their emacs environment, something like:

(if (< emacs-major-version 25)
  (defadvice mml2015-epg-check-user-id (around downcase activate)
(ad-set-arg 1 (downcase (ad-get-arg 1)))
(ad-set-arg 2 (downcase (ad-get-arg 2)))
ad-do-it))

totally untested -- also now that I finished that 'before might also work.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v5 3/3] emacs: Bind filter in search to 'l'

2016-02-10 Thread Tomi Ollila
On Tue, Feb 09 2016, Mark Walters  wrote:

> On Tue, 09 Feb 2016, David Edmondson  wrote:
>> On Sat, Jun 13 2015, Mark Walters wrote:
>>> Change the key binding for filter (or "limit") in search-mode. This
>>> gives consistency with the new filter in show-mode, and frees 'f' for
>>> forward-thread in the future.
>>
>> Is there a conclusion on this change? The patch itself seems obviously
>> fine from a code perspective, at issue is more whether it's acceptable
>> to change the key binding.
>>
>> The equivalent binding in notmuch-show mode is already "l", and I think
>> that it makes sense to be consistent (i.e. the change should be
>> applied).
>
> I broadly agree, particularly as it will free up f for forwarding a
> thread in search view (which is easy to do on top of
> id:1454931262-21362-1-git-send-email-...@dme.org).
>
> It will be annoying in the short term to learn the change, but I don't
> see a way round that.

In short, +1 for the change.

Tomi

>
> Best wishes
>
> Mark
>
>>> ---
>>>  emacs/notmuch.el | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
>>> index 6564816..06e3b94 100644
>>> --- a/emacs/notmuch.el
>>> +++ b/emacs/notmuch.el
>>> @@ -166,7 +166,7 @@ (defvar notmuch-search-mode-map
>>>  (define-key map "o" 'notmuch-search-toggle-order)
>>>  (define-key map "c" 'notmuch-search-stash-map)
>>>  (define-key map "t" 'notmuch-search-filter-by-tag)
>>> -(define-key map "f" 'notmuch-search-filter)
>>> +(define-key map "l" 'notmuch-search-filter)
>>>  (define-key map [mouse-1] 'notmuch-search-show-thread)
>>>  (define-key map "*" 'notmuch-search-tag-all)
>>>  (define-key map "a" 'notmuch-search-archive-thread)
>>> @@ -983,7 +983,7 @@ (defun notmuch-search-toggle-order ()
>>>(notmuch-search-refresh-view))
>>>  
>>>  (defun notmuch-search-filter (query)
>>> -  "Filter the current search results based on an additional query string.
>>> +  "Filter or LIMIT the current search results based on an additional query 
>>> string.
>>>  
>>>  Runs a new search matching only messages that match both the
>>>  current search results AND the additional query string provided."
>>> -- 
>>> 2.1.4
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'.

2016-02-07 Thread Tomi Ollila
On Mon, Feb 08 2016, Mark Walters  wrote:

> On Sat, 06 Feb 2016, David Edmondson  wrote:
>> If the basic query passed to `notmuch-show' generates no results,
>> throw an error and inform the user that no messages matched the query
>> rather than displaying an empty buffer and showing an obscure error.
>
> Hi
>
> First this is a clear improvement on the current behaviour, an I am
> happy with it as is.
>
> However, I wonder if we actually want an error at all in this case,
> rather than just a "message". I think some people run with
> debug-on-error enabled and it might be annoying in that case (though
> clearly less annoying than the current situation).

Actually I got the same when testing

(notmuch-show "id:nonexistent") M-x eval-print-last-sexp

instead of M-x eval-last-sexp

(C-j in lisp-interaction buffer, instead of c-x c-e)

... I agree that if we handle the situation, perhaps throwing an
error is not the best way...

> [If anyone cares the current error comes from the marking read code in
> the post-command hook which assumes the buffer has a message]
>
> Best wishes
>
> Mark
>
>
>> ---
>>  emacs/notmuch-show.el | 8 +++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
>> index 3345878..335992e 100644
>> --- a/emacs/notmuch-show.el
>> +++ b/emacs/notmuch-show.el
>> @@ -1248,7 +1248,13 @@ function is used."
>>  (when (and (eq (buffer-size) 0)
>> notmuch-show-query-context)
>>(notmuch-show-insert-forest
>> -   (notmuch-query-get-threads (append cli-args basic-args)
>> +   (notmuch-query-get-threads (append cli-args basic-args
>> +
>> +;; If there are still no results, kill the buffer and throw an
>> +;; error.
>> +(when (eq (buffer-size) 0)
>> +  (kill-buffer (current-buffer))
>> +  (error "No messages matched the query.")))
>>  
>>(jit-lock-register #'notmuch-show-buttonise-links)
>>  
>> -- 
>> 2.1.4
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v1] (notmuch-show "id:doesnotexist") should not throw an error.

2016-02-06 Thread Tomi Ollila
On Sat, Feb 06 2016, David Edmondson  wrote:

> (notmuch-show "id:doesnotexist") should not throw an error.

Great! this works ^

Tomi

>
> This is a followup to id:"874nw0ltwz@praet.org" and
> id:"cuntx91fwaa@hotblack-desiato.hh.sledj.net".
>
> The originally proposed change (to have id: links call `notmuch-show'
> rather than `notmuch-search') was already made, but the difficulties
> with links that generated no results was not addressed. This patch
> aims to do that.
>
>
> David Edmondson (1):
>   emacs: Report a lack of matches when calling `notmuch-show'.
>
>  emacs/notmuch-show.el | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: nmbug in the Debian packages?

2016-02-06 Thread Tomi Ollila
On Sat, Feb 06 2016, David Bremner  wrote:

> Tomi Ollila  writes:
>
>> On Sat, Feb 06 2016, David Edmondson  wrote:
>>
>>> I'd like to use nmbug without having to grovel around in the notmuch git
>>> repository. Could it be added to the Debian package, please?
>>
>> I think it should be put into *separate* debian package.
>>
>
> Out of curiousity, why do you think this? It only depends on the CLI and
> python.

so that nmbug is not in 'notmuch' debian package but in 'nmbug' or
'notmuch-nmbug' package (like we now have 'notmuch-emacs' package).

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Allow indexing cleartext of encrypted messages (v3)

2016-02-06 Thread Tomi Ollila
On Sun, Jan 31 2016, Daniel Kahn Gillmor  wrote:

> This is the third draft of the series initially announced in
> id:1449718786-28000-1-git-send-email-...@fifthhorseman.net (second
> draft was in
> id:1453258369-7366-1-git-send-email-...@fifthhorseman.net).  It
> differs from v2 in that it incorporates the recent improvements in
> detecting and processing S/MIME signatures.

Looks pretty good. Nothing to bikeshed. Did not run tests yet.

Tomi


>
> From the v2 description:
>
>> Notmuch currently doesn't index the cleartext of encrypted mail.  This
>> is the right choice by default, because the index is basically
>> cleartext-equivalent, and we wouldn't want every indexed mailstore to
>> leak the contents of its encrypted mails.
>> 
>> However, if a notmuch user has their index in a protected location,
>> they may prefer the convenience of being able to search the contents
>> of (at least some of) their encrypted mail.
>> 
>> This series of patches enables notmuch to index the cleartext of
>> specific encrypted messages when they're being added via "notmuch new"
>> or "notmuch insert", via a new --try-decrypt flag.
>> 
>> If --try-decrypt is used, and decryption is successful for part of a
>> message, the message gets an additional "index-decrypted" tag.  If
>> decryption of part of a message fails, the message gets an additional
>> "index-decryption-failed" tag.
>
> v2 addresses the concerns raised from the helpful feedback on the
> previous series, and adds a notmuch_indexopts_t object that can be
> used to declare options for indexing messages, including a
> "try_decrypt" boolean.
>
> Additionally, this series adds a new function to libnotmuch:
>
>   notmuch_message_reindex (notmuch_message_t *message,
>notmuch_indexopts_t *indexopts)
>
> Which allows user of the library to adjust the indexing options of a
> given message.
>
> The CLI is additionally augmented with a new notmuch subcommand,
> "notmuch reindex", which also has a --try-decrypt flag.
>
> So a user who has their message index stored securely and wants to
> index the cleartext of all encrypted messages they've received can do
> something like:
>
>   notmuch reindex --try-decrypt tag:encrypted and not tag:index-decrypted
>
> Or can clear all indexed cleartext from their database with:
>
>   notmuch reindex tag:encrypted and tag:index-decrypted
>
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v1] emacs: Fix compiler warnings.

2016-02-06 Thread Tomi Ollila
On Sat, Feb 06 2016, David Edmondson  wrote:

> notmuch-mua.el should declare functions that it uses from
> notmuch-maildir-fcc.el.
> ---
>  emacs/notmuch-mua.el | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 5462f54..d4fad7b 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -29,6 +29,8 @@
>  (eval-when-compile (require 'cl))
>  
>  (declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part 
> depth &optional hide))
> +(declare-function notmuch-fcc-header-setup "notmuch-maildir-fcc" ())
> +(declare-function notmuch-fcc-handler "notmuch-maildir-fcc" (destdir))

LGTM. Emacs mua still works ;D

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: nmbug in the Debian packages?

2016-02-06 Thread Tomi Ollila
On Sat, Feb 06 2016, David Edmondson  wrote:

> I'd like to use nmbug without having to grovel around in the notmuch git
> repository. Could it be added to the Debian package, please?

I think it should be put into *separate* debian package.

>
> (I can try to prepare a patch, but figured that it merited discussion
> first.)

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 06/16] Prefer gpg2 in the test suite if available

2016-01-24 Thread Tomi Ollila
On Wed, Jan 20 2016, Daniel Kahn Gillmor  wrote:

> Now that the notmuch client prefers gpg2 if available, having the test
> suite use the same preference makes it more likely to validate as
> expected.
>
> Be warned that the final test in T350-crypto.sh fails with an infinite
> loop in gpg if you're using an unpatched GnuPG 2.1.10, due to an
> upstream GnuPG bug: https://bugs.gnupg.org/gnupg/issue2187.  In
> debian, this is resolved in 2.1.10-3
> ---
>  test/README |  2 +-
>  test/T030-config.sh |  2 +-
>  test/T040-setup.sh  |  2 +-
>  test/T350-crypto.sh | 16 
>  test/test-lib.sh| 10 +-
>  5 files changed, 20 insertions(+), 12 deletions(-)
>
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -85,6 +85,13 @@ unset GREP_OPTIONS
>  # For emacsclient
>  unset ALTERNATE_EDITOR
>  
> +# choose the preferred GnuPG binary:
> +if hash gpg2 2> /dev/null; then

For consistency, instead of hash ... 2>/dev/null, use command -v >/dev/null

Tomi

> +GPG=gpg2
> +else
> +GPG=gpg
> +fi
> +
>  # Convenience
>  #
>  # A regexp to match 5 and 40 hexdigits
> @@ -1139,6 +1146,7 @@ test_emacs () {
>   $load_emacs_tests \
>   --eval '(setq server-name \"$server_name\")' \
>   --eval '(server-start)' \
> + --eval '(setq epg-gpg-program \"$GPG\")' \
>   --eval '(orphan-watchdog $$)'" || return
>   EMACS_SERVER="$server_name"
>   # wait until the emacs server is up
> @@ -1327,5 +1335,5 @@ test_declare_external_prereq dtach
>  test_declare_external_prereq emacs
>  test_declare_external_prereq ${TEST_EMACSCLIENT}
>  test_declare_external_prereq gdb
> -test_declare_external_prereq gpg
> +test_declare_external_prereq gpg2 || test_declare_external_prereq gpg
>  test_declare_external_prereq ${NOTMUCH_PYTHON}
> -- 
> 2.7.0.rc3
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 04/16] Provide _notmuch_crypto_{set,get}_gpg_path

2016-01-24 Thread Tomi Ollila
On Wed, Jan 20 2016, Daniel Kahn Gillmor  wrote:

> Use functions to access the gpg_path for a _notmuch_crypto_t object.
> This lets us return sensible defaults based on the state of the user's
> machine.
> ---
>  notmuch-reply.c | 13 ++---
>  notmuch-show.c  | 12 ++--
>  util/crypto.c   | 49 -
>  util/crypto.h   |  8 +++-
>  4 files changed, 75 insertions(+), 7 deletions(-)
>
> diff --git a/util/crypto.c b/util/crypto.c
> index c18c82c..0b51347 100644
> --- a/util/crypto.c
> +++ b/util/crypto.c
> @@ -21,7 +21,11 @@
>  
>  #include "notmuch.h"
>  #include "crypto.h"
> +#include "search-path.h"
>  #include 
> +#include 
> +
> +#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
>  
>  #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))

duplicate ARRAY_SIZE definition ?

>  
> @@ -38,7 +42,7 @@ get_gpg_context (_notmuch_crypto_t *crypto, 
> GMimeCryptoContext **ctx)
>  }
>  
>  /* TODO: GMimePasswordRequestFunc */
> -crypto->gpgctx = g_mime_gpg_context_new (NULL, crypto->gpgpath ? 
> crypto->gpgpath : "gpg");
> +crypto->gpgctx = g_mime_gpg_context_new (NULL, 
> _notmuch_crypto_get_gpg_path(crypto));
>  if (! crypto->gpgctx) {
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: refactor directory name sanitization

2016-01-23 Thread Tomi Ollila
On Sat, Jan 23 2016, David Bremner  wrote:

> test_C and notmuch_search_files_sanitize were giving different output on
> the same path, which is not technically wrong, but slightly
> confusing.
> ---
>  test/T560-lib-error.sh |  2 +-
>  test/test-lib.sh   | 11 ---
>  2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
> index c280939..59a479c 100755
> --- a/test/T560-lib-error.sh
> +++ b/test/T560-lib-error.sh
> @@ -183,7 +183,7 @@ int main (int argc, char** argv)
>  EOF
>  cat <<'EOF' >EXPECTED
>  == stdout ==
> -Path already exists: CWD/mail
> +Path already exists: MAIL_DIR
>  
>  == stderr ==
>  EOF
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 0c9b366..c8f14d9 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -684,9 +684,14 @@ notmuch_search_sanitize ()
>  perl -pe 's/("?thread"?: ?)("?)("?)/\1\2XXX\3/'
>  }
>  
> -notmuch_search_files_sanitize()
> +notmuch_search_files_sanitize ()
>  {
> -sed -e "s,$MAIL_DIR,MAIL_DIR,"
> +notmuch_dir_sanitize
> +}
> +
> +notmuch_dir_sanitize ()
> +{
> +sed -e  "s,$MAIL_DIR,MAIL_DIR," -e "s,${PWD},CWD,g" "$@"

Looks good,  ^^ \ but 2 spaces there

>  }
>  
>  NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,'
> @@ -1186,7 +1191,7 @@ test_C () {
>  echo "== stdout ==" > OUTPUT.stdout
>  echo "== stderr ==" > OUTPUT.stderr
>  ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr
> -sed "s,${PWD},CWD,g"  OUTPUT.stdout OUTPUT.stderr > OUTPUT
> +notmuch_dir_sanitize  OUTPUT.stdout OUTPUT.stderr > OUTPUT

Ditto, although this was th^^ere before, but now these 2 could be amended.

BTW: I trust you tested. I did not.

Tomi


BTW2: MAIL_DIR is based on user's current CWD(*) -- if that contains commas
(,) then things will break ;/

(*) +++(./test-lib-common.sh:148): 
MAIL_DIR=/home/user/vc/ext/notmuch/test/tmp.test-verbose/mail



___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] configure: pass HAVE_TIMEGM to build

2016-01-22 Thread Tomi Ollila
Checking the existence of timegm() function and setting
configure internal variable ${have_timegm} was done, but
actually defining HAVE_TIMEGM in build was not done --
meaning that compat timegm() was always part of final
notmuch binaries.
---
 configure | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/configure b/configure
index abd28da..a79f6bd 100755
--- a/configure
+++ b/configure
@@ -969,6 +969,10 @@ HAVE_STRCASESTR = ${have_strcasestr}
 # build its own version)
 HAVE_STRSEP = ${have_strsep}
 
+# Whether the timegm function is available (if not, then notmuch will
+# build its own version)
+HAVE_TIMEGM = ${have_timegm}
+
 # Whether struct dirent has d_type (if not, then notmuch will use stat)
 HAVE_D_TYPE = ${have_d_type}
 
@@ -1041,6 +1045,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) 
\$(GMIME_CFLAGS)  \\
   \$(VALGRIND_CFLAGS)   \\
   -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\
   -DHAVE_STRSEP=\$(HAVE_STRSEP) \\
+  -DHAVE_TIMEGM=\$(HAVE_TIMEGM) \\
   -DHAVE_D_TYPE=\$(HAVE_D_TYPE) \\
   -DSTD_GETPWUID=\$(STD_GETPWUID)   \\
   -DSTD_ASCTIME=\$(STD_ASCTIME) \\
@@ -1054,6 +1059,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) 
\$(GMIME_CFLAGS)\\
 \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\
 -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)   \\
 -DHAVE_STRSEP=\$(HAVE_STRSEP)   \\
+-DHAVE_TIMEGM=\$(HAVE_TIMEGM)   \\
 -DHAVE_D_TYPE=\$(HAVE_D_TYPE)   \\
 -DSTD_GETPWUID=\$(STD_GETPWUID) \\
 -DSTD_ASCTIME=\$(STD_ASCTIME)   \\
-- 
1.9.3

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Filesystem functionality used by notmuch

2016-01-14 Thread Tomi Ollila
On Thu, Jan 14 2016, Erik Quaeghebeur  wrote:

> Dear group,
>
>
> Context: FUSE filesystem for accessing data in a database.
>
> I understand that notmuch needs to be able to read a file given a
> filename (including its path). Are there any more requirements on the
> filesystem. For example, I assume that filename modification is optional
> (maildir flag changes). But perhaps notmuch makes use of times stored
> with files or some other file property?

notmuch new uses directory (and may, or may not (did not check) file) times
to figure out new files appearing in fs.

https://github.com/domo141/nottoomuch/blob/master/mboxviewfs.c is a FUSE 
filesystem which shows files in one mbox file as separate files; it uses
the Date: header for the times of individual files and last per month
for a directory times (files are shown in .../-mm/ directory hierarchy).

Tomi

>
> Best,
>
> Erik
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Message-ID's vs. Resent-Message-ID

2016-01-10 Thread Tomi Ollila
On Sun, Jan 10 2016, Erik Quaeghebeur  wrote:

> Thanks, Tomi, for your quick response.
>
>> > * If yes, for resent messages
>> > (https://tools.ietf.org/html/rfc2822#section-3.6.6), does notmuch use
>> > (the chronologically last) Resent-Message-ID, or the Message-ID?
>> 
>> the Message-ID
>
> Hmm. Is this a conscious decision, or is the resending case just not
> taken into account?

(most probably just) not taken into account

> What happens if I have both a message and my own copy of it after
> resending it to somebody else? I would like to have a record of whom I
> resent it to, as with forwarded messages (where the forwarded message
> does have a different message id).

Both of the copies are "files" of the same message; i.e.

notmuch search --output=files id: will list both (all)
filenames

> Are the Resent-* headers of the resent message merged into the database
> entry? I guess this last question is more general: with multiple messages
> with the same Message-ID but differences (for whatever reason), how will
> these messages be merged in the database?

Database has fixed set of headers stored per message and (afaik) none
of the Resent-* headers are there (merged or separate).

(One thing to remember (for anyone perhaps planning to do something about
this) is that if we'd use Resent-Message-ID: as message identification 
if it exists, then Message-ID: of the message should act as In-Reply-To:
or References: -header...)

Tomi

> Best,
>
> Erik
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Message-ID's vs. Resent-Message-ID

2016-01-10 Thread Tomi Ollila
On Sun, Jan 10 2016, Erik Quaeghebeur  wrote:

> Hi,
>
>
> I've become interested in notmuch. After looking at the documentation of
> the Python bindings, I have the following questions:

> * Is it correct that a message's Message-ID used as its unique key in the
> notmuch database?

yes

> * If yes, is it correct that two messages with the same Message-ID, but
> with different contents/other headers, will have only one entry in the
> database?

yes

> * If yes, for resent messages
> (https://tools.ietf.org/html/rfc2822#section-3.6.6), does notmuch use
> (the chronologically last) Resent-Message-ID, or the Message-ID?

the Message-ID

>
>
> Best,

likewise :)

>
> Erik


Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: WIP: add metadata to dump output

2016-01-10 Thread Tomi Ollila
On Sun, Jan 10 2016, David Bremner  wrote:

> It seems (at least to me) that xapian metadata is the right way store
> certain configuration data, including tag aliases [1] and perhaps some
> non-CLI specific configuration. On the other hand we don't want to
> have things lost if we dump and restore a database. Hence this series,
> which is a start at dumping and restore such config.
>
> The main idea here is that various classes of metadata can be defined
> by using prefixes, in exactly the same way as tags are defined for
> documents. This will hopefully help prevent e.g. config from stomping
> on tag aliases.
>
> The first 6 patches impliment iterators for simple "queries" on
> metadata. They are probably split a bit fine, but that's the way I
> developed them.
>
> The last 3 impliment the printing of metadata in dump output. In order
> to be upwardly compatible, it uses the old dodge of hiding things in
> comments. In fact the comment syntax (# in first column) was never
> well documented; this does mean that the notmuch dump output can be
> tested without breaking the current restore tests. I threw an @ in to
> help autodetection of formats; obviously this is not foolproof. On the
> other hand, I don't know how much people currently rely on comments in
> dump files, since notmuch doesn't generate them.
>
> There's lots of bikes to shed here. Probably the most important bits
> are the library API, the dump output format, and of course the ever
> tricky command line argument names.

Generally this series looks pretty good. IMO this could have gone with
way less separate patches -- It would have made the review easier,
now I had to go back to previous mails just to look context. But,
anyone who disagrees w/ this make David know (in any appropriate 
channel so my opinion does not get too emphasized ;D)

The first thing that came into my mind was this naming of
*_FIRST_CLASS and *_LAST_CLASS in enum values. the naming
is inconsistent in sense that first is first, but last is last + 1.
Unfortunately there is nothing we can do with that as these *_LAST_*
are used in other enums too so we just have to live with it. 

In last in this series there is
+typedef enum dump_includes {
+DUMP_INCLUDE_TAGS=1,
+DUMP_INCLUDE_METADATA=2,
+} dump_include_t;

-- spacing around ' = ' missing -- I did not see other whitespace errors
(not that there might not be those, though, as we know David ;)

One bug I found:

+for (mclass = NOTMUCH_METADATA_FIRST_CLASS; mclass < 
NOTMUCH_METADATA_LAST_CLASS; mclass++) {
+   status = notmuch_database_get_all_metadata (notmuch, 
NOTMUCH_METADATA_CONFIG, &meta);

(mclass should be there). Currently as there is only that one in the enum
there is no problem -- also for the same reason current test can not 
notice this. If this were not fixed, this would be noticed in the future
by that particular test - unless it is changed erronelously ;)


Anyway, good stuff in general...


Tomi

> Getting the memory ownership semantics is tricky, especially with the
> mix of C++ objects and talloc. So I'd appreciate a critical eye on
> those bits of metadata.cc.

uh puh -- maybe I look that again (hmm, have to apply the patch series as
all of the metadata.cc is not in one patch ;/
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 6/7] emacs: hello: add highlight newly arrived messages option

2016-01-07 Thread Tomi Ollila
On Sun, May 11 2014, Mark Walters  wrote:

> This adds a function that highlights searches which have newly arrived
> messages (ones which arrived since the previous refresh of
> notmuch-hello). It does that by getting a full list of matching
> message ids and checking whether any new messages have appeared. Thus
> it will be slow on large saved searches.

What we need is docid: support -- then this could be faaast !!111!!11??? ;D

-> ZZZ

Tomi


___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] nmbug-status: Style headers with smaller fonts

2016-01-07 Thread Tomi Ollila
On Thu, Jan 07 2016, "W. Trevor King"  wrote:

> We only use h1 through h3, and David prefers smaller headers [1], so
> shift over to the font sizes usually used for h2 through h4 [2,3,4].
> I haven't bothered with the W3C's default margins, since a bit of
> extra whitespace doesn't seem like a big deal.
>
> [1]: id:87k2nl8r0k.fsf@zancas.localnet
>  http://article.gmane.org/gmane.mail.notmuch.general/21595
> [2]: http://www.w3.org/TR/html-markup/h2.html
> [3]: http://www.w3.org/TR/html-markup/h3.html
> [4]: http://www.w3.org/TR/html-markup/h4.html
> ---
> On Thu, Jan 07, 2016 at 09:20:59AM -0400, David Bremner wrote:
>> W. Trevor King writes:
>> > We can always add additional CSS if the default h1 formatting is
>> > too intense.
>>
>> I'm pretty sure it will be, at least for me, since that's the reason
>> I did it this way in the first place. I'm (obviously) not a web
>> person, how about providing some CSS to roughly duplicate the
>> current visuals?
>
> Here you go :).

Looks good, matches the [2], [3], [4] (well enough, spacing differences
are so small) and applies.

Tomi

>
> Cheers,
> Trevor
>
>  devel/nmbug/nmbug-status | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
> index f33f660..0382919 100755
> --- a/devel/nmbug/nmbug-status
> +++ b/devel/nmbug/nmbug-status
> @@ -327,6 +327,15 @@ header_template = config['meta'].get('header', 
> '''
>
>{title}
>

Re: T070 tests portability

2016-01-07 Thread Tomi Ollila
On Wed, Jan 06 2016, J Farkas  
wrote:

> On 2016-01-05 at 17:41:06, David Bremner wrote:
>> Tomi Ollila  writes:
>> 
>> > The page https://sourceware.org/gdb/onlinedocs/gdb/Returning.html
>> > talks something about gdb not knowing the return type if function
>> > was compiled without debug info... well, is this is the reason,
>> > perhaps we should allow testing w/o debug info compiled in.
>> 
>> The test suite overall assumes debug info is present; T000-basic tests
>> for this.
>
> I'm not missing the debug infos (well, except for the thread library if I
> understand correctly - and that affects a lot of other tests, but not this).
> Perhaps it the version of gdb, but not any compilation flags that can be
> changed for the notmuch tree.
>
> Without the changes, I'm getting these two kind of errors (and as you can
> see, the test for the debugging symbols passes too).

ack... keep reading...

>
> $ ./T000-basic.sh
>
> T000-basic: Testing the test framework itself.
>  PASS   success is reported like this
> ...
>  PASS   PATH is set to build directory
>  PASS   notmuch is compiled with debugging symbols
> $ ./T070-insert.sh
>
> T070-insert: Testing "notmuch insert"
>  PASS   Insert zero-length file
> ...
>  FAIL   Insert duplicate message
> --- T070-insert.6.expected  2016-01-06 13:31:01.644676102 +
> +++ T070-insert.6.output2016-01-06 13:31:01.648675891 +
> @@ -1 +1 @@
> -2
> +  2

This is trivial to fix w/ the same

output=$((`notmuch search --output=files "subject:insert-subject" | wc -l`))

construct that is used in T060-count.sh

A separate patch doing just this would be appreciated.

>  PASS   Duplicate message does not change tags
>  PASS   Insert message, add tag
> ...
>  PASS   Tags starting with '-' in new.tags are forbidden
>  PASS   Invalid tags set exit code
>  FAIL   error exit when add_message returns OUT_OF_MEMORY
> --- T070-insert.26.expected 2016-01-06 13:31:06.940397013 +
> +++ T070-insert.26.output   2016-01-06 13:31:06.940397013 +
> @@ -1 +1 @@
> -1
> +255
> warning: Unable to find libthread_db matching inferior's thread library, 
> thread debugging will not be available.
> index-file-OUT_OF_MEMORY.gdb:7: Error in sourced command file:
> Return value type not available for selected stack frame.
> Please use an explicit cast of the value to return.
>  FAIL   success exit with --keep when add_message returns OUT_OF_MEMORY

Your setup is interesting -- you have GNU textutils 2.0.22, released
2002-07-20 (i.e. 13.5 years ago) and then gdb 7.4. I just run this
test file on Scientific Linux 6.2 (gcc 4.4.6 and gdb 7.2), and the
tests passed without problems.

Apart from a few special cases, no typecasts should be added lightly
to the code -- be it at innocent-looking as it can be. Those impedes
the possibility for compiler (etc.) to do type checking.

So, in this case, if you're the only one seeing this problem I'd suggest
you tolerate the problem (by using private patch) (you could also dig
deeper if interested). If this "problem" is (were!) more widespread,
*and* unfixable in reasonable manner this thing like this typecast
could be applied -- which would also mean this test system would
be a bit less robust as it is now...(*)


Tomi

(*) imo these are hard facts, but someone(tm) may consider these as mere
opinions...


> ...
>
> (The above is then repeated for all gdb using `insert` tests.)
>
> János
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v6] devel/emacs: add devel/try-emacs-mua

2016-01-06 Thread Tomi Ollila
devel/try-emacs-mua provides an easy way to try and experiment
with the notmuch emacs client distributed in emacs subdirectory of
the notmuch source tree.

try-emacs-mua starts a new emacs process and if initial checks pass
*scratch* buffer is filled with information of how to begin.

Normal emacs command line arguments can be used, like -q or -Q.
These arguments are appended verbatim to the starting emacs process.

If the emacs version in use is smaller than 24.4, special care is taken
to ensure that notmuch*.elc files older than corresponding .el files
are not loaded. Since emacs 24.4, setting `load-prefer-newer' variable
takes care of this.
---

less talk, more diff, since v5
( id:1451946112-23573-1-git-send-email-tomi.oll...@iki.fi )

(line numbers missing, as I did this by diffing patches...)

= thinko

/// -;; Try the notmuch emacs client located in ../notmuch/emacs directory
*** +;; Try the notmuch emacs client located in ../emacs/ directory

= the change

/// -(setq initial-buffer-choice t) ;; *scratch* buffer
*** +(setq initial-buffer-choice nil
*** +  inhibit-startup-screen t)

= combined setq (verified with (setq a 1 b a) ... => b = 1)

/// -  (setq try-notmuch-source-directory (directory-file-name pdir))
/// -  (setq try-notmuch-emacs-directory (concat pdir "emacs/"))
/// -  (setq load-path (cons try-notmuch-emacs-directory load-path)))
*** +  (setq try-notmuch-source-directory (directory-file-name pdir)
*** +try-notmuch-emacs-directory (concat pdir "emacs/")
*** +load-path (cons try-notmuch-emacs-directory load-path)))

= how did I miss this change in v5?

/// -  (insert "Notmuch cli executable "
*** +  (insert "Notmuch CLI executable "

= clearer (it is effectively the same)

/// -   (set-buffer "*scratch*")
/// -   (lisp-interaction-mode)
/// -   (goto-char (point-min))
/// -   (forward-line 2)
/// -   (set-buffer-modified-p nil)))
*** +   (with-current-buffer "*scratch*"
*** + (lisp-interaction-mode)
*** + (goto-char (point-min))
*** + (forward-line 2)
*** + (set-buffer-modified-p nil


 devel/try-emacs-mua | 157 
 1 file changed, 157 insertions(+)
 create mode 100755 devel/try-emacs-mua

diff --git a/devel/try-emacs-mua b/devel/try-emacs-mua
new file mode 100755
index ..b0a62c25b28f
--- /dev/null
+++ b/devel/try-emacs-mua
@@ -0,0 +1,157 @@
+#!/bin/sh
+:; set -x; exec "${EMACS:-emacs}" --debug-init --load "$0" "$@"; exit
+;;
+;; Try the notmuch emacs client located in ../emacs/ directory
+;;
+;; Run this without arguments; emacs window opens with some usage information
+;;
+;; Authors: Tomi Ollila 
+;;
+;; http://www.emacswiki.org/emacs/EmacsScripts was a useful starting point...
+;;
+;; Licence: GPLv3+
+;;
+
+(message "Starting '%s'" load-file-name)
+
+(set-buffer "*scratch*")
+
+(setq initial-buffer-choice nil
+  inhibit-startup-screen t)
+
+(when (featurep 'notmuch)
+  (insert "
+Notmuch has been loaded to this emacs (during processing of the init file)
+which means it is (most probably) loaded from different source than expected.
+
+Please run \"" (file-name-nondirectory load-file-name)
+"\" with '-q' (or '-Q') as an argument, to disable
+processing of the init file -- you can load it after emacs has started\n
+exit emacs (y or n)? ")
+  (if (y-or-n-p "exit emacs")
+  (kill-emacs)
+(error "Stopped reading %s" load-file-name)))
+
+(let ((pdir (file-name-directory
+(directory-file-name (file-name-directory load-file-name)
+  (unless (file-exists-p (concat pdir "emacs/notmuch-lib.el"))
+(insert "Cannot find notmuch-emacs source directory
+while looking at: " pdir "emacs\n\nexit emacs (y or n)? ")
+(if (y-or-n-p "exit emacs")
+   (kill-emacs)
+  (error "Stopped reading %s" load-file-name)))
+  (setq try-notmuch-source-directory (directory-file-name pdir)
+   try-notmuch-emacs-directory (concat pdir "emacs/")
+   load-path (cons try-notmuch-emacs-directory load-path)))
+
+;; they say advice doesn't work for primitives (functions from c source)
+;; well, these 'before' advice works for emacs 23.1 - 24.5 (at least)
+;; ...and for our purposes 24.3 is enough (there is no load-prefer-newer there)
+;; note also that the old, "obsolete" defadvice mechanism was used, but that
+;; is the only one available for emacs 23 and 24 up to 24.3.
+
+(if (boundp 'load-prefer-newer)
+(defadvice require (before before-require activate)
+  (unless (featurep feature)
+   (message "require: %s" feature)))
+  ;; else: special require "short-circuit"; after load feature is provided...
+  ;; ... in notmu

Re: T070 tests portability

2016-01-05 Thread Tomi Ollila
On Tue, Jan 05 2016, J Farkas  
wrote:

> I'm in the process of writing insert tests, but it looks like my
> environment is somewhat older than what the current tests are running
> on.  The following two trivial changes for the original tests make those
> pass cleanly:
>
> The wc I have from GNU textutils 2.0.22 seems to produce extra
> whitespace that needs to be cleaned:
>
> diff --git a/test/T070-insert.sh b/test/T070-insert.sh
> index e7ec6a6..5864b9b 100755
> --- a/test/T070-insert.sh
> +++ b/test/T070-insert.sh
> @@ -62,3 +62,3 @@ test_begin_subtest "Insert duplicate message"
>  notmuch insert +duptag -unread < "$gen_msg_filename"
> -output=$(notmuch search --output=files "subject:insert-subject" | wc -l)
> +output=$(notmuch search --output=files "subject:insert-subject" | echo $(wc 
> -l))

For this we have found solution earlier, unfortunately this did not get it:

 output=$((`notmuch search --output=files "subject:insert-subject" | wc -l`))

$ fgrep '$((`' test/*.sh
test/T060-count.sh:"$((`notmuch search --output=messages '*' | wc -l`))" \
test/T060-count.sh:"$((`notmuch search --output=messages '*' | wc-l`))" \
test/T060-count.sh:"$((`notmuch search --output=threads '*' | wc -l`))" \
test/T060-count.sh:"$((`notmuch search '*' | wc -l`))" \
test/T060-count.sh:"$((`notmuch search --output=files '*' | wc -l`))" \

i.e. arithmetic evaluation with just the number removes surrounding whitespace.

>  test_expect_equal "$output" 2
>
> And without the following cast, gdb 7.4 complains about the return type.
>
> index-file-XAPIAN_EXCEPTION.gdb:7: Error in sourced command file:
> Return value type not available for selected stack frame.
> Please use an explicit cast of the value to return.
>
> diff --git a/test/T070-insert.sh b/test/T070-insert.sh
> index e7ec6a6..5864b9b 100755
> --- a/test/T070-insert.sh
> +++ b/test/T070-insert.sh
> @@ -196,3 +196,3 @@ break notmuch_database_add_message
>  commands
> -return NOTMUCH_STATUS_$code
> +return (int)NOTMUCH_STATUS_$code
>  continue

The page https://sourceware.org/gdb/onlinedocs/gdb/Returning.html
talks something about gdb not knowing the return type if function
was compiled without debug info... well, is this is the reason,
perhaps we should allow testing w/o debug info compiled in.

> Does any of the above look reasonable to reduce the false positives?
> With the above, the T070 tests all pass on my system.

1st is to be changed to be consistent w/ other code, second may be good.


> Janos


Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v5] devel/emacs: add devel/try-emacs-mua

2016-01-05 Thread Tomi Ollila
On Tue, Jan 05 2016, Michal Sojka  wrote:

> Hi Tomi,
>
> this looks almost good. A few minor comments below.
>
> On Mon, Jan 04 2016, Tomi Ollila wrote:
>> devel/try-emacs-mua provides an easy way to try and experiment
>> with the notmuch emacs client distributed in emacs subdirectory of
>> the notmuch source tree.
>>
>> try-emacs-mua starts a new emacs process and if initial checks pass
>> *scratch* buffer is filled with information of how to begin.
>>
>> Normal emacs command line arguments can be used, like -q or -Q.
>> These arguments are appended verbatim to the starting emacs process.
>>
>> If the emacs version in use is smaller than 24.4, special care is taken
>> to ensure that notmuch*.elc files older than corresponding .el files
>> are not loaded. Since emacs 24.4, setting `load-prefer-newer' variable
>> takes care of this.
>> ---
>>
>> Thanks to Michal for review of v4
>> id:1450610032-23776-1-git-send-email-tomi.oll...@iki.fi
>> in id:87vb7aco77@steelpick.2x.cz
>>
>> This should address the issues:
>>
>> 1) no more command line filtering
>> 2) dropped (outcommented) file-truename advising
>> 3) added information which notmuch binary is used
>> 4) dropped popping messages buffer (fixing 2 issues)
>>
>> Added:
>> * code to load ~/.emacs.d/notmuch-config.el if exists and not loaded already
>> * pop messages buffer if (require 'notmuch) fails
>> * don't suggest package-initialize if emacs version is 23
>>
>>
>>  devel/try-emacs-mua | 156 
>> 
>>  1 file changed, 156 insertions(+)
>>  create mode 100755 devel/try-emacs-mua
>>
>> diff --git a/devel/try-emacs-mua b/devel/try-emacs-mua
>> new file mode 100755
>> index ..0236b438c30a
>> --- /dev/null
>> +++ b/devel/try-emacs-mua
>> @@ -0,0 +1,156 @@
>> +#!/bin/sh
>> +:; set -x; exec "${EMACS:-emacs}" --debug-init --load "$0" "$@"; exit
>> +;;
>> +;; Try the notmuch emacs client located in ../notmuch/emacs directory
>> +;;
>> +;; Run this without arguments; emacs window opens with some usage 
>> information
>> +;;
>> +;; Authors: Tomi Ollila 
>> +;;
>> +;; http://www.emacswiki.org/emacs/EmacsScripts was a useful starting 
>> point...
>> +;;
>> +;; Licence: GPLv3+
>> +;;
>> +
>> +(message "Starting '%s'" load-file-name)
>> +
>> +(set-buffer "*scratch*")
>> +
>> +(setq initial-buffer-choice t) ;; *scratch* buffer
>
> After initial tuning of emacs configuration according to the hints in
> the scratch buffer, people might want to automate things. For example
> something like:
>
> devel/try-emacs-mua -q -f notmuch-hello
>
> This does not work as one would expect, because the notmuch-hello buffer
> is buried under the *scratch* buffer. To get the hello screen after the
> start one has to run:
>
> devel/try-emacs-mua -q -f notmuch-hello --eval '(setq 
> initial-buffer-choice nil)'

Simpler is to change the above code line to:

(setq initial-buffer-choice nil
  inhibit-startup-screen t)

Now the visible buffer is *scratch* by default -- and works more closely
how emacs works normally.

> This could be also documented in the scratch buffer. Or it might be
> easier, in this case, to run emacs without this script at all. There
> will be no logging, but this might be OK for some people.
>
> Actually I don't know who are you writing this script for? For notmuch
> developers or for users who want to debug or test development version? 

First of all, for me & other notmuch developers. After a few months break
when I do some notmuch elisp coding and try to test it I hope I don't have
to remember so much setup things and if something initially goes wrong I
might get visible hints to the screen.

And also to users to test development version -- or any other version by
copying this file to notmuch/devel *OR* notmuch/emacs directory (works
from both locations). And when they run and get into problems, posting
the contents of *Messages* buffer may provide useful information.

>> +
>> +(when (featurep 'notmuch)
>> +  (insert "
>> +Notmuch has been loaded to this emacs (during processing of the init file)
>> +which means it is (most probably) loaded from different source than 
>> expected.
>> +
>> +Please run \"" (file-name-nondirectory load-file-name)
>> +"\" with '-q' (or '-Q') as an argument, to disable
>> +processing of the init file

Re: Two Questions

2016-01-04 Thread Tomi Ollila
On Tue, Jan 05 2016, MaDhAt2r  wrote:

> Hello All!
>
> I have been using notmuch/emacs for about two years now. I of course
> love the setup, but there have always been two main issues I have yet to
> find a solution for. I am hoping someone on here has found some answers.
>
> 1. How to change the time/date to use 12h format in all displays.

This probably requires some coding...

> 2. How to handle mailto:// hyperlinks and force the use of emacs/notmuch

You can try

https://github.com/domo141/nottoomuch/blob/master/nottoomuch-emacs-mailto.rst

(hmm, I wonder what happens if the link is mailto:// and not just mailto:)


Tomi

>
> I am running on ArchLinux (4.1.15-1-lts kenel), Emacs 24.5.1, notmuch 0.21
>
> Thanks for your help!
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v5] devel/emacs: add devel/try-emacs-mua

2016-01-04 Thread Tomi Ollila
devel/try-emacs-mua provides an easy way to try and experiment
with the notmuch emacs client distributed in emacs subdirectory of
the notmuch source tree.

try-emacs-mua starts a new emacs process and if initial checks pass
*scratch* buffer is filled with information of how to begin.

Normal emacs command line arguments can be used, like -q or -Q.
These arguments are appended verbatim to the starting emacs process.

If the emacs version in use is smaller than 24.4, special care is taken
to ensure that notmuch*.elc files older than corresponding .el files
are not loaded. Since emacs 24.4, setting `load-prefer-newer' variable
takes care of this.
---

Thanks to Michal for review of v4
id:1450610032-23776-1-git-send-email-tomi.oll...@iki.fi
in id:87vb7aco77@steelpick.2x.cz

This should address the issues:

1) no more command line filtering
2) dropped (outcommented) file-truename advising
3) added information which notmuch binary is used
4) dropped popping messages buffer (fixing 2 issues)

Added:
* code to load ~/.emacs.d/notmuch-config.el if exists and not loaded already
* pop messages buffer if (require 'notmuch) fails
* don't suggest package-initialize if emacs version is 23


 devel/try-emacs-mua | 156 
 1 file changed, 156 insertions(+)
 create mode 100755 devel/try-emacs-mua

diff --git a/devel/try-emacs-mua b/devel/try-emacs-mua
new file mode 100755
index ..0236b438c30a
--- /dev/null
+++ b/devel/try-emacs-mua
@@ -0,0 +1,156 @@
+#!/bin/sh
+:; set -x; exec "${EMACS:-emacs}" --debug-init --load "$0" "$@"; exit
+;;
+;; Try the notmuch emacs client located in ../notmuch/emacs directory
+;;
+;; Run this without arguments; emacs window opens with some usage information
+;;
+;; Authors: Tomi Ollila 
+;;
+;; http://www.emacswiki.org/emacs/EmacsScripts was a useful starting point...
+;;
+;; Licence: GPLv3+
+;;
+
+(message "Starting '%s'" load-file-name)
+
+(set-buffer "*scratch*")
+
+(setq initial-buffer-choice t) ;; *scratch* buffer
+
+(when (featurep 'notmuch)
+  (insert "
+Notmuch has been loaded to this emacs (during processing of the init file)
+which means it is (most probably) loaded from different source than expected.
+
+Please run \"" (file-name-nondirectory load-file-name)
+"\" with '-q' (or '-Q') as an argument, to disable
+processing of the init file -- you can load it after emacs has started\n
+exit emacs (y or n)? ")
+  (if (y-or-n-p "exit emacs")
+  (kill-emacs)
+(error "Stopped reading %s" load-file-name)))
+
+(let ((pdir (file-name-directory
+(directory-file-name (file-name-directory load-file-name)
+  (unless (file-exists-p (concat pdir "emacs/notmuch-lib.el"))
+(insert "Cannot find notmuch-emacs source directory
+while looking at: " pdir "emacs\n\nexit emacs (y or n)? ")
+(if (y-or-n-p "exit emacs")
+   (kill-emacs)
+  (error "Stopped reading %s" load-file-name)))
+  (setq try-notmuch-source-directory (directory-file-name pdir))
+  (setq try-notmuch-emacs-directory (concat pdir "emacs/"))
+  (setq load-path (cons try-notmuch-emacs-directory load-path)))
+
+;; they say advice doesn't work for primitives (functions from c source)
+;; well, these 'before' advice works for emacs 23.1 - 24.5 (at least)
+;; ...and for our purposes 24.3 is enough (there is no load-prefer-newer there)
+;; note also that the old, "obsolete" defadvice mechanism was used, but that
+;; is the only one available for emacs 23 and 24 up to 24.3.
+
+(if (boundp 'load-prefer-newer)
+(defadvice require (before before-require activate)
+  (unless (featurep feature)
+   (message "require: %s" feature)))
+  ;; else: special require "short-circuit"; after load feature is provided...
+  ;; ... in notmuch sources we always use require and there are no loops
+  (defadvice require (before before-require activate)
+(unless (featurep feature)
+  (message "require: %s" feature)
+  (let ((name (symbol-name feature)))
+   (if (and (string-match "^notmuch" name)
+(file-newer-than-file-p
+ (concat try-notmuch-emacs-directory name ".el")
+ (concat try-notmuch-emacs-directory name ".elc")))
+   (load (concat try-notmuch-emacs-directory name ".el") nil nil t t)
+ )
+
+(insert "Found notmuch emacs client in " try-notmuch-emacs-directory "\n")
+
+(let ((notmuch-path (executable-find "notmuch")))
+  (insert "Notmuch cli executable "
+ (if notmuch-path (concat "is " notmuch-path) "not found!") "\n"))
+
+(condition-case err
+;; "opportunistic" load-prefer-ne

Re: notmuch-message-mode initialization follow-up

2016-01-02 Thread Tomi Ollila
On Sat, Jan 02 2016, Michal Sojka  wrote:

> Hi,
>
> the first patch fixes the problem reported in
> id:87wprt2r4f.fsf@zancas.localnet. Patch 2/3 is just refactoring.
> Patch 3/3 is reaction to id:87y4cc3qse.fsf@zancas.localnet; I'm not
> sure whether it addresses exactly what David had in mind, but IMHO it
> is an improvement.

Applied the patches and tested with (*)

EMACS=/usr/bin/emacs ./devel/try-emacs-mua -q

on Scientific linux 6.2 where /usr/bin/emacs is version 23.1

and it worked fine. 1/3 and 2/3 are ok, I don't know why 3/3 is there
but it looks ok to me.

>
> Cheers.
> -Michal

Tomi

(*) devel/try-emacs-mua is posted in 
id:1450610032-23776-1-git-send-email-tomi.oll...@iki.fi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] cli/insert: do not lose the SMTP envelope

2016-01-02 Thread Tomi Ollila
On Fri, Jan 01 2016, J Farkas  
wrote:

> From: Janos Farkas 
> Subject: [PATCH] cli/insert: do not lose the SMTP envelope
>
> Make sure we store the envelope sender/recipient if provided by
> qmail-command(8) in $RPLINE and $DTLINE.
> ---

Probably good feature, but like
http://www.qmail.org/man/man8/qmail-command.html 
says:

  qmail-local supplies several useful environment variables to
  command.  WARNING: These environment variables are not
  quoted.  They may contain special characters.  They are
  under the control of a possibly malicious remote user.

Should we check that the contents of RPLINE and DTLINE are well-formed
before writing these to the mail files ?

Tomi


> I just realised that the messages delivered directly into maildir don't have
> the usual envelope addresses that qmail provides.  This is a piece of
> information that's important to (at least my) troubleshooting, so I created a
> patch that seems to work well, applies cleanly to master (and 0.21), and
> provided a NEWS entry should it be necessary.
>
>  NEWS |  9 +
>  notmuch-insert.c | 28 
>  2 files changed, 37 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index 6681699..13d45c8 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -1,3 +1,12 @@
> +
> +
> +`notmuch insert` records the envelope addresses if available
> +
> +  If the caller provides this information as qmail-command(8) does in
> +  the RPLINE and DTLINE environment variables, then notmuch insert will
> +  record it in the maildir file.
> +
> +
>  Notmuch 0.21 (2015-10-29)
>  =
>  
> diff --git a/notmuch-insert.c b/notmuch-insert.c
> index 5205c17..ecc0fa0 100644
> --- a/notmuch-insert.c
> +++ b/notmuch-insert.c
> @@ -284,6 +284,26 @@ copy_fd (int fdout, int fdin)
>  }
>  
>  /*
> + * Write zero (and LF) terminated string to the output fd.  It's expected to
> + * come from getenv(), so it's not checked for correctness.  NULL or empty
> + * string is ignored, successfully.
> + * Return TRUE on success, FALSE on errors.
> + */
> +static notmuch_bool_t
> +write_header (int fdout, const char *hdr)
> +{
> +ssize_t written,to_write;
> +
> +if (hdr && (to_write = strlen (hdr))) {
> +written = write (fdout, hdr, to_write);
> + if (written != to_write)
> + return FALSE;
> +}
> +
> +return TRUE;
> +}
> +
> +/*
>   * Write fdin to a new temp file in maildir/tmp, return full path to
>   * the file, or NULL on errors.
>   */
> @@ -297,6 +317,14 @@ maildir_write_tmp (const void *ctx, int fdin, const char 
> *maildir)
>  if (fdout < 0)
>   return NULL;
>  
> +/* maildir(5) suggests the message should start with a Return-Path
> + * and Delivered-To lines.  qmail-local(8) supplies these.
> + */
> +if (! write_header(fdout, getenv("RPLINE")))
> + goto FAIL;
> +if (! write_header(fdout, getenv("DTLINE")))
> + goto FAIL;
> +
>  if (! copy_fd (fdout, fdin))
>   goto FAIL;
>  
> -- 
> 2.6.3
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 0/2] nmbug-status: h1 title and unbalanced fixups to default templates

2016-01-01 Thread Tomi Ollila
On Fri, Jan 01 2016, "W. Trevor King"  wrote:

> On Fri, Jan 01, 2016 at 01:30:57PM +0200, Tomi Ollila wrote:
>> yes, I have old tidy (20091203), and the complaints were about
>> utf8-characters (being invalid) in output and 
>
> UTF-8 should be valid, because we declare the charset in:
>
>   
>
> If you feel like the UTF-8 complaints are valid, can you post more
> details about them?

IMO UTF-8 complaints are INvalid ! i.e. everything ok there.

Tomi

>> … summary attribute missing in tables…
>
> This attribute seems like it's obsolete [1].

I believe that :D

i.e. everything looks ok to me.

Tomi

>
> Cheers,
> Trevor
>
> [1]: http://www.w3.org/TR/html5/obsolete.html#attr-table-summary
>
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 0/2] nmbug-status: h1 title and unbalanced fixups to default templates

2016-01-01 Thread Tomi Ollila
On Thu, Dec 31 2015, "W. Trevor King"  wrote:

> On Thu, Dec 31, 2015 at 03:46:50PM +0200, Tomi Ollila wrote:
>> This series LGTM. (html) tidy complains about imo irrelevant things
>> -- or I just did not know how to use it correctly -- as `| tidy
>> -eq`.
>
> That doesn't complain about anything with the current tidy 5.1.25 [1]
> with output built by this branch (although I ran it on output for a
> non-notmuch tag-set).

yes, I have old tidy (20091203), and the complaints were about
utf8-characters (being invalid) in output and summary attribute missing in
tables; i.e. nothing about the well-formity of the syntax...

Tomi

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page

2016-01-01 Thread Tomi Ollila
On Thu, Dec 31 2015, David Bremner  wrote:

> Jani Nikula  writes:
>
>> On Wed, 30 Dec 2015, "W. Trevor King"  wrote:
>>> To describe the config file format, so folks don't have to dig through
>>> NEWS or the nmbug-status source to get that information.
>>
>> Overall I approve of the series (though I did not do a thorough
>> review).
>>
>> I am wondering about the man page though. I find it slightly confusing
>> there would be a man page named after the tool describing just the
>> config, but not the tool itself.
>
> For me it's a bit odd to have a man page for a tool we don't install by
> default. Is it maybe time to "promote" nmbug-status to the notmuch-
> namespace and install it by default? That would have to be somehow tied
> to installing the python bindings; or else the script could just print a
> helpful error message if the bindings are not found.
>
> This would also allow addressing Tomi's comment about testing, by adding
> a couple of tests to the test suite.

What we could simply have at the time being:

  devel/nmbug/nmbug
  devel/nmbug/nmbug.rst (or .1)
  devel/nmbug/nmbug-status
  devel/nmbug/nmbug-status.rst (or .1)
  devel/nmbug/nmbug-status-config
  devel/nmbug/nmbug-status-config.rst (or .5)

(and if .rst:s, a Makefile to build the namual pages)

The responsibility to install the tools could be
outside of notmuch for now...

Tomi

>
> d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 0/2] nmbug-status: h1 title and unbalanced fixups to default templates

2015-12-31 Thread Tomi Ollila
On Wed, Dec 30 2015, "W. Trevor King"  wrote:

> Polishing the templates a bit.  Details in the individual patches.

This series LGTM. (html) tidy complains about imo irrelevant things -- or
I just did not know how to use it correctly -- as `| tidy -eq`.

>
> Cheers,
> Trevor

Tomi


PS: it was a bit difficult to test, had to resort to reading sources
and experment with some git commands. So (i.e. Note to self):

$ git --git-dir ./.nmbug cat-file -p remotes/origin/config:status-config.json > 
~/tmp/nmbug...
$ PYTHONPATH=$PWD/bindings/python python2.7 devel/nmbug/nmbug-status --config 
~/tmp/nmbug...

(and | tidy -eq )


>
> W. Trevor King (2):
>   nmbug-status: Adjust headers to start with h1
>   nmbug-status: Fix unbalanced  tags in default header/footer
>
>  devel/nmbug/nmbug-status | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> -- 
> 2.1.0.60.g85f0837
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: Always use paths without symlinks

2015-12-29 Thread Tomi Ollila
On Tue, Dec 29 2015, Michal Sojka  wrote:

> When notmuch sources are at a symlinked path, some tests fail because
> one part of the test uses physical path and another uses logical
> path (with symlinks). For example the following test output is
> produced when the test is started from /home/src/symlink-to-notmuch,
> which is a symlink to /home/src/notmuch.
>
> FAIL   notmuch-fcc-dirs set to a string
> --- T310-emacs.26.OUTPUT2015-12-29 08:54:29.055878637 +
> +++ T310-emacs.26.EXPECTED  2015-12-29 08:54:29.055878637 +
> @@ -1,5 +1,5 @@
>  From: Notmuch Test Suite 
>  To:
>  Subject:
> -Fcc: /home/src/notmuch/test/tmp.T310-emacs/mail/sent-string
> +Fcc: 
> /home/src/symlink-to-notmuch/test/tmp.T310-emacs/mail/sent-string
>  --text follows this line--
> nil
>
> This commit makes all paths in test scripts physical. With it, all
> tests pass even when run from a symlinked directory.

Looks good, is portable (bash builtin) and seems also fix cases I thought
might have been a problem instead.

Tomi


> ---
>  test/test-lib-common.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
> index 5eb618c..4e17b78 100644
> --- a/test/test-lib-common.sh
> +++ b/test/test-lib-common.sh
> @@ -48,7 +48,7 @@ restore_database () {
>  
>  # Test the binaries we have just built.  The tests are kept in
>  # test/ subdirectory and are run in 'trash directory' subdirectory.
> -TEST_DIRECTORY=$(pwd)
> +TEST_DIRECTORY=$(pwd -P)
>  notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
>  
>  # configure output
> -- 
> 2.6.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] test: Unset ALTERNATE_EDITOR before running emacsclient

2015-12-29 Thread Tomi Ollila
On Tue, Dec 29 2015, Michal Sojka  wrote:

> ALTERNATE_EDITOR causes emacsclient to run an alternate editor if the
> emacs server is not ready. This can collide with intended
> functionality in test-lib.sh.
>
> If the ALTERNATE_EDITOR is set but empty, emacsclient runs emacs
> daemon and tries to connect to it. When this happens the emacs run by
> test-lib.sh fails to start the server and the subsequent attempts to
> use the server fail because the daemon started by emacsclient does not
> know about notmuch-test-progn. This leads to test suite failure due to
> time out on any emacs test.
> ---

LGTM.
Tomi


>  test/test-lib.sh | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 126911f..270c718 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -82,6 +82,9 @@ unset CDPATH
>  
>  unset GREP_OPTIONS
>  
> +# For emacsclient
> +unset ALTERNATE_EDITOR
> +
>  # Convenience
>  #
>  # A regexp to match 5 and 40 hexdigits
> -- 
> 2.6.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: Unset ALTERNATE_EDITOR before running emacsclient

2015-12-28 Thread Tomi Ollila
On Mon, Dec 28 2015, Michal Sojka  wrote:

> ALTERNATE_EDITOR causes emacsclient to run an alternate editor if the
> emacs server is not ready. This can collide with intended
> functionality in test-lib.sh.
>
> If the ALTERNATE_EDITOR is set but empty, emacsclient runs emacs
> daemon and tries to connect to it. When this happens the emacs run by
> test-lib.sh fails to start the server and the subsequent attempts to
> use the server fail because the daemon started by emacsclient does not
> know about notmuch-test-progn. This leads to test suite failure due to
> time out on any emacs test.
> ---

Looks good to me -- just that should the unsetting be done in the same
place as (most) other environment variables are handled... in the
region starting from line 64 of that same file.

Tomi


>  test/test-lib.sh | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 126911f..0f6a6cf 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -1152,6 +1152,7 @@ test_emacs () {
>   rm -f OUTPUT
>   touch OUTPUT
>  
> + unset ALTERNATE_EDITOR
>   ${TEST_EMACSCLIENT} --socket-name="$EMACS_SERVER" --eval 
> "(notmuch-test-progn $@)"
>  }
>  
> -- 
> 2.6.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v4] devel/emacs: add devel/try-emacs-mua

2015-12-20 Thread Tomi Ollila
devel/try-emacs-mua provides an easy way to try and experiment
with the notmuch emacs client distributed in emacs subdirectory of
the notmuch source tree.

try-emacs-mua starts a new emacs process and if initial checks pass
*scratch* buffer is filled with information of how to begin.

User can add normal emacs flags, like -q, -Q and e.g. -f notmuch. Any
given plain filename arguments are filtered out (with message).

If the emacs version in use is smaller than 24.4, special care is taken
to ensure that notmuch*.elc files older than corresponding .el files
are not loaded. Since emacs 24.4, setting `load-prefer-newer' variable
takes care of this.
---

Now all-elisp, vs v3: id:1447457397-11688-1-git-send-email-tomi.oll...@iki.fi

In id:87si4bwrsu@qmul.ac.uk Mark had some thoughts if something from this
could perhaps be used as some idea how to improve test testing. We'll have
to think more of that later. Rest of the review is pretty much irrelevant
for this (But I fixed that particular bug before turning to this ;).

 devel/try-emacs-mua | 153 
 1 file changed, 153 insertions(+)
 create mode 100755 devel/try-emacs-mua

diff --git a/devel/try-emacs-mua b/devel/try-emacs-mua
new file mode 100755
index ..1f916d2806f9
--- /dev/null
+++ b/devel/try-emacs-mua
@@ -0,0 +1,153 @@
+#!/bin/sh
+:; set -x; exec "${EMACS:-emacs}" --debug-init --load "$0" "$@"; exit
+;;
+;; Try the notmuch emacs client located in ../notmuch/emacs directory
+;;
+;; Run this without arguments; emacs window opens with some usage information
+;;
+;; Authors: Tomi Ollila 
+;;
+;; http://www.emacswiki.org/emacs/EmacsScripts was a useful starting point...
+;;
+;; Licence: GPLv3+
+;;
+
+(message "Starting '%s'" load-file-name)
+
+(set-buffer "*scratch*")
+
+(setq initial-buffer-choice t) ;; *scratch* buffer
+
+(when (featurep 'notmuch)
+  (insert "
+Notmuch has been loaded to this emacs (during processing of the init file)
+which means it is (most probably) loaded from different source than expected.
+
+Please run \"" (file-name-nondirectory load-file-name)
+"\" with '-q' (or '-Q') as an argument, to disable
+processing of the init file -- you can load it after emacs has started\n
+exit emacs (y or n)? ")
+  (if (y-or-n-p "exit emacs")
+  (kill-emacs)
+(error "Stopped reading %s" load-file-name)))
+
+(let ((pdir (file-name-directory
+(directory-file-name (file-name-directory load-file-name)
+  (unless (file-exists-p (concat pdir "emacs/notmuch-lib.el"))
+(insert "Cannot find notmuch-emacs source directory
+while looking at: " pdir "emacs\n\nexit emacs (y or n)? ")
+(if (y-or-n-p "exit emacs")
+   (kill-emacs)
+  (error "Stopped reading %s" load-file-name)))
+  (setq try-notmuch-source-directory (directory-file-name pdir))
+  (setq try-notmuch-emacs-directory (concat pdir "emacs/"))
+  (setq load-path (cons try-notmuch-emacs-directory load-path)))
+
+;; for logging, debugging and load tracing (broke on emacs 24.5.1 :O)
+;;(defadvice file-truename (before before-file-truename activate)
+  (message "file-truename: '%s' '%s' '%s'" filename counter prev-dirs))
+;;  (unless counter
+;;(message "file-truename: %s" filename)))
+
+;; they say advice doesn't work for primitives (functions from c source)
+;; well, these 'before' advice works for emacs 23.1 - 24.5 (at least)
+;; ...and for our purposes 24.3 is enough (there is no load-prefer-newer there)
+;; note also that the old, "obsolete" defadvice mechanism was used, but that
+;; is the only one available for emacs 23 and 24 up to 24.3.
+
+(if (boundp 'load-prefer-newer)
+(defadvice require (before before-require activate)
+  (unless (featurep feature)
+   (message "require: %s" feature)))
+  ;; else: special require "short-circuit"; after load feature is provided...
+  ;; ... in notmuch sources we always use require and there are no loops
+  (defadvice require (before before-require activate)
+(unless (featurep feature)
+  (message "require: %s" feature)
+  (let ((name (symbol-name feature)))
+   (if (and (string-match "^notmuch" name)
+(file-newer-than-file-p
+ (concat try-notmuch-emacs-directory name ".el")
+ (concat try-notmuch-emacs-directory name ".elc")))
+   (load (concat try-notmuch-emacs-directory name ".el") nil nil t t)
+ )
+
+(insert "Found notmuch emacs client in " try-notmuch-emacs-directory "\n")
+
+(condition-case err
+;; "opportunistic" load-prefer-newer -- will be effective since emacs 24.4
+(

Re: Compilation failure with gcc 4.4.7

2015-12-19 Thread Tomi Ollila
On Sat, Dec 19 2015, Justus Winter <4win...@informatik.uni-hamburg.de> wrote:

> Hello,
>
> I just tried to compile notmuch with an oldish compiler, and that
> failed (if the compiler is indeed too old, then at least the error
> message should be more helpful):

see thread id:1439303834-27030-1-git-send-email-tomi.oll...@iki.fi

>
> % ./configure --prefix=$HOME/stow/notmuch
> [...]
> Sanity checking C compilation environment... OK.
> Sanity checking C++ compilation environment... OK.
> Reading libnotmuch version from source...
> *** Error: Reading lib/notmuch.h failed.
> Please try running configure again in a clean environment, and if the
> problem persists, report a bug.
> % cc -g -O2 _libversion.c -o _lib
> In file included from _libversion.c:2:
> lib/notmuch.h:858: error: wrong number of arguments specified for 
> ‘deprecated’ attribute
> lib/notmuch.h:915: error: wrong number of arguments specified for 
> ‘deprecated’ attribute
> lib/notmuch.h:1011: error: wrong number of arguments specified for 
> ‘deprecated’ attribute
> lib/notmuch.h:1048: error: wrong number of arguments specified for 
> ‘deprecated’ attribute
> % gcc --version
> gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)
> Copyright (C) 2010 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> Cheers,
> Justus
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [Patch v3 4/8] test: initial tests for S/MIME and notmuch-emacs

2015-12-14 Thread Tomi Ollila
On Mon, Dec 14 2015, David Bremner  wrote:

> David Bremner  writes:
>
>> Test the ability of notmuch-mua-mail to send S/MIME signed (and
>> encrypted) messages; this really relies on existing functionality in
>> message-mode.
>>
>> The generated keys and messages will later be useful for testing the
>> notmuch CLI.
>> ---
>>  test/T355-smime.sh  | 42 +
>>  test/smime/README   |  7 +++
>>  test/smime/key+cert.pem | 56 
>> +
>>  test/smime/test.crt | 19 +
>>  test/test-lib.el| 10 +
>>  test/test-lib.sh|  1 +
>>  6 files changed, 135 insertions(+)
>>  create mode 100755 test/T355-smime.sh
>>  create mode 100644 test/smime/README
>>  create mode 100644 test/smime/key+cert.pem
>>  create mode 100644 test/smime/test.crt
>>
>> diff --git a/test/T355-smime.sh b/test/T355-smime.sh
>> new file mode 100755
>> index 000..e3419d6
>> --- /dev/null
>> +++ b/test/T355-smime.sh
>> @@ -0,0 +1,42 @@
>> +#!/usr/bin/env bash
>> +
>> +test_description='S/MIME signature verification and decryption'
>> +. ./test-lib.sh
>
> Apparently this needs
>
> unset GPG_AGENT_INFO
>
> at the beginning to avoid getting confused by a potential pre-2.1
> gpg-agent.

And, as the first patch series was very old it did not have this:

. ./test-lib.sh || exit 1


Tomi

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 7/9] add a gpg_path value for notmuch_database_t

2015-12-13 Thread Tomi Ollila
On Sun, Dec 13 2015, Tomi Ollila  wrote:

> On Sun, Dec 13 2015, David Bremner  wrote:
>
>>
>> Without weighing in on the advisibility of searching for gpg in $PATH,
>> there is a glib function g_find_program_in_path. We're already linking
>> to glib (because of gmime mainly, but it's used other places as well).
>
> glib2-2.38 (glib/gutils.c) seems to look in PATH, and if 
> g_getenv ("PATH") == NULL uses hardcoded path "/bin:/usr/bin:.";
> (it us "security" feature to have '.' last...)
>
> If rest is TL;DR; I'd suggest we use this... since libgpgme has implemented
> it IMO too late for use in 2016 (or do additional compat function?)

Actually now that I sent this mail it kept rolling on my mind... If anyone
else than me (and libgpgme?) thinks that '.' should not be in search path
we could do

if (getenv("PATH") == NULL) {
   path_set = true;
   setenv("PATH", "/bin:/usr/bin", 1); // XXX *BSD configurability //
}
else path_set = false;

... g_find_program_in_path("gpg2")
... g_find_program_in_path("gpg")

if (path_set) {
  unsetenv("PATH");

---

I also thought of examining the return value starting with ./ but
(current or) future version of g_find_program_in_path() might
canonicalize the returned path...


Tomi


>
>> The other point that occurs to me is that libgpgme solves this same
>> problem in src/posix-util.c. It also seems to search path, at least
>> optionally, although only if it cannot find gpgconf.
>
> On Fedora 20 I looked gpgme-1.3.2 sources -- in there I could not find
> this search using PATH... gpg-1.3.2 is released 2012-05-02...
>
> Jessie (lib)gpgme 1.5.1 (2014-07-30) seems to have the code David mentioned...
> (btw. I was suprisingly hard to search Debian packages; IIRC it was easier)
>
> Ubuntu 14.04 LTS has (lib)gpgme 1.4.3 (ubuntu5). I did not download that
> source... but 1.5.1 NEWS indicates that this PATH search has arrived to
> 1.5.0 (2014-05-21)
>
> This search is different from glib2-version that if getenv("PATH") == NULL
> search only "/bin:/usr/bin"
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 7/9] add a gpg_path value for notmuch_database_t

2015-12-13 Thread Tomi Ollila
On Sun, Dec 13 2015, David Bremner  wrote:

> Daniel Kahn Gillmor  writes:
>
>> On Fri 2015-12-11 17:02:33 -0500, Tomi Ollila wrote:
>>> The above code finds gpg/gpg2 (when called w/ these args) from
>>> _CS_PATH (seems to be /bin:/usr/bin by default in linux (tried to
>>> look how this set in *BSD -- initially it looks like /usr/local/bin
>>> not included but... maybe we let them to complain if this is the case
>>> ... :/)
>>> ... anyway, the full found path is not set anywhere -- how is it found
>>> when used (exec*p() using $PATH? :O)
>>
>> Hm, according to exec(3):
>>
>>Special semantics for execlp() and execvp()
>>The execlp(), execvp(), and execvpe() functions duplicate the
>>actions of the shell in searching for an executable file if the
>>specified filename does not contain a slash (/) character.  The
>>file is sought in the colon-separated list of directory pathnames
>>specified in the PATH environment variable.  If this variable
>>isn't defined, the path list defaults to the current directory
>>followed by the list of directories returned by
>>confstr(_CS_PATH).  (This confstr(3) call typically returns the
>>value "/bin:/usr/bin".)
>>
>> So this code probably also ought to be searching $PATH as well.  yuck.
>> You'd think there would be a commonly-available function for doing this
>> specific check without having to actually try to exec() something.
>
> Without weighing in on the advisibility of searching for gpg in $PATH,
> there is a glib function g_find_program_in_path. We're already linking
> to glib (because of gmime mainly, but it's used other places as well).

glib2-2.38 (glib/gutils.c) seems to look in PATH, and if 
g_getenv ("PATH") == NULL uses hardcoded path "/bin:/usr/bin:.";
(it us "security" feature to have '.' last...)

If rest is TL;DR; I'd suggest we use this... since libgpgme has implemented
it IMO too late for use in 2016 (or do additional compat function?)

> The other point that occurs to me is that libgpgme solves this same
> problem in src/posix-util.c. It also seems to search path, at least
> optionally, although only if it cannot find gpgconf.

On Fedora 20 I looked gpgme-1.3.2 sources -- in there I could not find
this search using PATH... gpg-1.3.2 is released 2012-05-02...

Jessie (lib)gpgme 1.5.1 (2014-07-30) seems to have the code David mentioned...
(btw. I was suprisingly hard to search Debian packages; IIRC it was easier)

Ubuntu 14.04 LTS has (lib)gpgme 1.4.3 (ubuntu5). I did not download that
source... but 1.5.1 NEWS indicates that this PATH search has arrived to
1.5.0 (2014-05-21)

This search is different from glib2-version that if getenv("PATH") == NULL
search only "/bin:/usr/bin"

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 7/9] add a gpg_path value for notmuch_database_t

2015-12-12 Thread Tomi Ollila
On Sat, Dec 12 2015, Daniel Kahn Gillmor  wrote:

> On Fri 2015-12-11 17:02:33 -0500, Tomi Ollila wrote:
>> The above code finds gpg/gpg2 (when called w/ these args) from
>> _CS_PATH (seems to be /bin:/usr/bin by default in linux (tried to
>> look how this set in *BSD -- initially it looks like /usr/local/bin
>> not included but... maybe we let them to complain if this is the case
>> ... :/)
>> ... anyway, the full found path is not set anywhere -- how is it found
>> when used (exec*p() using $PATH? :O)
>
> Hm, according to exec(3):
>
>Special semantics for execlp() and execvp()
>The execlp(), execvp(), and execvpe() functions duplicate the
>actions of the shell in searching for an executable file if the
>specified filename does not contain a slash (/) character.  The
>file is sought in the colon-separated list of directory pathnames
>specified in the PATH environment variable.  If this variable
>isn't defined, the path list defaults to the current directory
>followed by the list of directories returned by
>confstr(_CS_PATH).  (This confstr(3) call typically returns the
>value "/bin:/usr/bin".)
>
> So this code probably also ought to be searching $PATH as well.  yuck.
> You'd think there would be a commonly-available function for doing this
> specific check without having to actually try to exec() something.

Indeed.

Shells seems to be smart and do pre-check through PATH (but not 
_CS_PATH...(**)) and then exec just with the found path. I straced
one execlp() usage and it naïvely attempted to execve() through the
name appended to path (if getting ENOENT); when execve() succeeds
it does not return...

I originally had a fast thought that it was a security feature not
use PATH (which user can screw up ;/), but some safer path set.
Perhaps that is not necessary...

Perhaps the search should go through PATH if it is defined and
if not defined then use confstr(_CS_PATH). If PATH is empty
then not use confstr (but use current dir !!11!!?++?+?? (*))

One thing I forgot from the review:

the #define try_gpg_path(z) is done inside {}:s, so
before closing } there could be
#undef try_gpg_path (to make the "liveness" of it match the scope)


(*) what is the yuckiness of this:

  $ PATH= ls
  zsh: command not found: ls

  $ bash -c 'PATH= ls'
  bash: ls: No such file or directory

  $ echo '#!/bin/echo this is ./ls ?' >! ./ls
  $ chmod 755 ./ls

  $ PATH= ls
  this is ./ls ? ls -F

  $ PATH= command ls
  this is ./ls ? ls

  $ bash -c 'PATH= ls'
  this is ./ls ? ls

  $ rm ./ls

(**) unset PATH had the same effect in bash and dash but zsh did not 
 check ./ls after 'unset PATH'

-- I personally think we could just ignore empty components in PATH
(being it like PATH=, PATH=:/path/to, PATH=/path/to: and finally
PATH=/path/to::/path/to) (or then not, just be as compliant (and stupid)
as the PATH handling is).

Tomi

>
>  --dkg
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: allow indexing cleartext of encrypted messages

2015-12-11 Thread Tomi Ollila
On Fri, Dec 11 2015, Daniel Kahn Gillmor  wrote:

> On Wed 2015-12-09 22:39:37 -0500, Daniel Kahn Gillmor wrote:
>>  * the libnotmuch API is extended with
>>notmuch_database_add_message_try_decrypt().  This should probably
>>ultimately be more general, because there are a few additional
>>knobs that i can imagine fiddling at indexing time.  For example:
>>
>> * verifying cryptographic signatures and storing something about
>>   those verifications in the notmuch db
>>  
>> * extracting OpenPGP session key information for a given message
>>   and storing it in a lookaside table in the notmuch db, so that
>>   it's possible to securely destroy old encryption-capable keys
>>   and still have local access to the cleartext of the remaining
>>   messages.
>>
>>Some of these additional features might be orthogonal to one
>>another as well.  I welcome suggestions for how to improve the API
>>so that we don't end up with a combinatorial explosion of
>>n_d_add_message_foo() functions.
>
> I have a proposal for how to do this better:
>
> I'll introduce a notmuch_index_options_t, with the usual constructors
> and destructors and a couple functions:
>
>   notmuch_index_options_set_try_decrypt()
>   notmuch_index_options_get_try_decrypt()
>   notmuch_index_options_set_gpg_path()
>   notmuch_index_options_get_gpg_path()
>
> Then i'll add:
>
>   notmuch_database_add_message_with_options(db, fname, options, &message)
>
> If we add new indexing features, they can be set directly in the
> index_options object (including features that might be more complex than
> a string or a bool, like a chain of command-line filters).
>
> a few nice features of this approach:
>
>  * The user of the library can craft a set of index options and repeat
>it easily, and the options can contain cached/lazily-initialized
>things (like GMimeCryptoContexts) if needed.
>
>  * The user can index different messages with different options if they
>prefer (no need to set the options on the database object itself)
>
>  * the capability of the indexing features in the library is visible
>directly in the exposed API.
>
> any thoughts on this?

sounds good (on paper) (*)

>
> --dkg

Tomi

(*) deliberately declined to write 'looks good' >;) (but it's good)
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 7/9] add a gpg_path value for notmuch_database_t

2015-12-11 Thread Tomi Ollila
On Thu, Dec 10 2015, Daniel Kahn Gillmor  wrote:

> Exposing this to the user of the library lets the user point to
> arbitrary gpg executables when trying to decrypt.
> ---
>  lib/database-private.h |  3 ++
>  lib/database.cc| 93 
> +++---
>  lib/notmuch.h  | 31 +
>  3 files changed, 115 insertions(+), 12 deletions(-)
>
..

> +
> +static notmuch_bool_t
> +_find_in_path(const char* path)
> +{
> +char *c = NULL, *save = NULL, *tok;
> +size_t n;
> +int dfd = -1;
> +notmuch_bool_t ret = FALSE;
> +
> +n = confstr(_CS_PATH, NULL, 0);
> +c = (char*)talloc_size(NULL, n);
> +if (!c)
> + return FALSE;
> +confstr(_CS_PATH, c, n);
> +
> +tok = strtok_r(c, ":", &save);
> +while (tok) {
> + dfd = open(tok, O_DIRECTORY | O_RDONLY);
> + if (dfd != -1) {
> + if (!faccessat(dfd, path, X_OK, 0)) {
> + ret = TRUE;
> + goto done;
> + }
> + close(dfd);
> + }
> + tok = strtok_r(NULL, ":", &save);
> +}

The above code finds gpg/gpg2 (when called w/ these args) from
_CS_PATH (seems to be /bin:/usr/bin by default in linux (tried to
look how this set in *BSD -- initially it looks like /usr/local/bin
not included but... maybe we let them to complain if this is the case
... :/)
... anyway, the full found path is not set anywhere -- how is it found
when used (exec*p() using $PATH? :O)

> +done:
> +if (dfd != -1)
> + close(dfd);
> +if (c)
> + talloc_free(c);
> +return ret;
> +}
> +
> +notmuch_status_t
> +notmuch_database_set_gpg_path (notmuch_database_t *notmuch, const char* path)
> +{
> +/* return success if this matches what is already configured */
> +if ((!path && !notmuch->gpg_path) ||
> + (path && notmuch->gpg_path && 0 == strcmp(path, notmuch->gpg_path)))
> + return NOTMUCH_STATUS_SUCCESS;
> +
> +if (!path && !_find_in_path(path))
> + return NOTMUCH_STATUS_FILE_ERROR;
> +
> +/* clear any existing gpg_crypto_ctx, since things are changing */
> +if (notmuch->gpg_crypto_ctx) {
> + g_object_unref (notmuch->gpg_crypto_ctx);
> + notmuch->gpg_crypto_ctx = NULL;
> +}
> +
> +if (notmuch->gpg_path) {
> + talloc_free(notmuch->gpg_path);
> + notmuch->gpg_path = NULL;
> +}
> +
> +if (path)
> + notmuch->gpg_path = talloc_strdup (notmuch, path);
> +
> +return NOTMUCH_STATUS_SUCCESS;
> +}
> +
> +const char*
> +notmuch_database_get_gpg_path (const notmuch_database_t *notmuch)
> +{
> +if (notmuch->gpg_path)
> + return notmuch->gpg_path;
> +
> +#define try_gpg_path(z) if (_find_in_path(z)) return z
> +try_gpg_path("gpg2");
> +try_gpg_path("gpg");
> +return NULL;
> +}
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 6/9] search for a reasonable gpg implementation

2015-12-11 Thread Tomi Ollila
On Thu, Dec 10 2015, Daniel Kahn Gillmor  wrote:

> When the notmuch database needs to find gpg, have it search reasonable
> paths first.
> ---
>  lib/database.cc | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/lib/database.cc b/lib/database.cc
> index 62bc6d9..d0e8800 100644
> --- a/lib/database.cc
> +++ b/lib/database.cc
> @@ -2393,6 +2393,17 @@ _notmuch_database_link_message (notmuch_database_t 
> *notmuch,
>  return status;
>  }
>  
> +static const char*
> +_notmuch_database_get_gpg_path (notmuch_database_t *notmuch)
> +{
> +#define try_gpg_path(z) if (!access(z, X_OK)) return z
> +try_gpg_path("/usr/bin/gpg2");
> +try_gpg_path("/bin/gpg2");
> +try_gpg_path("/usr/bin/gpg");
> +try_gpg_path("/bin/gpg");
> +return NULL;
> +}

If this were to survive longer, BSD folks would like to have /usr/local/bin 
checked...
(i don't know (yet) about os x

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/9] Add a lazily-initialized crypto context to notmuch_database_t

2015-12-11 Thread Tomi Ollila
On Thu, Dec 10 2015, Daniel Kahn Gillmor  wrote:

> This is in large part a duplicate of parts of crypto.c, but that code
> is in the client (outside the library), and we don't want to entangle
> the libgmime API with the libnotmuch API.
>
> I welcome better proposals for how to share this code explicitly
> between the library and the client.
> ---
>  lib/database-private.h |  1 +
>  lib/database.cc| 42 ++
>  lib/notmuch-private.h  |  8 
>  3 files changed, 51 insertions(+)
>
> diff --git a/lib/database-private.h b/lib/database-private.h
> index 3fb10f7..1bf76c5 100644
> --- a/lib/database-private.h
> +++ b/lib/database-private.h
> @@ -171,6 +171,7 @@ struct _notmuch_database {
>   * notmuch_database_new_revision. */
>  unsigned long revision;
>  const char *uuid;
> +GMimeCryptoContext *gpg_crypto_ctx;
>  
>  Xapian::QueryParser *query_parser;
>  Xapian::TermGenerator *term_gen;
> diff --git a/lib/database.cc b/lib/database.cc
> index 3b342f1..13b0bad 100644
> --- a/lib/database.cc
> +++ b/lib/database.cc
> @@ -995,6 +995,8 @@ notmuch_database_open_verbose (const char *path,
>   notmuch->uuid = talloc_strdup (
>   notmuch, notmuch->xapian_db->get_uuid ().c_str ());
>  
> + notmuch->gpg_crypto_ctx = NULL;
> + 
>   notmuch->query_parser = new Xapian::QueryParser;
>   notmuch->term_gen = new Xapian::TermGenerator;
>   notmuch->term_gen->set_stemmer (Xapian::Stem ("english"));
> @@ -1090,6 +1092,11 @@ notmuch_database_close (notmuch_database_t *notmuch)
>  delete notmuch->last_mod_range_processor;
>  notmuch->last_mod_range_processor = NULL;
>  
> +if (notmuch->gpg_crypto_ctx) {
> + g_object_unref (notmuch->gpg_crypto_ctx);
> + notmuch->gpg_crypto_ctx = NULL;
> +}
> +
>  return status;
>  }
>  
> @@ -2386,6 +2393,41 @@ _notmuch_database_link_message (notmuch_database_t 
> *notmuch,
>  return status;
>  }
>  
> +notmuch_private_status_t
> +_notmuch_database_get_crypto_for_protocol (notmuch_database_t *notmuch,
> +const char *protocol,
> +GMimeCryptoContext **crypto_ctx)

 static function ^^^

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/9] reorganize indexing of multipart/signed and multipart/encrypted

2015-12-11 Thread Tomi Ollila
On Thu, Dec 10 2015, Daniel Kahn Gillmor  wrote:

> This prepares the codebase for a cleaner changeset for dealing with
> indexing some encrypted messages in the clear.
> ---
>  lib/index.cc | 38 ++
>  1 file changed, 18 insertions(+), 20 deletions(-)
>
> diff --git a/lib/index.cc b/lib/index.cc
> index f166aef..2fa6616 100644
> --- a/lib/index.cc
> +++ b/lib/index.cc
> @@ -333,27 +333,25 @@ _index_mime_part (notmuch_message_t *message,
>   GMimeMultipart *multipart = GMIME_MULTIPART (part);
>   int i;
>  
> - if (GMIME_IS_MULTIPART_SIGNED (multipart))
> -   _notmuch_message_add_term (message, "tag", "signed");
> -
> - if (GMIME_IS_MULTIPART_ENCRYPTED (multipart))
> -   _notmuch_message_add_term (message, "tag", "encrypted");
> -
> - for (i = 0; i < g_mime_multipart_get_count (multipart); i++) {
> - if (GMIME_IS_MULTIPART_SIGNED (multipart)) {
> - /* Don't index the signature. */
> - if (i == 1)
> - continue;
> - if (i > 1)
> - _notmuch_database_log (_notmuch_message_database (message),
> -   "Warning: Unexpected extra parts of 
> multipart/signed. Indexing anyway.\n");
> - }
> - if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) {
> - /* Don't index encrypted parts. */
> - continue;
> - }
> + if (GMIME_IS_MULTIPART_SIGNED (multipart)) {
> + _notmuch_message_add_term (message, "tag", "signed");
> + /* FIXME: should we try to validate the signature? */
> + 
> + /* FIXME: is it always just the first part that is signed in
> +  all multipart/signed messages?*/
>   _index_mime_part (message,
> -   g_mime_multipart_get_part (multipart, i));
> +   g_mime_multipart_get_part (multipart, 0));
> + 
> + if (g_mime_multipart_get_count (multipart) > 2)
> + _notmuch_database_log (_notmuch_message_database (message),
> +"Warning: Unexpected extra parts of 
> multipart/signed. Indexing anyway.\n");
> + } else if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) {
> + /* Don't index encrypted parts */

This could have the  _notmuch_message_add_term (message, "tag", "encrypted");
that was added in next patch file ?

(i saw your latest proposal, here i am commenting so that the relevant
changes can be done in nest round...)


> + } else {
> + for (i = 0; i < g_mime_multipart_get_count (multipart); i++) {
> + _index_mime_part (message,
> +   g_mime_multipart_get_part (multipart, i));
> + }
>   }
>   return;
>  }
> -- 
> 2.6.2
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] lib: have two definitions of NOTMUCH_DEPRECATED macro

2015-12-08 Thread Tomi Ollila
On Tue, Dec 08 2015, David Bremner  wrote:

> Tomi Ollila  writes:
>
>> Some compilers (older than gcc 4.5 and clang 2.9) do support
>> __attribute__ ((deprecated)) but not
>> __attribute__ ((deprecated("message"))).
>>
>> Check (clang) and know (gcc) which versions support which variants
>> and make two definitions of define NOTMUCH_DEPRECATED macro;
>> one with and and one without the ("message") part.
>>
>> __has_extension() replacement was modeled after __has_attribute()
>> definition in compat/function-attributes.h. Thanks Justus.
>
> Hi Tomi;
>
> I keep coming back to review this patch, but I'm blocked by the fact
> that clang++ is broken on Debian (and lots of other places, I guess) for
> months.
>
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797038

Personally I am not fond of the commit message but I don't want to
emphasize the change by sending an updated one. We could move it
to *moreinfo* to get it out of our ways for the time being -- and
see whether things stabilize (to one way or another) to decide 
whether to push this further. 

>
> d

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] configure: drop use of "pkg-config emacs"

2015-12-06 Thread Tomi Ollila
On Sun, Dec 06 2015, David Bremner  wrote:

> This does not play well with --prefix. As Tomi notes in
> id:m2k2p2rwth@guru.guru-group.fi, people still have the option of e.g.
>
> % ./configure ---emacslispdir=`pkg-config emacs --variable sitepkglispdir`
> ---
> oops, I missed a second use of pkg-config emacs

LGTM. Patch applies. I cannot see how this could fail...

Tomi

>
> configure | 12 ++--
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/configure b/configure
> index 440d678..abd28da 100755
> --- a/configure
> +++ b/configure
> @@ -472,19 +472,11 @@ else
>  fi
>  
>  if [ -z "${EMACSLISPDIR}" ]; then
> -if pkg-config --exists emacs; then
> - EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)
> -else
> - EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
> -fi
> +EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
>  fi
>  
>  if [ -z "${EMACSETCDIR}" ]; then
> -if pkg-config --exists emacs; then
> - EMACSETCDIR=$(pkg-config emacs --variable sitepkglispdir)
> -else
> - EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
> -fi
> +EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
>  fi
>  
>  printf "Checking if emacs is available... "
> -- 
> 2.6.2
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Query to get emails from notmuch mailing list?

2015-12-04 Thread Tomi Ollila
On Fri, Dec 04 2015, Xu Wang  wrote:

> On Thu, Dec 3, 2015 at 3:41 PM, Tomi Ollila  wrote:
>> On Thu, Dec 03 2015, David Bremner  wrote:
>>
>>> Damien Cassou  writes:
>>>
>>>> Hi,
>>>>
>>>> how do you write a notmuch query to get all emails of the notmuch
>>>> mailing list?
>>>>
>>>
>>> at one point I use
>>>
>>> notmuch tag +inbox::notmuch tag:inbox and '(' to:notmuch or folder:notmuch 
>>> ')'
>>>
>>> just now I noticed the folder:notmuch is not matching anything because
>>> of reorganization, so it's really to:notmuch; that seems to work for me.
>>
>> wouldn't to:notmuch@notmuchmail.org be more accurate ?
>
> Probably also CC? I don't know how to search for To or CC though.

to: covers [Cc][Cc]: too :D

but, to followup to my orinal it does not -- or i am not sure,
whether my suggestion matches 
(but, there probably is no use for that, at least for now).

Tomi

>
> Kind regards,
>
> Xu
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: notmuch-reply doesn't use Reply-To

2015-12-04 Thread Tomi Ollila
On Fri, Dec 04 2015, David Bremner  wrote:

> Damien Cassou  writes:
>
>>"To" : "r...@inria.fr",
>>"Reply-To" : "r...@inria.fr",
>>"From" : "seas...@rmod.inria.fr",
>>"Subject" : "[rmod] [Mm10s] 2015-11-30",
>>"Date" : "Mon, 30 Nov 2015 07:00:01 +0100"
>
> A quick look at the code suggests this is falling victim to the
> "reply-to munging" detection code, which considers a reply-to field
> redudant if it duplicates one of the other fields. From the source
>
> /* Some mailing lists munge the Reply-To header despite it being A Bad
>  * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
>  *
>  * The munging is easy to detect, because it results in a
>  * redundant reply-to header, (with an address that already exists
>  * in either To or Cc). So in this case, we ignore the Reply-To
>  * field and use the From header. This ensures the original sender
>  * will get the reply even if not subscribed to the list. Note
>  * that the address in the Reply-To header will always appear in
>  * the reply.
>  */

For anyone who did that feature, Thank You ! :D

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Query to get emails from notmuch mailing list?

2015-12-03 Thread Tomi Ollila
On Thu, Dec 03 2015, David Bremner  wrote:

> Damien Cassou  writes:
>
>> Hi,
>>
>> how do you write a notmuch query to get all emails of the notmuch
>> mailing list?
>>
>
> at one point I use
>
> notmuch tag +inbox::notmuch tag:inbox and '(' to:notmuch or folder:notmuch ')'
>
> just now I noticed the folder:notmuch is not matching anything because
> of reorganization, so it's really to:notmuch; that seems to work for me.

wouldn't to:notmuch@notmuchmail.org be more accurate ?

Tomi

sent from my N9
 

>
> d
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] configure: Use $prefix for emacs, even when pkg-config is available.

2015-11-28 Thread Tomi Ollila
On Sat, Nov 28 2015, David Bremner  wrote:

> Andrew Burgess  writes:
>
>> Assumming that you have pkg-config installed, emacs installed, and the
>> command 'pkg-config emacs --variable sitepkglispdir' returns a
>> directory that only root can write to, then the make install above
>> should fail.
>
> I agree that the current behaviour is probably wrong. I'm not sure if we
> need more control here as Tomi suggests. My biggest concern is that
> emacs.pc seems to be rather specific to fedora / redhat packaging, which
> makes it hard for me to evaluate both the current handling and this
> patch. Do any any Fedora users have opinions on just dropping the
> handling of "pkg-config emacs"? Or am I missing other places that
> pkg-config file is available?

Now that I looked this a bit more I tend to agree with David:

default PREFIX is /usr/local

and $ pkg-config emacs --variable sitepkglispdir

outputs

/usr/share/emacs/site-lisp

(in default case we should mangle /local/ there in between ... :/ ).

package managers can add 

./configure ---emacslispdir=`pkg-config emacs --variable sitepkglispdir`

in their build scripts.

>
> d

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] configure: Use $prefix for emacs, even when pkg-config is available.

2015-11-26 Thread Tomi Ollila
On Wed, Nov 25 2015, Andrew Burgess  wrote:

> Hi,
>
> I like to maintain multiple copies of notmuch installed in parallel,
> and so make use of the --prefix=$PREFIX argument to configure.
>
> I recently tried to configure and install from master, and ran into an
> issue that the location selected for installing the emacs components
> did not respect my chosen prefix.
>
> It turns out that if pkg-config is available (it is here) then the
> supplied prefix is ignored, in favour of the path returned by pkg-config.
>
> To reproduce this issue, then as a non-root user, using current master:
>
>   ./configure --prefix=$HOME/notmuch-prefix
>   make
>   make install
>
> Assumming that you have pkg-config installed, emacs installed, and the
> command 'pkg-config emacs --variable sitepkglispdir' returns a
> directory that only root can write to, then the make install above
> should fail.
>
> The solution I propose in the patch below is to still apply the
> prefix, even when pkg-config is available; pkg-config is used to
> select the path within the prefix directory.
>
> Would you consider this for inclusion?

perhaps that should be more complex: in case prefix is defined
have $(prefix)/share/emacs/site-lisp in makefile regardless of 
what pkg-config --exists emacs returns...

>
> Thanks,
> Andrew
>
> ---
> When using pkg-config to select the path for the various emacs
> installation directories (the lisp and etc directories), still apply
> the $prefix variable.
> ---
>  configure | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 440d678..4f1db82 100755
> --- a/configure
> +++ b/configure
> @@ -473,7 +473,7 @@ fi
>  
>  if [ -z "${EMACSLISPDIR}" ]; then
>  if pkg-config --exists emacs; then
> - EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)
> + EMACSLISPDIR='$(prefix)'$(pkg-config emacs --variable sitepkglispdir)
>  else
>   EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
>  fi
> @@ -481,7 +481,7 @@ fi
>  
>  if [ -z "${EMACSETCDIR}" ]; then
>  if pkg-config --exists emacs; then
> - EMACSETCDIR=$(pkg-config emacs --variable sitepkglispdir)
> + EMACSETCDIR='$(prefix)'$(pkg-config emacs --variable sitepkglispdir)
>  else
>   EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
>  fi
> -- 
> 2.5.1
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: github mirror

2015-11-21 Thread Tomi Ollila

Exceptionally top-posting as the rest is left just for reference
(for anyone interested and loosing the thread context)

Marking this as notmuch::fixed as

https://github.com/notmuch/notmuch

fixes this and is usually up-to-date (I use this link on one of my
notmuch installations)

Interestingly the wiki is also in github (just that it is updated
March 28 -- based on https://github.com/notmuch )


Tomi


On Sun, Apr 27 2014, Sam Halliday  wrote:

> Dear NotMuch,
>
> I have just started using notmuch and I really love it! I've been using
> web interfaces and proprietary mail clients for almost a decade and mutt
> before that (because I never got on well with rmail or gnus). Now, I'm
> trying to get all my life-hacker aficionados to follow suit.
>
> I was wanting to submit an RFE for you and to browse your source code to
> see how hard it would be to implement, but I was disappointed that it is
> all hosted on your own git repository with no issue tracker.
>
> While I appreciate that you probably use notmuch as your work flow
> manager, it is also quite common to use a social website such as github
> or getsatisfaction to interface with users. In my experience, github
> dramatically increases the number of contributions from users, in the
> form of what github calls "pull requests" (if you're a git user but not
> a github user, the term is confusing).
>
> Would it be possible to have a github project for notmuch? I'm certain
> the git repositories could be synchronised easily.
>
> A bridge between github's issue tracker and notmuch would be entirely
> possible: they have an API that would allow addition and removal of
> tags, as well as editing tickets. Actually, I would probably use such a
> thing :-)
>
> But in any case, my RFE/question was this: how hard would it be to have
> an optional mode of behaviour where tags are stored in the message
> itself, so that syncing with an IMAP server (e.g. via offlineimap)
> would make the tags available on all devices. This would negate the need
> for workarounds, such as shared notmuch databases, when users have
> multiple machines.
>
> It would also allow applications like offlineimap to introduce a gmail
> plugin that would copy the message into a folder according to its tags,
> so gmail labels and notmuch tags would be in sync.
>
> Best regards,
> Sam
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Question re undo

2015-11-21 Thread Tomi Ollila
On Sat, Nov 21 2015, Bart Bunting  wrote:

> Hi there,
>
> I've accidentally removed a bunch of tags in error and was dreaming
> there may be a way to fix it :).
>
> Is there any way to restore tags as they were at a certain point in
> time?

some examination of lastmod: might help ?

first run notmuch count --lastmod

Then experiment with  `notmuch search lastmod:` with "suitable"
values of num to figure out of the messages that have been affected...

Tomi

> Even if not now after i've done it, is there anything that could have been
> done at the time to fix the error?

probably not.

>
> Kind regards
> Bart
> -- 
>
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v3] devel/emacs: add devel/try-emacs-mua.sh

2015-11-15 Thread Tomi Ollila

I am marking this obsolete as I got and idea if works is going to
be pretty cool... But if it doesn't work then we'll come back
to this version.

Tomi

On Sat, Nov 14 2015, Tomi Ollila  wrote:

> 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'.
>
> With emaces older than 24.4 it is checked that none of the .elc files
> in notmuch/emacs directory is older than their corresponding .el files
> before running emacs. With newer emaces variable `load-prefer-newer'
> is effective so having old .elcs do not matter.
>
> Last possibility for "error" is when emacs starts and loads notmuch
> (by init file) before there is change to have notmuch/emacs directory
> in load-path. This time the message is written to emacs' *scratch* buffer.
>
> If everything is OK, the *scratch* buffer is filled with some lisp code
> which user can evaluate before running notmuch functions.
> ---
>
> Version 3 (I guess) -- the discovery Mark made in
> id:87si4bwrsu@qmul.ac.uk has been fixed (originally to perl code,
> but now converted to shell) -- and changed to just recognize that there
> are old .elc files -- and the check is done only for emacses < 24.4.
> Now loading of "notmuch" is wrapped in (let ((load-prefer-newer t)) ...).
>
> I tried tricks to ensure that notmuch*.el files are (always) loaded, but
> it either got too complicated (hacky, potentially fragile defadvices), or
> I saw plenty of *.el.gz uncompressions happening (and recursion loop in
> jka-compr before that)...
>
> There is one notably change to the previous one -- before loading notmuch
> there is check whether it is already loaded; if it is there is no point
> going further here. Thanks for this discovery goes to IRC debugging
> section with (mark and) "pseudomyne".
>
>  devel/try-emacs-mua.sh | 117 
> +
>  1 file changed, 117 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 ..e8406e3cb143
> --- /dev/null
> +++ b/devel/try-emacs-mua.sh
> @@ -0,0 +1,117 @@
> +#!/bin/sh
> +
> +# This script offers 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
> + 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 ;;
> + *\\*)   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 "$emd"/notmuch-lib.el || {
> + echo "Cannot find notmuch-emacs source directory" >&2
> + exit 1
> +}
> +
> +case `exec 2>&1 "${EMACS:-emacs}" -Q --batch -eval \
> + '(message (if (boundp '\''load-prefer-newer) "<-yes->" "<-no->"))'`
> +in (*'<-no->'*)
> + allnew=true
> + for elc in "$emd"/*.elc
> + do
> + test -f "$elc" || continue
> + if test "$elc" -ot "${elc%c}"
> + then
> + echo "'$elc' is older than '${elc%c}'" >&2
> + allnew=false
> + fi
> + done
> + $allnew || {
> + exec >&2
> + echo
> + echo "In directory '$emd' there are .elc files that are"
> + echo "older than their corresponding .el files."
> + echo "Please remove (or recompile) th

[PATCH v3] devel/emacs: add devel/try-emacs-mua.sh

2015-11-13 Thread Tomi Ollila
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'.

With emaces older than 24.4 it is checked that none of the .elc files
in notmuch/emacs directory is older than their corresponding .el files
before running emacs. With newer emaces variable `load-prefer-newer'
is effective so having old .elcs do not matter.

Last possibility for "error" is when emacs starts and loads notmuch
(by init file) before there is change to have notmuch/emacs directory
in load-path. This time the message is written to emacs' *scratch* buffer.

If everything is OK, the *scratch* buffer is filled with some lisp code
which user can evaluate before running notmuch functions.
---

Version 3 (I guess) -- the discovery Mark made in
id:87si4bwrsu@qmul.ac.uk has been fixed (originally to perl code,
but now converted to shell) -- and changed to just recognize that there
are old .elc files -- and the check is done only for emacses < 24.4.
Now loading of "notmuch" is wrapped in (let ((load-prefer-newer t)) ...).

I tried tricks to ensure that notmuch*.el files are (always) loaded, but
it either got too complicated (hacky, potentially fragile defadvices), or
I saw plenty of *.el.gz uncompressions happening (and recursion loop in
jka-compr before that)...

There is one notably change to the previous one -- before loading notmuch
there is check whether it is already loaded; if it is there is no point
going further here. Thanks for this discovery goes to IRC debugging
section with (mark and) "pseudomyne".

 devel/try-emacs-mua.sh | 117 +
 1 file changed, 117 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 ..e8406e3cb143
--- /dev/null
+++ b/devel/try-emacs-mua.sh
@@ -0,0 +1,117 @@
+#!/bin/sh
+
+# This script offers 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
+   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 ;;
+   *\\*)   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 "$emd"/notmuch-lib.el || {
+   echo "Cannot find notmuch-emacs source directory" >&2
+   exit 1
+}
+
+case `exec 2>&1 "${EMACS:-emacs}" -Q --batch -eval \
+   '(message (if (boundp '\''load-prefer-newer) "<-yes->" "<-no->"))'`
+in (*'<-no->'*)
+   allnew=true
+   for elc in "$emd"/*.elc
+   do
+   test -f "$elc" || continue
+   if test "$elc" -ot "${elc%c}"
+   then
+   echo "'$elc' is older than '${elc%c}'" >&2
+   allnew=false
+   fi
+   done
+   $allnew || {
+   exec >&2
+   echo
+   echo "In directory '$emd' there are .elc files that are"
+   echo "older than their corresponding .el files."
+   echo "Please remove (or recompile) these older files and try 
again."
+   echo
+   exit 1
+   }
+   unset allnew
+esac
+
+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
+   qin='
+If you want to load your .emacs startup file now, evaluate
+(load \"~/.emacs\")
+
+If you want to use packages (e.g. company from elpa) evaluate
+(progn (require '\''package) (package-initialize))
+'
+else
+   qin='
+To view initialization time messages, evaluate
+(pop-to-buffer \"*Messages*\")
+'
+fi
+
+cd "$pwd"
+
+exec "${EMACS:-emacs}" $opt --debug-init -L "$emd" --eval '
+(with-current-buffer "*scratch*"
+  (if (featurep '\''notmuch)
+  (insert "
+Notmuch has been loaded to this emacs (during processing of the init file)
+which means it is (most probably) loaded from different source than expected.
+
+Please rerun \"'"$0"'\" with '"'q'"' to disable
+processing of the init fil

Re: [PATCH] devel/emacs: add devel/try-emacs-mua.sh

2015-11-12 Thread Tomi Ollila
On Thu, Nov 12 2015, Mark Walters  wrote:

>> 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@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 ..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.

It sure doesn't! Thanks for the review.

Tomi


>
>> +
>> +# 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

Re: [PATCH] emacs: Fix regression in (notmuch-)message-mode initialization

2015-11-09 Thread Tomi Ollila
On Mon, Nov 09 2015, Michal Sojka  wrote:

> On Mon, Nov 09 2015, David Bremner wrote:
>> Michal Sojka  writes:
>>
>>> This commit uses advice mechanism to call notmuch-message-mode instead
>>> of message-mode. This way, a call to message-mail initializes directly
>>> notmuch-message-mode rather than message-mode which is later changed
>>> to notmuch-message-mode. The advice is constructed in such a way, that
>>> it is effective only once and when called by notmuch. The second call
>>> to message-mode (from notmuch-message-mode) calls the original
>>> message-mode.
>>
>> I wanted to answer this with an alternative patch, but I haven't had
>> time.
>>
>> I admit to being somewhat prejudiced against shipping code with advice
>> in it (IMHO it's fine for user specific customization, but not very
>> maintainable).
>>
>> I think we might be better off in the long run replacing the call to
>> message-mail. Code duplication is obviously not great, but perhaps some
>> of the complexity of message-mail / message-pop-to-buffer can be
>> eliminated, since we don't need to support all of the use cases of
>> message-mail.
>
> OK. I'll try implement notmuch-message-mail as a simpler alternative to
> message-mail. Let's see how it will look like.

that might be better than my vague thought of let-binding that particular
hook (to nil) and run-hooks it later...

Tomi (sending from my N9)
 
>
>>
>>> This implementation uses the new advice mechanism introduced in Emacs
>>> 24.4. If we want to support older version, this must be changed.
>>
>> We do try to support Emacs 23 still (except for some optional
>> features). Unfortunately old advice is even nastier.
>
> Hopefully, advises won't be needed then.
>
> Thanks,
> -Michal
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: multiple directories for path?

2015-11-07 Thread Tomi Ollila
On Sat, Nov 07 2015, Julien Cubizolles  wrote:

> I've my mail in two different directories: a Maildir sync by offlineimap
> and nnml mail spools. How can I have notmuch index both ? The path entry
> in .notmuch-config doesn't seem to allow multiple values.

You can make symbolic link pointing from database.path to the another: i.e.

ln -s /path/to/other /path/to/database.path/linkname

>
> Julien.

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: weird paths in notmuch database

2015-11-06 Thread Tomi Ollila
On Fri, Nov 06 2015, Davide Mancusi  wrote:

> 2015-11-06 16:24 GMT+01:00 Tomi Ollila :
>> And notmuch config get database.path prints /export/home/username/mail
>> I presume ?
>
> Correct.
>
>> If that is the case then this symlink should have no effect.
>>
>> Is there any symlinks inside /export/home/username/mail
>> ( find /export/home/username/mail -type l ) (provided that
>> was the database.path -- and sure there are no bind mounts ;D?)
>
> No symlinks and no bind mounts.

Ah, so path 
/export/home/username/mail//home/username/local/mail/archive/cur/1446805732.2711_9.hostname:2,S

does not exist? It probably used to be (?) (via some long-gone symlink?)
and now it is just garbage in the database (that does not go away)...?

>
> Cheers,
> Davide

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Fontify From with message-header-other

2015-11-06 Thread Tomi Ollila
On Thu, Nov 05 2015, "H. J. Illikainen"  wrote:

> Commit e26d767897e8ab59f05808a12ac5c9c1e3c7030f changed the
> fontification of the body associated with the From header to
> message-header-from.  However, that face is non-existent, and in
> message.el (message-font-lock-keywords) the From-header falls through
> and is attributed the message-header-other face.
>
> This commit removes the fontification of the [Ff]rom header in
> notmuch-show-mode in order to fontify it using the message-header-other
> face.
>
> This only affects non-default configurations where
> notmuch-message-headers is set to display From.

I grepped emacs 24.3 sources for message-header-subject and
message-header-from and, indeed, there is not reference to 
message-header-from (but plenty of message-header-subject).

So, to me this change looks good (and trivial) -- I have not
tested it (yet), though.

Tomi

> ---
>  emacs/notmuch-show.el | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 49fd198..793f1a5 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -353,8 +353,6 @@ operation on the contents of the current buffer."
>   'message-header-cc)
>  ((looking-at "[Ss]ubject:")
>   'message-header-subject)
> -((looking-at "[Ff]rom:")
> - 'message-header-from)
>  (t
>   'message-header-other
>  
> -- 
> H. J. Illikainen
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: weird paths in notmuch database

2015-11-06 Thread Tomi Ollila
On Fri, Nov 06 2015, Davide Mancusi  wrote:

> 2015-11-06 16:14 GMT+01:00 Tomi Ollila :
>> How is the symlink exactly shown in  ls -l /path/to/symlink  output ?
>
> $ ls -l /home/username/local
> lrwxrwxrwx 1 username group 21 Jan 23  2015 /home/username/local ->
> /export/home/username

And notmuch config get database.path prints /export/home/username/mail 
I presume ?

If that is the case then this symlink should have no effect.

Is there any symlinks inside /export/home/username/mail 
( find /export/home/username/mail -type l ) (provided that
was the database.path -- and sure there are no bind mounts ;D?)

Tomi

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: weird paths in notmuch database

2015-11-06 Thread Tomi Ollila
On Fri, Nov 06 2015, Davide Mancusi  wrote:

> 2015-11-06 14:09 GMT+01:00 David Bremner :
>>> $ notmuch search --output=files 'path:/home/**'
>>> /export/home/username/mail//home/username/local/mail/archive/cur/1446805732.2711_9.hostname:2,S
>>> /export/home/username/mail/archive/cur/1446805732.2711_9.hostname:2,S
> [...]
>>
>>The directory must be specified relative to the top-level maildir
>>(and without the leading slash).
>>
>> Please try with correct search syntax in order to narrow down the
>> problem.
>
> The unusual search was just to illustrate the problem. I get the paths
> even with tag searches, like so:
>
> $ notmuch search --output=files
> 'id:20151106102835.ga2...@hostname.domain.com'
> /export/home/username/mail//home/username/local/mail/archive/cur/1446805732.2711_9.hostname:2,S
> /export/home/username/mail/archive/cur/1446805732.2711_9.hostname:2,S


How is the symlink exactly shown in  ls -l /path/to/symlink  output ?

(you can do the s/$USER/username/ conversion :)

Tomi

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] devel/emacs: add devel/try-emacs-mua.sh

2015-11-01 Thread Tomi Ollila
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.
---

Addressed David's comments in id:87d1xdtim1@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 ..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
+
+# 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";
+   }
+}'
+
+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


[PATCH v3] devel/release-checks: added checking of copyright year in documentation

2015-11-01 Thread Tomi Ollila
Check that copyright year will be current year in generated documentation.

Checking is done my matching that copyright line contains current year
as a substring which is good enough "approximation" in this context.
---

v3 of id:1440616236-17866-1-git-send-email-tomi.oll...@iki.fi
changed $year to 2009-$year

v2 of id:1438511187-11321-1-git-send-email-tomi.oll...@iki.fi, perhaps
addressing comments in id:87r3niwan6@maritornes.cs.unb.ca

 devel/release-checks.sh | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/devel/release-checks.sh b/devel/release-checks.sh
index 8604a9f7d10b..5802942aa975 100755
--- a/devel/release-checks.sh
+++ b/devel/release-checks.sh
@@ -175,6 +175,21 @@ case $news_date in
append_emsg "Date '$news_date' in NEWS file is not in format 
(-mm-dd)"
 esac
 
+year=`exec date +%Y`
+echo -n "Checking that copyright in documentation contains 2009-$year... "
+# Read the value of variable `copyright' defined in 'doc/conf.py'.
+# As __file__ is not defined when python command is given from command line,
+# it is defined before contents of 'doc/conf.py' (which dereferences __file__)
+# is executed.
+copyrightline=`exec python -c "with open('doc/conf.py') as cf: __file__ = ''; 
exec(cf.read()); print(copyright)"`
+case $copyrightline in
+   *2009-$year*)
+   echo Yes. ;;
+   *)
+   echo No.
+   append_emsg "The copyright in doc/conf.py line '$copyrightline' 
does not contain '2009-$year'"
+esac
+
 if [ -n "$emsgs" ]
 then
echo
-- 
2.0.0

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: poll: return useful errors when poll fails.

2015-10-28 Thread Tomi Ollila
On Wed, Oct 28 2015, Mark Walters  wrote:

> Previously poll called from emacs would fail silently. This makes it
> return a useful error message.
>
> In the non-deprecated case of notmuch new and appropriate hooks, it
> uses notmuch-call-notmuch-process which gives an error and
> additionally puts the stdout/stderr etc in the *Notmuch errors*
> buffer.
>
> In the deprecated case of a custom poll script it only returns an
> error message.
>
> Commit based on a bug report, and a potential fix, by Ketil Malde.
> ---

Looks good (to me) -- I investigated a bit how notmuch-call-notmuch-process
does things; it uses notmuch-check-exit-status which is not applicable 
here.

Mark said he doesn't use poll -- and I have rewritten my poll(*) so my
tests will be as lightweight as his. So we wait for Ketil's report
how this works :D

Tomi

(*) see at the end of this email

>
> This should fix the bug reported in the parent message -- we should
> definitely report error messages. It might be nice to output the
> stdout/stderr in the custom poll script case but since we don't have
> built in infrastructure for it it probably isn't worth it for a
> deprecated case.
>
> (Note I don't use poll, so this is not heavily tested)
>
> Best wishes
>
> Mark
>

For reference, if anyone gets ideas from this...

;; overwrite notmuch-poll defined in notmuch.el
(defun notmuch-poll ()
  (interactive)
  (save-window-excursion
(let ((buffer (get-buffer-create "*my notmuch polls*")))
  (set-buffer buffer)
  (setq buffer-read-only nil)
  (goto-char (point-max))
  (pop-to-buffer buffer)
  (call-process "notmuch-log-output.sh" nil t t "new" "--verbose")
  (bury-buffer))) ;; <- b-b to put the buffer at the "bottom" of buffers
  (message "update finished"))

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: elisp + company completion patches, v7

2015-10-27 Thread Tomi Ollila
On Mon, Oct 26 2015, Carl Worth  wrote:

> On Sun, Oct 25 2015, Tomi Ollila wrote:
>> I, if this does not sound nitpicking, would amend those 'This patch' and
>> 'With this patch' texts in commit messages away by some rewording -- those
>> pose as a bad example for someone reading the code -- and diminish the
>> effect when I complain that again in future patched ;)
>
> What's the motivation here?
>
> It's often the case that a good commit message needs to describe the way
> things were working prior to a commit, (describing the bug or missing
> feature or what have you), and also needs to describe the change that is
> affected by the commit itself.
>
> So I actually like seeing commit messages that say things like:
>
> Prior to this commit... (some bug existed...)
>
> In this commit... (some code is reworked to fix the bug...)
>
> But maybe I've missed the point of your message.
>
>
> -Carl

Probably the missing point is the fine distinction between 
'this patch' and 'this commit'

While we do sets of changes and then that leads to commit series the final
step of running 'git format-patch' somehow leads people writing commit
message to add words 'this patch' to the message...
... or (what just come into my mind) they just think these changes as
patches (is that linux-kernel influence ?)

To me the commit history does not look like series of patches (but series
of commits or changes -- and changes are usually shown as "diffs") --
patching gives a connotation of fixing something (with glue or gum ;)

That is how I see it. That doesn't mean I am right there (and in this mailing
list I've been wrong in statistically significant amount (*) of times).

Un{less,til} decided otherwise I'll continue with delicate efforts to
keep this style issue in the minds of developers; despite (**) informing
me that will be doomed...

Tomi

(*) https://en.wikipedia.org/wiki/Statistical_significance
(**) https://en.wikipedia.org/wiki/Wiio%27s_laws
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: elisp + company completion patches, v7

2015-10-25 Thread Tomi Ollila
On Sun, Oct 25 2015, David Bremner  wrote:

> This round contains several bug fixes from Mark, and a slightly
> re-organized initialization from me.  In particular, TAB should now
> behave sanely under company. Also there's a stub
> notmuch-address-message-insinuate to prevent peoples emacs startup
> from failing.

Looks pretty good, I, like Mark, noticed some newline changes in patch 1
(which is fixed in patch 2 so I personally would not care of that). The
another indentation thing Mark noticed is easy to amend.

I, if this does not sound nitpicking, would amend those 'This patch' and
'With this patch' texts in commit messages away by some rewording -- those
pose as a bad example for someone reading the code -- and diminish the
effect when I complain that again in future patched ;)

The basic completion with this new system using notmuch address output
and (supposedly) caching the values seems to work very well and I believe
is welcome feature to (new) users. I did not test how company mode works
as I don't have it (and there is no company mode for this mixed environment
what I use now -- except that I could install it from elpa; maybe I try
that in near future...)

BTW: if anyone knows how to enable lexical-binding to a block of code
(i.e. alternative to -*- lexical-binding: t -*- (or can give hints, like
s/\([^-]\)let/\1lexical-let/) I'd like to know...)

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] NEWS: a few formatting updates for 0.21 news items (wiki compatibility)

2015-10-19 Thread Tomi Ollila
Trailing dots were removed from 3 NEWS items so that those appear in
same level as surrounding "heading" lines in generated wiki page.

One trailing dot was added to nmbug-status item so it appears as normal
text in generated wiki page. `nmbug-status` was put in backticks so it
looks the same as in older nmbug-status news text.
---
 NEWS | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index c544a8e..2c23362 100644
--- a/NEWS
+++ b/NEWS
@@ -75,7 +75,7 @@ Removed `notmuch-version` function by renaming it to 
`notmuch-cli-version`
   function which retrieves the version of `notmuch-command` is
   better named as `notmuch-cli-version`.
 
-Query input now supports completion for "is:".
+Query input now supports completion for "is:"
 
 New message composition mode: `notmuch-compose-mode`
 
@@ -86,7 +86,7 @@ Library
 ---
 
 The use of absolute paths is now enforced when calling
-`notmuch_database_{open, create}`.
+`notmuch_database_{open, create}`
 
 New function `notmuch_directory_delete` to delete directory documents
 
@@ -107,7 +107,7 @@ Database revision tracking
   query parser and the new function
   `notmuch_database_get_revision`. For the latter, see `notmuch(3)`.
 
-New status code returning API for n_query_count_{messages,threads}.
+New status code returning API for n_query_count_{messages,threads}
 
 Deprecated functions
 
@@ -119,7 +119,7 @@ Deprecated functions
 nmbug-status
 
 
-nmbug-status now supports specifying the sort order for each view
+`nmbug-status` now supports specifying the sort order for each view.
 
 Notmuch 0.20.2 (2015-06-27)
 ===
-- 
1.9.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: NEWS patches v2

2015-10-19 Thread Tomi Ollila
On Sun, Oct 18 2015, Jani Nikula  wrote:

> On Sun, 18 Oct 2015, Tomi Ollila  wrote:
>> On Sat, Oct 17 2015, David Bremner  wrote:
>>
>>> I had a series in progress more or less at the same time as Jani, so
>>> of course there were all kinds of silly conflicts.
>>>
>>> I rebased the two series together, and tried to get most of Tomi's
>>> formatting comments.
>>
>> From the formatting point of view this series looks good -- with luck
>> I don't have to do post-release NEWS formatting tunes this time(*) ;)
>>
>> Jani: the tool to "check" formatting is devel/news2wiki.pl
>
> Oh, but it doesn't complain on what I wrote, and then you have to check
> whether the markdown output is all right or not... which is roughly
> equivalent of manually checking the input?

Roughly ;p -- it is somewhat easier to look markdown than stare trailing
dots...

But yes, there is no tool to do any part of the checking automatically.
Perhaps the simplest one could be that if there is trailing dots in a
block that is not indented, write a message which informs that if the
line in question is supposed to be a header line, drop trailing dot...

Tomi


>
> BR,
> Jani.
>
>>
>> (*) perhaps this time I have a chance (i.e. remember) to run
>> devel/news2wiki.pl *before* release.
>>
>> Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: NEWS patches v2

2015-10-18 Thread Tomi Ollila
On Sat, Oct 17 2015, David Bremner  wrote:

> I had a series in progress more or less at the same time as Jani, so
> of course there were all kinds of silly conflicts.
>
> I rebased the two series together, and tried to get most of Tomi's
> formatting comments.

From the formatting point of view this series looks good -- with luck
I don't have to do post-release NEWS formatting tunes this time(*) ;)

Jani: the tool to "check" formatting is devel/news2wiki.pl

(*) perhaps this time I have a chance (i.e. remember) to run
devel/news2wiki.pl *before* release.

Tomi

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/4] NEWS: news for notmuch address --deduplicate option

2015-10-17 Thread Tomi Ollila
On Sat, Oct 17 2015, Jani Nikula  wrote:

> ---
>  NEWS | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index 317e7e62deaa..9940f8185e82 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -14,6 +14,19 @@ Date queries now support `date:..!` shorthand for
>beginning of yesterday to the end of yesterday. For further details,
>please refer to the `notmuch-search-terms` manual page.
>  
> +Command-Line Interface
> +--
> +
> +The `notmuch address` command supports new deduplication schemes
> +
> +  `notmuch address` has gained a new `--deduplicate` option to specify
> +  how the results should be deduplicated, if at all. The alternatives
> +  are `no` (do not deduplicate, useful for processing the results with
> +  external tools), `mailbox` (deduplicate based on the full, case
> +  sensitive name and email address), and `address` (deduplicate based
> +  on the case insensitive address part). See the `notmuch-address`
> +  manual page for further information.
> +

LGTM (format).

>  Emacs Interface
>  ---
>  
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 4/4] NEWS: news for notmuch_directory_delete

2015-10-17 Thread Tomi Ollila
On Sat, Oct 17 2015, Jani Nikula  wrote:

> ---
>  NEWS | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index 9940f8185e82..c5417144b755 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -47,6 +47,19 @@ Library
>  The use of absolute paths is now enforced when calling
>  `notmuch_database_{open, create}`.
>  
> +New function `notmuch_directory_delete` to delete directory documents
> +
> +  Previously there was no way to delete directory documents from the
> +  database, leading to confusing results when the "ghost" directory
> +  document of a renamed or deleted filesystem directory was
> +  encountered every time the parent directory was being scanned by
> +  `notmuch new`. The mtime of the old directory document was also used
> +  if a directory by the same name was added again in the filesystem,
> +  potentially bypassing the scan for the directory. The issues are
> +  fixed by providing a library call to delete directory documents, and
> +  deleting the old documents in `notmuch new` on filesystem directory
> +  removal or rename.

LGTM (format).

> +
>  nmbug-status
>  
>  
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 2/4] NEWS: news for date:..!

2015-10-17 Thread Tomi Ollila
On Sat, Oct 17 2015, Jani Nikula  wrote:

> ---
>  NEWS | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index 95470d7c070b..317e7e62deaa 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -7,6 +7,13 @@ General
>  Notmuch now requires gmime >= 2.6.7. The gmime 2.4 series is no longer
>  supported.
>  
> +Date queries now support `date:..!` shorthand for
> +`date:..`.

Amend to drop trailing dot.

> +
> +  You can use, for example, `date:yesterday..!` to match from the
> +  beginning of yesterday to the end of yesterday. For further details,
> +  please refer to the `notmuch-search-terms` manual page.
> +
>  Emacs Interface
>  ---
>  
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/4] NEWS: nmbug-status supports sort order

2015-10-17 Thread Tomi Ollila
On Sat, Oct 17 2015, Jani Nikula  wrote:

> ---
>  NEWS | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/NEWS b/NEWS
> index 3593ded71bd7..95470d7c070b 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -27,6 +27,11 @@ Library
>  The use of absolute paths is now enforced when calling
>  `notmuch_database_{open, create}`.
>  
> +nmbug-status
> +
> +
> +nmbug-status now supports specifying the sort order for each view

Amend to have trailing dot.

> +
>  Notmuch 0.20.2 (2015-06-27)
>  ===
>  
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: tree bugfix

2015-10-15 Thread Tomi Ollila
On Thu, Oct 15 2015, Mark Walters  wrote:

> Formerly replying to an encrypted message in tree-view did not work:
> the message was not decrypted. This commit makes notmuch-tree respect
> the setting of notmuch-crypto-process-mime. In particular, if
> notmuch-crypto-process-mime is set to t, then replying to encrypted
> messages in tree mode will now decrypt the reply (as it already did in
> show mode).
> ---
> The same patch as before but with an updated commit message.

This looks tolerable to me...

Tomi


>
> Best wishes
>
> Mark
>
>  emacs/notmuch-tree.el | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index 182235e..5695b68 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -867,6 +867,11 @@ the same as for the function notmuch-tree."
>(setq notmuch-tree-query-context query-context)
>(setq notmuch-tree-target-msg target)
>(setq notmuch-tree-open-target open-target)
> +  ;; Set the default value for `notmuch-show-process-crypto' in this
> +  ;; buffer. Although we don't use this some of the functions we call
> +  ;; (such as reply) do. It is a buffer local variable so setting it
> +  ;; will not affect genuine show buffers.
> +  (setq notmuch-show-process-crypto notmuch-crypto-process-mime)
>  
>(erase-buffer)
>(goto-char (point-min))
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: show: increase default max-text-part-size

2015-10-15 Thread Tomi Ollila
On Thu, Oct 15 2015, Mark Walters  wrote:

> Currently notmuch-show-max-text-part-size is 1 which means some
> relatively normal messages have all parts hidden by default. Increase
> this to 10 by default.
>
> The setting was introduced to alleviate problems with notmuch being
> very slow on large threads. Users hitting these problems may wish to
> customize this variable to something smaller (like 1).
> ---
> Since we have several people hitting this limit on irc it seems
> sensible to make the default much bigger and let the users who hit the
> slow down configure it.

LGTM.

Tomi

>
> Best wishes
>
> Mark
>
>  emacs/notmuch-show.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 4dee34b..49fd198 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -100,7 +100,7 @@ visible for any given message."
>:group 'notmuch-show
>:group 'notmuch-hooks)
>  
> -(defcustom notmuch-show-max-text-part-size 1
> +(defcustom notmuch-show-max-text-part-size 10
>"Maximum size of a text part to be shown by default in characters.
>  
>  Set to 0 to show the part regardless of size."
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] doc: update copyright year to contain range 2009-2015

2015-10-15 Thread Tomi Ollila
Now it is accurate and provides more information to the
reader of the documents.
---
 doc/conf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/conf.py b/doc/conf.py
index 8fbc8544b0b1..65adafeb1cef 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -12,7 +12,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'notmuch'
-copyright = u'2014, Carl Worth and many others'
+copyright = u'2009-2015, Carl Worth and many others'
 
 location = os.path.dirname(__file__)
 
-- 
2.0.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] doc: update copyright year

2015-10-15 Thread Tomi Ollila
---
 doc/conf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/conf.py b/doc/conf.py
index 8fbc8544b0b1..4609bfe3709e 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -12,7 +12,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'notmuch'
-copyright = u'2014, Carl Worth and many others'
+copyright = u'2015, Carl Worth and many others'
 
 location = os.path.dirname(__file__)
 
-- 
2.0.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: V2 of directory delete patches

2015-10-11 Thread Tomi Ollila
On Sat, Oct 10 2015, David Bremner  wrote:

> Changes since id:cover.1443213654.git.j...@nikula.org
>
>   - tidy commit messages
>   - update docs in lib/notmuch.h
>   - make an executive decision not to push _remove_directory into lib
>   for now; it can always be a new api layer later.
>   - unmark fixed tests
>   - wrap xapian calls in try/catch


Looks good to me. tests pass.

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PÄTCH] notmuch-emacs-mua: set EMACS{,CLIENT} variables to defaults when empty

2015-10-04 Thread Tomi Ollila
... in addition to doing this when these variables are unset.

It is more useful to use defaults (emacs or emacsclient) than empty
string as a command name.
---

Without this:

$ EMACS= ./notmuch-emacs-mua
./notmuch-emacs-mua: line 150: exec: --: invalid option
exec: usage: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
zsh: exit 2 EMACS= ./notmuch-emacs-mua

 notmuch-emacs-mua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index 016fa12613c4..4404cd7c33b8 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -30,8 +30,8 @@ escape ()
 printf -v $2 '%s' "${__escape_arg__//\"/\\\"}"
 }
 
-EMACS=${EMACS-emacs}
-EMACSCLIENT=${EMACSCLIENT-emacsclient}
+EMACS=${EMACS:-emacs}
+EMACSCLIENT=${EMACSCLIENT:-emacsclient}
 
 PRINT_ONLY=
 NO_WINDOW=
-- 
2.0.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] notmuch-emacs-mua: set EMACS{, CLIENT} variables to defaults when empty

2015-10-04 Thread Tomi Ollila
... in addition to doing this when these variables are unset.

It is more useful to use defaults (emacs or emacsclient) than empty
string as a command name.
---

Without this:

$ EMACS= ./notmuch-emacs-mua
./notmuch-emacs-mua: line 150: exec: --: invalid option
exec: usage: exec [-cl] [-a name] [command [arguments ...]] [redirection ...]
zsh: exit 2 EMACS= ./notmuch-emacs-mua

 notmuch-emacs-mua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index 016fa12613c4..4404cd7c33b8 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -30,8 +30,8 @@ escape ()
 printf -v $2 '%s' "${__escape_arg__//\"/\\\"}"
 }
 
-EMACS=${EMACS-emacs}
-EMACSCLIENT=${EMACSCLIENT-emacsclient}
+EMACS=${EMACS:-emacs}
+EMACSCLIENT=${EMACSCLIENT:-emacsclient}
 
 PRINT_ONLY=
 NO_WINDOW=
-- 
2.0.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] nmbug-status: print config errors to stderr

2015-10-03 Thread Tomi Ollila
On Sat, Oct 03 2015, Jani Nikula  wrote:

> Particularly scripted usage with stdout redirection can be confusing
> if errors are printed to stdout instead of stderr.

LGTM

> ---
>  devel/nmbug/nmbug-status | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
> index a289798e3cc1..b36b6ad33859 100755
> --- a/devel/nmbug/nmbug-status
> +++ b/devel/nmbug/nmbug-status
> @@ -318,7 +318,7 @@ args = parser.parse_args()
>  try:
>  config = read_config(path=args.config)
>  except ConfigError as e:
> -print(e)
> +print(e, file=sys.stderr)
>  sys.exit(1)
>  
>  header_template = config['meta'].get('header', '''
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] notmuch-emacs-mua: make --auto-daemon imply --create-frame

2015-09-29 Thread Tomi Ollila
Before this change with --auto-daemon but without --create-frame
emacs server was started but no clients stay connected to it
(in both graphical and terminal displays).

Note that this changes how --client --auto-daemon works on
graphical display; New emacs frame is now created for the
message (and message-exit-actions hook appended).
---
 doc/man1/notmuch-emacs-mua.rst | 3 ++-
 notmuch-emacs-mua  | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
index c3689eb82c8a..7c5729047173 100644
--- a/doc/man1/notmuch-emacs-mua.rst
+++ b/doc/man1/notmuch-emacs-mua.rst
@@ -43,7 +43,8 @@ Supported options for **notmuch-emacs-mua** include
 
 ``--auto-daemon``
 Automatically start Emacs in daemon mode, if the Emacs server
-is not running. Applicable with ``--client``.
+is not running. Applicable with ``--client``. Implies
+``--create-frame``.
 
 ``--create-frame``
 Create a new frame instead of trying to use the current Emacs
diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index b51d8d0e2c5b..016fa12613c4 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -108,6 +108,7 @@ while getopts :s:c:b:i:h opt; do
;;
--auto-daemon)
AUTO_DAEMON="--alternate-editor="
+   CREATE_FRAME="-c"
;;
--create-frame)
CREATE_FRAME="-c"
-- 
2.0.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by default with --client

2015-09-29 Thread Tomi Ollila
On Tue, Sep 29 2015, Tomi Ollila  wrote:

> On Mon, Sep 28 2015, David Bremner  wrote:
>
>> Tomi Ollila  writes:
>>
>>
>>> if [ -n "$AUTO_DAEMON" -a -z "$CREATE_FRAME" ]; then
>>> echo "$0: --auto-daemon is only applicable with --create-frame." >&2
>>> exit 1   
>>> fi
>>>
>>> without this one may execute ./notmuch-emacs-mua --client --auto-daemon
>>> which yields starting emacs in daemon mode (in this example it is expected
>>> emacs is not running; otherwise --auto-daemon has no use in this example)
>>> -- but no ui to that newly-running emacs is provided. Similar behaviour
>>> can be observed by the following
>>>
>>
>> I think what you propose is fine for a followup patch; note that the
>> scenario you worry about also needs --client to be a problem. Apparently
>> nothing is uncontroversial here, but if auto-daemon only works with
>> create frame, then perhaps the followup would be to have auto-daemon
>> imply create-frame
>
> Without --client --auto-daemon is no-op (as it is no-op in case emacs
> server is already running). I am (only) concerned about user experience
> when one runs --client --auto-daemon and user gets nothing (i.e. emacs
> server is running in the background w/o any clients connected to it.
>
> We could make --auto-daemon imply --create-frame, but then 
>
> ./notmuch-emacs-mua --auto-daemon (i.e. w/o --client) starts new mail
> compose window to separate frame (even though user did not request
> it w/ --create-frame)

Hmm, a few more tests. it now looks like in case the command line is

./notmuch-emacs-mua --client --auto-daemon

Then the --create-frame should be implied. w/o --client --create-frame
would ... well, create that (only) emacs frame anyways... oh, the
combinations; for reference I just paste from my history...


1  07:57  0:01  ccd notmuch
2  07:57  0:06  git pull --rebase
3  07:57  0:01  git log
4  07:57  0:04  tig
5  07:58  0:10  ./notmuch-emacs-mua --auto-daemon
6  07:58  0:00  ps ax
8  07:58  0:00  emacs &
9  07:58  0:07  ./notmuch-emacs-mua --auto-daemon
   10  07:59  0:01  ./notmuch-emacs-mua --client --auto-daemon
   12  08:01  0:03  ./notmuch-emacs-mua --auto-daemon
   13  08:02  0:00  ps ax
   14  08:02  0:00  ls /tmp/emacs1001
   15  08:02  0:00  ./notmuch-emacs-mua -nw --auto-daemon
   16  08:02  0:04  DISPLAY= ./notmuch-emacs-mua  --auto-daemon
   17  08:02  0:05  tig
   18  08:03  0:02  DISPLAY= ./notmuch-emacs-mua --auto-daemon
   19  08:04  0:01  DISPLAY= ./notmuch-emacs-mua --client --auto-daemon
   20  08:04  0:00  ps ax
   21  08:04  0:00  kill 1860
   22  08:04  0:00  ps ax
   23  08:06  0:00   ./notmuch-emacs-mua --client --auto-daemon
   24  08:06  0:00  ps ax
   25  08:06  0:00  kill 1875
   26  08:06  0:00   ./notmuch-emacs-mua --client --auto-daemon
   27  08:06  0:00  ps ax
   28  08:06  0:00  kill 1926
   29  08:06  0:06  ./notmuch-emacs-mua --client --auto-daemon --create-frame
   30  08:07  0:28  ./notmuch-emacs-mua --auto-daemon --create-frame
   31  08:08  0:00  ps x
   32  08:08  0:00  h

So. I'm going w/ the suggestion making --auto-daemon imply --create-frame


>
> (actually I already did the 'imply' option (easy, one line in script,
> another in namual), just that testing it gave this thought...
>
> ... therefore I'd rather make ./notmuch-emacs-mua --auto-daemon
> spit an error and exit -- but I can be convinced otherwise :)
>
> Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by default with --client

2015-09-29 Thread Tomi Ollila
On Mon, Sep 28 2015, David Bremner  wrote:

> Tomi Ollila  writes:
>
>
>> if [ -n "$AUTO_DAEMON" -a -z "$CREATE_FRAME" ]; then
>> echo "$0: --auto-daemon is only applicable with --create-frame." >&2
>> exit 1   
>> fi
>>
>> without this one may execute ./notmuch-emacs-mua --client --auto-daemon
>> which yields starting emacs in daemon mode (in this example it is expected
>> emacs is not running; otherwise --auto-daemon has no use in this example)
>> -- but no ui to that newly-running emacs is provided. Similar behaviour
>> can be observed by the following
>>
>
> I think what you propose is fine for a followup patch; note that the
> scenario you worry about also needs --client to be a problem. Apparently
> nothing is uncontroversial here, but if auto-daemon only works with
> create frame, then perhaps the followup would be to have auto-daemon
> imply create-frame

Without --client --auto-daemon is no-op (as it is no-op in case emacs
server is already running). I am (only) concerned about user experience
when one runs --client --auto-daemon and user gets nothing (i.e. emacs
server is running in the background w/o any clients connected to it.

We could make --auto-daemon imply --create-frame, but then 

./notmuch-emacs-mua --auto-daemon (i.e. w/o --client) starts new mail
compose window to separate frame (even though user did not request
it w/ --create-frame)

(actually I already did the 'imply' option (easy, one line in script,
another in namual), just that testing it gave this thought...

... therefore I'd rather make ./notmuch-emacs-mua --auto-daemon
spit an error and exit -- but I can be convinced otherwise :)

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2] nmbug-status: add support for specifying sort order for each view

2015-09-29 Thread Tomi Ollila
On Tue, Sep 29 2015, David Bremner  wrote:

> Jani Nikula  writes:
>
>> Let each view have a "sort" key, typically used with values
>> "oldest-first" or "newest-first" (although all values in Query.SORT
>> are accepted), and sort the results accordingly. Oldest first remains
>> the default.
>
> pushed.

when can we expect nmbug status page update ? :D

>
> d

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] lib: add support for date:..! to mean date:..

2015-09-26 Thread Tomi Ollila
On Sat, Sep 26 2015, David Bremner  wrote:

> Jani Nikula  writes:
>
>> It doesn't seem likely we can support simple date: expanding to
>> date:.. any time soon. (This can be done with a future
>> version of Xapian, or with a custom query query parser.) In the mean
>> time, provide shorthand date:..! to mean the same. This is
>> useful, as the expansion takes place before interpetation, and we can
>> use, for example, date:yesterday..! to match from beginning of
>> yesterday to end of yesterday.
>
> pushed. At some point we probably want a NEWS item.

If it is in the NEWS, it is perpetual, otoh if only in documentation we
could theoretically deprecate and remove it easier in the future ... ;p

> d

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs/Makefile.local: notmuch-lib.elc depend on notmuch-version.elc

2015-09-25 Thread Tomi Ollila
emacs/make-depend.el will compute all other related dependencies
except this one:

notmuch-version is not top-level `require' expression in
notmuc-lib.el[c] but conditional based on the existence of
notmuch-version.el[c].

emacs/make-depend.el does not know now notmuch-version.el[c] becomes
into existence but emacs/Makefile.local does know.
---
 emacs/Makefile.local | 4 
 1 file changed, 4 insertions(+)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 1109cfa6b090..19e184edcbc7 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -52,6 +52,10 @@ $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el 
$(emacs_sources)
 $(dir)/.eldeps.x: $(dir)/.eldeps
@cmp -s $^ $@ || cp $^ $@
 -include $(dir)/.eldeps.x
+
+# Add the one dependency make-deps.el does not have visibility to.
+$(dir)/notmuch-lib.elc: $(dir)/notmuch-version.elc
+
 endif
 CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp $(dir)/.eldeps.x
 
-- 
2.0.0

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] cli: use designated initializer to initialize add_files_state

2015-09-25 Thread Tomi Ollila
On Fri, Sep 25 2015, Jani Nikula  wrote:

> The side effect is that all of add_files_state will be initialized to
> zero, removing any lingering doubt that some of it might not be
> initialized. It's not a small struct, and the initialization is
> scattered around a bit, so this makes the code more readable.

LGTM. Should I test ? ;/

Tomi


> ---
>  notmuch-new.c | 13 +
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/notmuch-new.c b/notmuch-new.c
> index 33645349cd5f..442a2f0ae288 100644
> --- a/notmuch-new.c
> +++ b/notmuch-new.c
> @@ -933,7 +933,11 @@ int
>  notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
>  {
>  notmuch_database_t *notmuch;
> -add_files_state_t add_files_state;
> +add_files_state_t add_files_state = {
> + .verbosity = VERBOSITY_NORMAL,
> + .debug = FALSE,
> + .output_is_a_tty = isatty (fileno (stdout)),
> +};
>  struct timeval tv_start;
>  int ret = 0;
>  struct stat st;
> @@ -948,10 +952,6 @@ notmuch_new_command (notmuch_config_t *config, int argc, 
> char *argv[])
>  notmuch_bool_t quiet = FALSE, verbose = FALSE;
>  notmuch_status_t status;
>  
> -add_files_state.verbosity = VERBOSITY_NORMAL;
> -add_files_state.debug = FALSE;
> -add_files_state.output_is_a_tty = isatty (fileno (stdout));
> -
>  notmuch_opt_desc_t options[] = {
>   { NOTMUCH_OPT_BOOLEAN,  &quiet, "quiet", 'q', 0 },
>   { NOTMUCH_OPT_BOOLEAN,  &verbose, "verbose", 'v', 0 },
> @@ -1086,9 +1086,6 @@ notmuch_new_command (notmuch_config_t *config, int 
> argc, char *argv[])
>  talloc_free (dot_notmuch_path);
>  dot_notmuch_path = NULL;
>  
> -add_files_state.processed_files = 0;
> -add_files_state.added_messages = 0;
> -add_files_state.removed_messages = add_files_state.renamed_messages = 0;
>  gettimeofday (&add_files_state.tv_start, NULL);
>  
>  add_files_state.removed_files = _filename_list_create (config);
> -- 
> 2.1.4
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test suite: don't consider skipped individual tests as failing

2015-09-25 Thread Tomi Ollila
On Fri, Sep 25 2015, David Bremner  wrote:

> Tomi Ollila  writes:
>
>>
>> Looks OK, but I think there should be (some good) comment here informing
>> any potential viewer that we're not checking $skipped...
>>
>
> I put some vaguely threatening comment in test/README, and a brief
> comment in the file. I've merged the commit, but feel free to send
> suggestions / patches for further doc changes. I more or less made up a
> hypothetical future policy on the spot...

ack. earlier today I though of make target test-strict -- let's see
whethere I come up something with that...

>
> d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 6/9] cli: change the data structure for notmuch address deduplication

2015-09-24 Thread Tomi Ollila
On Thu, Sep 24 2015, David Bremner  wrote:

> David Bremner  writes:
>
>> Jani Nikula  writes:
>>
>>
>>> +else
>>> +   v = !!m1->name - !!m2->name;
>>
>> Is this really idiomatic? It seems a little difficult to follow to me.
>>

For me it took a while to grasp the meaning of that but after I spent
a minute looking at it it become clear to me. this part +1


> Sorry, this stupid MUA I'm using confused me and I sent the reply
> halfway through reading the patch. Anyway, the rest looks OK.
>
> d

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test suite: don't consider skipped individual tests as failing

2015-09-24 Thread Tomi Ollila
On Thu, Sep 24 2015, David Bremner  wrote:

> It isn't completely clear what we want to do here, but
>
> 1) We currently don't fail if we skip a whole test file (mainly because
> we neglect to count those skipped tests properly). This change at least
> makes the two kinds of skipping consistent.
>
> 2) Automated build environments may have good reasons for building with
> a minimal set of prereqs, and we don't want to discourage running our
> test suite by breaking builds.
> ---
>  test/aggregate-results.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/aggregate-results.sh b/test/aggregate-results.sh
> index b016edb..b30da44 100755
> --- a/test/aggregate-results.sh
> +++ b/test/aggregate-results.sh
> @@ -82,7 +82,7 @@ if [ "$skipped" != "0" ]; then
>  echo "$skipped $tests skipped."
>  fi
>  

Looks OK, but I think there should be (some good) comment here informing
any potential viewer that we're not checking $skipped...

> -if [ $success -gt 0 -a $fixed -eq 0 -a $failed -eq 0 -a $skipped -eq 0 ]
> +if [ $success -gt 0 -a $fixed -eq 0 -a $failed -eq 0 ]
>  then
>  exit 0
>  else
> -- 
> 2.5.1

Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] make test: NOTMUCH_TEST_QUIET=1 is now the default

2015-09-20 Thread Tomi Ollila
On Sun, Sep 20 2015, David Bremner  wrote:

> Tomi Ollila  writes:
>
>> make test V=1 (or any other value than 0) and make test V=0
>> works similar way as build in general
>> ---
>>
>> This is 2nd try: In first one I changed test-lib.sh -- there problem
>> was the precedence between command line argument and NOTMUCH_TEST_QUIET
>> environment variable. Here I don't see a problem there (although
>> env NOTMUCH_TEST_QUIET=1 make test V=1 will make environment variable
>> overrule the V=1 -- I am not sure who cares, though :D)
>>
>> Anyway, Someone(TM) may have better solution in mind, so let's
>> get bikeshedding going!
>>
>
> One thing I thought of was that we could replace the use of
> NOTMUCH_TEST_QUIET with e.g. NOTMUCH_TEST_VERBOSE, and have that set by
> the command line argument --verbose.  This would be less work on the
> Makefile side, but I guess a bit more on the test-lib.sh side. I suppose
> it might also be an annoyance for some people currently using
> NOTMUCH_TEST_QUIET in some autobuilder setup. At the moment I can't
> think of what would really break by changing this "API", but knows. The
> current behaviour of having NOTMUCH_TEST_QUIET and --verbose completely
> independent is pretty surprising.

There was 2 primary motivations when I did that patch (which I forgot to
mark rfc although I thought doing so) 1) that was the fastest at the time
being and 2) the --verbose is already in use in test-lib.sh. 

First thing that come to my mind is that if (-v|--v[e[r[b[o[s[e]])
option is for the suggested purpose its current behaviour is removed
and when the option is not give user is informed how to activate "verbose"
progress -- but as said that is just first thought...


Making NOTMUCH_TEST_QUIET no-op is probably no annoyance to anyone...

>
> d
>
> P.S. I hope you appreciate my classic "scope-creep" technique in
> bikeshedding. ;)

In test-related issues that is fine by me.


Tomi
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] make test: NOTMUCH_TEST_QUIET=1 is now the default

2015-09-11 Thread Tomi Ollila
make test V=1 (or any other value than 0) and make test V=0
works similar way as build in general
---

This is 2nd try: In first one I changed test-lib.sh -- there problem
was the precedence between command line argument and NOTMUCH_TEST_QUIET
environment variable. Here I don't see a problem there (although
env NOTMUCH_TEST_QUIET=1 make test V=1 will make environment variable
overrule the V=1 -- I am not sure who cares, though :D)

Anyway, Someone(TM) may have better solution in mind, so let's
get bikeshedding going!

 test/Makefile.local | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/test/Makefile.local b/test/Makefile.local
index 2331ceb..2b18691 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -56,7 +56,17 @@ TEST_BINARIES := $(TEST_BINARIES:.cc=)
 test-binaries: $(TEST_BINARIES)
 
 test:  all test-binaries
+ifeq ($V,)
+   @echo 'Use "$(MAKE) V=1" to print test headings and PASSIng results.'
+   @env NOTMUCH_TEST_QUIET=1 ${test_src_dir}/notmuch-test $(OPTIONS)
+else
+# The user has explicitly enabled quiet execution.
+ifeq ($V,0)
+   @env NOTMUCH_TEST_QUIET=1 ${test_src_dir}/notmuch-test $(OPTIONS)
+else
@${test_src_dir}/notmuch-test $(OPTIONS)
+endif
+endif
 
 check: test
 
-- 
2.4.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


<    5   6   7   8   9   10   11   12   13   14   >