[Vagrant Cascadian] Bug#759646: notmuch-emacs: switching mode= to invalid value sends unencrypted mail

2014-11-29 Thread David Bremner
David Edmondson  writes:

> On Tue, Sep 02 2014, Tomi Ollila wrote:
>> On Tue, Sep 02 2014, Daniel Kahn Gillmor  wrote:
>>
>>> On 08/30/2014 03:37 AM, Jani Nikula wrote:
 I'm inclined to think this is a bug in message-mode. 
>>>
>>> I agree it's a bug in message-mode, not in notmuch itself.
>>
>> I think it might be here:
>>
>> http://bzr.savannah.gnu.org/lh/emacs/emacs-24/annotate/head:/lisp/gnus/mml.el#L258
>>
>> (it takes time to load, please wait...)
>>
>> If cond does not match, then don't fail...
>
> This looks to have been fixed in emacs at the end of September 2014.

Right, this fix was released in emacs 24.4

I'm a little torn what to do here. On the one hand the upstream change
fixes the bug as reported. On the other hand, if something corrupts the
#secure tag (e.g., by deleting a letter), then the message is still sent
un-uncrypted.

d


exim pipe transport, notmuch insert and mbox-style messages

2014-11-29 Thread David Bremner
Edward Betts  writes:

> I don't think the From_ line needs to be captured into an X-Envelope-From
> header.  We could make 'notmuch insert' add the 'Return-path' header to
> messages if it is missing, but the From_ line is present. This is probably too
> much complexity.

I think we're going to solve this problem on the notmuch indexing side
with

id:1416741312-26332-1-git-send-email-jani at nikula.org

This will let us stick to the principle of notmuch not modifying
mail.

d





exim pipe transport, notmuch insert and mbox-style messages

2014-11-29 Thread Edward Betts
David Bremner  wrote:
> Edward Betts  writes:
> > I wonder if 'notmuch insert' could be modified to detect and drop the From_
> > line before writing the message to disk and index it. It could do that
> > silently or with a warning.
> 
> I don't know about the larger question(s), but I'd suggest just escaping
> it to something like X-Envelope-From: . There may even be some
> semi-standard header to use for this.

The main piece of information in the From_ line is the return path address, a
properly configured MTA will add a Return-path header.

RFC 2821 says the Return-path header is added to a message "when the
delivery SMTP server makes the final delivery".

I don't think the From_ line needs to be captured into an X-Envelope-From
header.  We could make 'notmuch insert' add the 'Return-path' header to
messages if it is missing, but the From_ line is present. This is probably too
much complexity.

-- 
Edward.


Re: [PATCH v3] nmbug: Add an 'init' command

2014-11-29 Thread W. Trevor King
On Sat, Nov 29, 2014 at 12:09:17PM -0800, W. Trevor King wrote:
> On Sat, Nov 29, 2014 at 10:40:01AM +0100, Michal Sojka wrote:
> > On Út, říj 28 2014, W. Trevor King wrote:
> > > +_spawn(
> > > +args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
> > > +wait=True)
> > > +_git(args=['config', '--unset', 'core.worktree'], wait=True)
> > > +_git(args=['config', 'core.bare', 'true'], wait=True)
> > 
> > Why do you create a non-bare repository and then make it bare?
> 
> Bare repositories don't usually have upstream tracking branches.  See
> the commit message for c2001674 (nmbug: Add 'clone' and replace
> FETCH_HEAD with @{upstream}, 2014-03-09) for details [1].  I can
> resubmit this patch with a commit message that mentions the
> explanation in c2001674 if folks want the extra clarity here.

Ah, it seems that the lack of remote-tracking branches is unique to
'clone --bare'.  When I compare 'init --bare' with the above (using
Git 2.1.0), the only difference in the resulting repository is that
the the 'init --bare' form doesn't set core.logallrefupdates, while
the form above sets core.logallrefupdates to true.  I'll submit v4
using 'init --bare' and an explicit core.logallrefupdates config.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3] nmbug: Add an 'init' command

2014-11-29 Thread W. Trevor King
On Sat, Nov 29, 2014 at 12:09:17PM -0800, W. Trevor King wrote:
> On Sat, Nov 29, 2014 at 10:40:01AM +0100, Michal Sojka wrote:
> > On ?t, ??j 28 2014, W. Trevor King wrote:
> > > +_spawn(
> > > +args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
> > > +wait=True)
> > > +_git(args=['config', '--unset', 'core.worktree'], wait=True)
> > > +_git(args=['config', 'core.bare', 'true'], wait=True)
> > 
> > Why do you create a non-bare repository and then make it bare?
> 
> Bare repositories don't usually have upstream tracking branches.  See
> the commit message for c2001674 (nmbug: Add 'clone' and replace
> FETCH_HEAD with @{upstream}, 2014-03-09) for details [1].  I can
> resubmit this patch with a commit message that mentions the
> explanation in c2001674 if folks want the extra clarity here.

Ah, it seems that the lack of remote-tracking branches is unique to
'clone --bare'.  When I compare 'init --bare' with the above (using
Git 2.1.0), the only difference in the resulting repository is that
the the 'init --bare' form doesn't set core.logallrefupdates, while
the form above sets core.logallrefupdates to true.  I'll submit v4
using 'init --bare' and an explicit core.logallrefupdates config.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
------ next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20141129/50a1281c/attachment.pgp>


Re: [PATCH v3] nmbug: Add an 'init' command

2014-11-29 Thread W. Trevor King
On Sat, Nov 29, 2014 at 10:40:01AM +0100, Michal Sojka wrote:
> On Út, říj 28 2014, W. Trevor King wrote:
> > +_spawn(
> > +args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
> > +wait=True)
> > +_git(args=['config', '--unset', 'core.worktree'], wait=True)
> > +_git(args=['config', 'core.bare', 'true'], wait=True)
> 
> Why do you create a non-bare repository and then make it bare?

Bare repositories don't usually have upstream tracking branches.  See
the commit message for c2001674 (nmbug: Add 'clone' and replace
FETCH_HEAD with @{upstream}, 2014-03-09) for details [1].  I can
resubmit this patch with a commit message that mentions the
explanation in c2001674 if folks want the extra clarity here.

Cheers,
Trevor

[1]: id:de7dd9d4021cd17350df4423bc13f3da35f2b324.1394410765.git.wk...@tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/17457

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3] nmbug: Add an 'init' command

2014-11-29 Thread W. Trevor King
On Sat, Nov 29, 2014 at 10:40:01AM +0100, Michal Sojka wrote:
> On ?t, ??j 28 2014, W. Trevor King wrote:
> > +_spawn(
> > +args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
> > +wait=True)
> > +_git(args=['config', '--unset', 'core.worktree'], wait=True)
> > +_git(args=['config', 'core.bare', 'true'], wait=True)
> 
> Why do you create a non-bare repository and then make it bare?

Bare repositories don't usually have upstream tracking branches.  See
the commit message for c2001674 (nmbug: Add 'clone' and replace
FETCH_HEAD with @{upstream}, 2014-03-09) for details [1].  I can
resubmit this patch with a commit message that mentions the
explanation in c2001674 if folks want the extra clarity here.

Cheers,
Trevor

[1]: id:de7dd9d4021cd17350df4423bc13f3da35f2b324.1394410765.git.wking at 
tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/17457

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20141129/79b6d535/attachment.pgp>


[PATCH] emacs: Added "is:" style completion to notmuch-read-query.

2014-11-29 Thread Charles Celerier
Just updated the patch to use lexical-let as suggested. I'm not too
familiar with emacs-lisp, so please tell me if you had something else in
mind.

charles

David Bremner  writes:

> David Edmondson  writes:
>
>> On Sat, Nov 29 2014, Charles Celerier wrote:
>
>>
>> Should use a `let' binding rather than `setq'. Otherwise, looks good.
>>
>>>(lexical-let
>>>((completions
>>> (append (list "folder:" "path:" "thread:" "id:" "date:" "f
>
> What about using lexical-let*  to combine the two binding forms?
>
> d
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 480 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20141129/b00b763d/attachment.pgp>


[PATCH v2] emacs: Added "is:" style completion to notmuch-read-query.

2014-11-29 Thread Charles Celerier
The notmuch-search-terms man page states that "tag:" is equivalent
to "is:". Completion for "is:" style searches is now supported
in the Emacs interface.

Signed-off-by: Charles Celerier 
---
 emacs/notmuch.el | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 218486a..d29499c 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -856,12 +856,15 @@ See `notmuch-tag' for information on the format of 
TAG-CHANGES."

 PROMPT is the string to prompt with."
   (lexical-let
+(( all-tags
+(mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
+(process-lines notmuch-command "search" "--output=tags" "*"
+  (let
   ((completions
(append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
  "subject:" "attachment:")
-   (mapcar (lambda (tag)
- (concat "tag:" (notmuch-escape-boolean-term tag)))
-   (process-lines notmuch-command "search" "--output=tags" 
"*")
+   (mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
+   (mapcar (lambda (tag) (concat "is:" tag)) all-tags
 (let ((keymap (copy-keymap minibuffer-local-map))
  (current-query (case major-mode
   (notmuch-search-mode (notmuch-search-get-query))
@@ -884,7 +887,7 @@ PROMPT is the string to prompt with."
   (define-key keymap (kbd "TAB") 'minibuffer-complete)
   (let ((history-delete-duplicates t))
(read-from-minibuffer prompt nil keymap nil
- 'notmuch-search-history current-query nil)
+ 'notmuch-search-history current-query nil))

 (defun notmuch-search-get-query ()
   "Return the current query in this search buffer"
-- 
2.1.2



Re: [Vagrant Cascadian] Bug#759646: notmuch-emacs: switching mode= to invalid value sends unencrypted mail

2014-11-29 Thread David Bremner
David Edmondson  writes:

> On Tue, Sep 02 2014, Tomi Ollila wrote:
>> On Tue, Sep 02 2014, Daniel Kahn Gillmor  wrote:
>>
>>> On 08/30/2014 03:37 AM, Jani Nikula wrote:
 I'm inclined to think this is a bug in message-mode. 
>>>
>>> I agree it's a bug in message-mode, not in notmuch itself.
>>
>> I think it might be here:
>>
>> http://bzr.savannah.gnu.org/lh/emacs/emacs-24/annotate/head:/lisp/gnus/mml.el#L258
>>
>> (it takes time to load, please wait...)
>>
>> If cond does not match, then don't fail...
>
> This looks to have been fixed in emacs at the end of September 2014.

Right, this fix was released in emacs 24.4

I'm a little torn what to do here. On the one hand the upstream change
fixes the bug as reported. On the other hand, if something corrupts the
#secure tag (e.g., by deleting a letter), then the message is still sent
un-uncrypted.

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


[PATCH v3] nmbug: Add an 'init' command

2014-11-29 Thread Michal Sojka
Hi Trevor,

On ?t, ??j 28 2014, W. Trevor King wrote:
> For folks that want to start versioning a new tag-space, instead of
> cloning one that someone else has already started.
>
> The empty-blob hash-object call avoids errors like:
>
>   $ nmbug commit
>   error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for
> 'tags/...'
>   fatal: git-write-tree: error building trees
>   'git HASH(0x9ef3eb8) write-tree' exited with nonzero value
>
> David Bremner suggested [1]:
>
>   $ git hash-object -w /dev/null
>
> instead of my Python version of:
>
>   $ git hash-object -w --stdin <&-
>
> but I expect that closing stdin is more portable than the /dev/null
> path (which doesn't exist on Windows, for example).
>
> [1]: id:87y4vu6uvf.fsf at maritornes.cs.unb.ca
>  http://thread.gmane.org/gmane.mail.notmuch.general/18626/focus=18720
> ---
> The only change since v2 [1] is a commit-message tweak:
>
> * Mention Windows as an OS with stdin but no /dev/null [2].
>
> Cheers,
> Trevor
>
> [1]: id:eaa9cf1cb3c00c591dc675c0f314ca31909ff74c.1412965476.git.wking at 
> tremily.us
>  http://thread.gmane.org/gmane.mail.notmuch.general/19289
> [2]: id:20141011071000.GB10926 at odin.tremily.us
>  http://article.gmane.org/gmane.mail.notmuch.general/19294
>
>  devel/nmbug/nmbug | 24 
>  1 file changed, 24 insertions(+)
>
> diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
> index 9402ead..23bac5c 100755
> --- a/devel/nmbug/nmbug
> +++ b/devel/nmbug/nmbug
> @@ -373,6 +373,29 @@ def fetch(remote=None):
>  _git(args=args, wait=True)
>  
>  
> +def init(remote=None):
> +"""
> +Create an empty nmbug repository.
> +
> +This wraps 'git init' with a few extra steps to support subsequent
> +status and commit commands.
> +"""
> +with _tempfile.TemporaryDirectory(prefix='nmbug-init.') as workdir:
> +_spawn(
> +args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
> +wait=True)
> +_git(args=['config', '--unset', 'core.worktree'], wait=True)
> +_git(args=['config', 'core.bare', 'true'], wait=True)

Why do you create a non-bare repository and then make it bare? Before I
discovered this patch, I created the nmbug repository by hand and it was
possible to do it with bare repo from beginning. The following code
seems to work and is a bit simpler:

def init(remote=None):
"""
Create an empty nmbug repository.

This wraps 'git init' with a few extra steps to support subsequent
status and commit commands.
"""
_spawn(
args=['git', '--git-dir', NMBGIT, 'init', '--bare'],
wait=True)
# create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
_git(args=['hash-object', '-w', '--stdin'], input='', wait=True)
_git(
args=[
'commit', '--allow-empty', '-m', 'Start a new nmbug repository'
],
additional_env={'GIT_WORK_TREE': NMBGIT},
wait=True)

Note that in the initial commit I set the work tree to NMBGIT. This is
because 'git commit' needs some work tree, but in our case it doesn't
matter which one because the commit is empty.

-Michal


> +# create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
> +_git(args=['hash-object', '-w', '--stdin'], input='', wait=True)
> +_git(
> +args=[
> +'commit', '--allow-empty', '-m', 'Start a new nmbug 
> repository'
> +],
> +additional_env={'GIT_WORK_TREE': workdir},
> +wait=True)
> +
> +
>  def checkout():
>  """
>  Update the notmuch database from Git.
> @@ -703,6 +726,7 @@ if __name__ == '__main__':
>  'clone',
>  'commit',
>  'fetch',
> +'init',
>  'log',
>  'merge',
>  'pull',
> -- 
> 2.1.0.60.g85f0837
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Added "is:" style completion to notmuch-read-query.

2014-11-29 Thread David Bremner
David Edmondson  writes:

> On Sat, Nov 29 2014, Charles Celerier wrote:

>
> Should use a `let' binding rather than `setq'. Otherwise, looks good.
>
>>(lexical-let
>>((completions
>>  (append (list "folder:" "path:" "thread:" "id:" "date:" "f

What about using lexical-let*  to combine the two binding forms?

d


Re: [PATCH] emacs: Added "is:" style completion to notmuch-read-query.

2014-11-29 Thread Charles Celerier
Just updated the patch to use lexical-let as suggested. I'm not too
familiar with emacs-lisp, so please tell me if you had something else in
mind.

charles

David Bremner  writes:

> David Edmondson  writes:
>
>> On Sat, Nov 29 2014, Charles Celerier wrote:
>
>>
>> Should use a `let' binding rather than `setq'. Otherwise, looks good.
>>
>>>(lexical-let
>>>((completions
>>> (append (list "folder:" "path:" "thread:" "id:" "date:" "f
>
> What about using lexical-let*  to combine the two binding forms?
>
> d


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2] emacs: Added "is:" style completion to notmuch-read-query.

2014-11-29 Thread Charles Celerier
The notmuch-search-terms man page states that "tag:" is equivalent
to "is:". Completion for "is:" style searches is now supported
in the Emacs interface.

Signed-off-by: Charles Celerier 
---
 emacs/notmuch.el | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 218486a..d29499c 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -856,12 +856,15 @@ See `notmuch-tag' for information on the format of 
TAG-CHANGES."
 
 PROMPT is the string to prompt with."
   (lexical-let
+(( all-tags
+(mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
+(process-lines notmuch-command "search" "--output=tags" "*"
+  (let
   ((completions
(append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
  "subject:" "attachment:")
-   (mapcar (lambda (tag)
- (concat "tag:" (notmuch-escape-boolean-term tag)))
-   (process-lines notmuch-command "search" "--output=tags" 
"*")
+   (mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
+   (mapcar (lambda (tag) (concat "is:" tag)) all-tags
 (let ((keymap (copy-keymap minibuffer-local-map))
  (current-query (case major-mode
   (notmuch-search-mode (notmuch-search-get-query))
@@ -884,7 +887,7 @@ PROMPT is the string to prompt with."
   (define-key keymap (kbd "TAB") 'minibuffer-complete)
   (let ((history-delete-duplicates t))
(read-from-minibuffer prompt nil keymap nil
- 'notmuch-search-history current-query nil)
+ 'notmuch-search-history current-query nil))
 
 (defun notmuch-search-get-query ()
   "Return the current query in this search buffer"
-- 
2.1.2

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


Forwarding a mail, with a non-ASCII signature

2014-11-29 Thread David Bremner
Lele Gaifax  writes:
>>
>
> Thanks a lot, waiting to see it landing on the MELPA archive.
>
> ciao, lele.

Just be aware that people have had problems in the past using versions
from MELPA because they ship only the elisp and not the corresponding C
code.  Hopefully it works better now, or at least detects dangerous
version mismatches between the elisp and C code.

d


[PATCH] emacs: Added "is:" style completion to notmuch-read-query.

2014-11-29 Thread David Edmondson
On Sat, Nov 29 2014, Charles Celerier wrote:
> The notmuch-search-terms man page states that "tag:" is equivalent
> to "is:". Completion for "is:" style searches is now supported
> in the Emacs interface.
>
> Signed-off-by: Charles Celerier 
> ---
>  emacs/notmuch.el | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 218486a..e4b77c7 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -855,13 +855,15 @@ See `notmuch-tag' for information on the format of 
> TAG-CHANGES."
>"Read a notmuch-query from the minibuffer with completion.
>  
>  PROMPT is the string to prompt with."
> +  (setq all-tags
> +(mapcar (lambda (tag) (notmuch-escape-boolean-term tag))
> +(process-lines notmuch-command "search"
>  "--output=tags" "*")))

Should use a `let' binding rather than `setq'. Otherwise, looks good.

>(lexical-let
>((completions
>   (append (list "folder:" "path:" "thread:" "id:" "date:" "from:" "to:"
> "subject:" "attachment:")
> - (mapcar (lambda (tag)
> -   (concat "tag:" (notmuch-escape-boolean-term tag)))
> - (process-lines notmuch-command "search" "--output=tags" 
> "*")
> + (mapcar (lambda (tag) (concat "tag:" tag)) all-tags)
> + (mapcar (lambda (tag) (concat "is:" tag)) all-tags
>  (let ((keymap (copy-keymap minibuffer-local-map))
> (current-query (case major-mode
>  (notmuch-search-mode (notmuch-search-get-query))
> -- 
> 2.1.2
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Re: exim pipe transport, notmuch insert and mbox-style messages

2014-11-29 Thread David Bremner
Edward Betts  writes:

> I don't think the From_ line needs to be captured into an X-Envelope-From
> header.  We could make 'notmuch insert' add the 'Return-path' header to
> messages if it is missing, but the From_ line is present. This is probably too
> much complexity.

I think we're going to solve this problem on the notmuch indexing side
with

id:1416741312-26332-1-git-send-email-j...@nikula.org

This will let us stick to the principle of notmuch not modifying
mail.

d



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


Re: exim pipe transport, notmuch insert and mbox-style messages

2014-11-29 Thread Edward Betts
David Bremner  wrote:
> Edward Betts  writes:
> > I wonder if 'notmuch insert' could be modified to detect and drop the From_
> > line before writing the message to disk and index it. It could do that
> > silently or with a warning.
> 
> I don't know about the larger question(s), but I'd suggest just escaping
> it to something like X-Envelope-From: . There may even be some
> semi-standard header to use for this.

The main piece of information in the From_ line is the return path address, a
properly configured MTA will add a Return-path header.

RFC 2821 says the Return-path header is added to a message "when the
delivery SMTP server makes the final delivery".

I don't think the From_ line needs to be captured into an X-Envelope-From
header.  We could make 'notmuch insert' add the 'Return-path' header to
messages if it is missing, but the From_ line is present. This is probably too
much complexity.

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


Re: [PATCH v3] nmbug: Add an 'init' command

2014-11-29 Thread Michal Sojka
Hi Trevor,

On Út, říj 28 2014, W. Trevor King wrote:
> For folks that want to start versioning a new tag-space, instead of
> cloning one that someone else has already started.
>
> The empty-blob hash-object call avoids errors like:
>
>   $ nmbug commit
>   error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for
> 'tags/...'
>   fatal: git-write-tree: error building trees
>   'git HASH(0x9ef3eb8) write-tree' exited with nonzero value
>
> David Bremner suggested [1]:
>
>   $ git hash-object -w /dev/null
>
> instead of my Python version of:
>
>   $ git hash-object -w --stdin <&-
>
> but I expect that closing stdin is more portable than the /dev/null
> path (which doesn't exist on Windows, for example).
>
> [1]: id:87y4vu6uvf@maritornes.cs.unb.ca
>  http://thread.gmane.org/gmane.mail.notmuch.general/18626/focus=18720
> ---
> The only change since v2 [1] is a commit-message tweak:
>
> * Mention Windows as an OS with stdin but no /dev/null [2].
>
> Cheers,
> Trevor
>
> [1]: 
> id:eaa9cf1cb3c00c591dc675c0f314ca31909ff74c.1412965476.git.wk...@tremily.us
>  http://thread.gmane.org/gmane.mail.notmuch.general/19289
> [2]: id:20141011071000.gb10...@odin.tremily.us
>  http://article.gmane.org/gmane.mail.notmuch.general/19294
>
>  devel/nmbug/nmbug | 24 
>  1 file changed, 24 insertions(+)
>
> diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
> index 9402ead..23bac5c 100755
> --- a/devel/nmbug/nmbug
> +++ b/devel/nmbug/nmbug
> @@ -373,6 +373,29 @@ def fetch(remote=None):
>  _git(args=args, wait=True)
>  
>  
> +def init(remote=None):
> +"""
> +Create an empty nmbug repository.
> +
> +This wraps 'git init' with a few extra steps to support subsequent
> +status and commit commands.
> +"""
> +with _tempfile.TemporaryDirectory(prefix='nmbug-init.') as workdir:
> +_spawn(
> +args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
> +wait=True)
> +_git(args=['config', '--unset', 'core.worktree'], wait=True)
> +_git(args=['config', 'core.bare', 'true'], wait=True)

Why do you create a non-bare repository and then make it bare? Before I
discovered this patch, I created the nmbug repository by hand and it was
possible to do it with bare repo from beginning. The following code
seems to work and is a bit simpler:

def init(remote=None):
"""
Create an empty nmbug repository.

This wraps 'git init' with a few extra steps to support subsequent
status and commit commands.
"""
_spawn(
args=['git', '--git-dir', NMBGIT, 'init', '--bare'],
wait=True)
# create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
_git(args=['hash-object', '-w', '--stdin'], input='', wait=True)
_git(
args=[
'commit', '--allow-empty', '-m', 'Start a new nmbug repository'
],
additional_env={'GIT_WORK_TREE': NMBGIT},
wait=True)

Note that in the initial commit I set the work tree to NMBGIT. This is
because 'git commit' needs some work tree, but in our case it doesn't
matter which one because the commit is empty.

-Michal


> +# create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
> +_git(args=['hash-object', '-w', '--stdin'], input='', wait=True)
> +_git(
> +args=[
> +'commit', '--allow-empty', '-m', 'Start a new nmbug 
> repository'
> +],
> +additional_env={'GIT_WORK_TREE': workdir},
> +wait=True)
> +
> +
>  def checkout():
>  """
>  Update the notmuch database from Git.
> @@ -703,6 +726,7 @@ if __name__ == '__main__':
>  'clone',
>  'commit',
>  'fetch',
> +'init',
>  'log',
>  'merge',
>  'pull',
> -- 
> 2.1.0.60.g85f0837
>
> ___
> 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: Added "is:" style completion to notmuch-read-query.

2014-11-29 Thread David Bremner
David Edmondson  writes:

> On Sat, Nov 29 2014, Charles Celerier wrote:

>
> Should use a `let' binding rather than `setq'. Otherwise, looks good.
>
>>(lexical-let
>>((completions
>>  (append (list "folder:" "path:" "thread:" "id:" "date:" "f

What about using lexical-let*  to combine the two binding forms?

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