Re: Bug: ol-notmuch.el: calls `notmuch-show' with arbitrary search query
Hi, > > Here is my workaround. If this approach seems sensible I can prepare a > patch to `org-notmuch-follow-link` in ol-notmuch.el. Your approach probably works most of the time, but I don't like the idea of having to perform 2 queries when one should be enough. I think a better approach would be to change notmuch-show (or add a new version) that would allow taking arbitrary queries (and especially, message ids) as input. This probably used to be the case. Note that the command line notmuch show function does accept arbitrary search terms as an argument I think updating notmuch-show to compute the thread id from the query (instead of assuming that the input is a thread id) would be the best way to go, but you should see that with the notmuch developers. Best regards Matthieu Lemerre > >(use-package org-notmuch > :init > ;; the default value for `org-notmuch-open-function' is > ;; `org-notmuch-follow-link', but that function is broken: it calls > ;; `notmuch-show' with a search query rather than a thread ID. This > ;; causes `notmuch-show-thread-id' to be populated with a value > ;; which is not a thread ID, which breaks various other things > ;; > ;; so use a custom function instead > (defun spw--org-notmuch-follow-link (search) >(let ((thread-id > (substring >(shell-command-to-string > (combine-and-quote-strings (list "notmuch" "search" > "--output=threads" > "--limit=1" > "--format=text" > "--format-version=4" > search))) >0 -1))) > (notmuch-show thread-id nil nil search search))) > (setq org-notmuch-open-function 'spw--org-notmuch-follow-link)) > > -- > Sean Whitton ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: The archive operation should only archive open messages
- Carl Worth cwo...@cworth.org a écrit : Once we fix that, I think we can go back to having tag operations only affect matched messages in the search view, and I agree that this will be extremely convenient. What about using prefixes to each command, the way Gnus does it*? For instance, 'd' should tag the matched messages, D or all messages in the thread. Same for show mode: for instance 'd' for all matched messages , D for all messages in the thread, and C-d for the current message only. Matthieu * All Gnus key chains that begin with T affect the current thread. ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: please eat my data!
- Jameson Rollins jroll...@finestructure.net a écrit : On Mon, 12 Apr 2010 15:33:35 +0200, Sebastian Spaeth sebast...@sspaeth.de wrote: fsync is really killing xapian (and notmuch). What suffers, are the boolean prefixes (tag, id, and thread). Using libeatmydata (which disables fsync) shows a 10x speedup for tagging. The speedup is only factor 2 for e.g. from: searches. This is ext4 on recent stock Ubuntu. Given that search by tag and thread are performed really often (each time I advance a thread, for example), that really hurts. Wow, this is really interesting, Sebastian. For those of us not in the know, can you explain what libeatmydata is and how it's used? It sounds like something I would *not* want to use! So you didn't have to recompile here, and only had to set LD_PRELOAD=./libeatmydata.so? Is there any drawback to what you're doing here? jamie. It seems like it is a small library that implements fsync as no-op. Using LD_PRELOAD allows to overloads the libc's fsync definition by libeatmydata's one. Making writes faster, but no longer crash-safe. Matthieu ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH] Support for deletion (patch included)
Here they are; as I don't know how to include them in the body, I put the patches as attachments. I hope this will be convienient enough for you. Matthieu - ra...@free.fr a écrit : Carl: The patch in the mail has problems; apparently I have to manually add scissorlines to the mail for it to be processed by git-am. I thought this was automatically added. (I hate the git UI -- nothing is consistent, concepts have different names, the definition of scissor lines is as precise as A line that mainly consists of scissors (either 8 or 8) and perforation (dash -) --, but I guess we can get used to it after a while...) I'll send you a proper patch as soon as I can. Meanwhile, I'm sure you have comments on this updated patch! Matthieu From 0073152e3fa7dd11d88de28e87eec7762cdbbbeb Mon Sep 17 00:00:00 2001 From: Matthieu Lemerre ra...@free.fr Date: Thu, 25 Feb 2010 00:25:51 +0100 Subject: [PATCH 2/2] Add support for deletion in the emacs interface Add d keybinding in notmuch-show and notmuch-summary to delete the current thread. Adds D keybinding to delete the current message in notmuch-show. Adds a deleted folder. Omit deleted items from searchs if no prefix arg. Adds history management to make searching deleted items more convenient. --- notmuch.el | 56 +--- 1 files changed, 49 insertions(+), 7 deletions(-) diff --git a/notmuch.el b/notmuch.el index 5d7342a..0285573 100644 --- a/notmuch.el +++ b/notmuch.el @@ -92,6 +92,8 @@ (define-key map x 'notmuch-show-archive-thread-then-exit) (define-key map A 'notmuch-show-mark-read-then-archive-thread) (define-key map a 'notmuch-show-archive-thread) +(define-key map d 'notmuch-show-delete-thread) +(define-key map D 'notmuch-show-delete-message) (define-key map p 'notmuch-show-previous-message) (define-key map N 'notmuch-show-mark-read-then-next-open-message) (define-key map n 'notmuch-show-next-message) @@ -380,6 +382,23 @@ buffer. (notmuch-show-archive-thread) (kill-this-buffer)) +(defun notmuch-show-delete-message () + Delete current message (sets its deleted tag). + (interactive) + (notmuch-show-add-tag deleted)) + +(defun notmuch-show-delete-thread() + Delete each message in thread. + (interactive) + (notmuch-show-forall-in-thread + (notmuch-show-delete-message))) + +(defun notmuch-show-delete-thread-and-exit() + Delete each message in thread, then exit back to search results. + (interactive) + (notmuch-show-delete-thread) + (kill-this-buffer)) + (defun notmuch-show-mark-read-then-archive-then-exit () Remove unread tags from thread, then archive and exit to search results. (interactive) @@ -1227,6 +1246,7 @@ matching this search term are shown if non-nil. (define-key map [mouse-1] 'notmuch-search-show-thread) (define-key map * 'notmuch-search-operate-all) (define-key map a 'notmuch-search-archive-thread) +(define-key map d 'notmuch-search-delete-thread) (define-key map - 'notmuch-search-remove-tag) (define-key map + 'notmuch-search-add-tag) (define-key map (kbd RET) 'notmuch-search-show-thread) @@ -1235,6 +1255,7 @@ matching this search term are shown if non-nil. (fset 'notmuch-search-mode-map notmuch-search-mode-map) (defvar notmuch-search-query-string) +(defvar notmuch-search-history nil) (defvar notmuch-search-oldest-first t Show the oldest mail first in the search-mode) @@ -1446,6 +1467,13 @@ This function advances the next thread when finished. (notmuch-search-remove-tag inbox) (forward-line)) +(defun notmuch-search-delete-thread () + Mark the currently selected thread as deleted (set its \deleted\ tag). +This function advances the next thread when finished. + (interactive) + (notmuch-search-add-tag deleted) + (forward-line)) + (defun notmuch-search-process-sentinel (proc msg) Add a message to let user know when \notmuch search\ exits (let ((buffer (process-buffer proc)) @@ -1520,10 +1548,22 @@ characters as well as `_.+-'. (append action-split (list notmuch-search-query-string) nil ;;;###autoload -(defun notmuch-search (query optional oldest-first) - Run \notmuch search\ with the given query string and display results. - (interactive sNotmuch search: ) - (let ((buffer (get-buffer-create (concat *notmuch-search- query * +(defun notmuch-search (query optional oldest-first include-deleted) + Run \notmuch search\ with the given query string and display results. + +With prefix argument, include deleted items. + + (interactive (let* ((prefix current-prefix-arg) + (query (if prefix + (read-string Notmuch search (including deleted): + notmuch-search-query-string + 'notmuch-search-history) + (read-string Notmuch search: nil + 'notmuch-search-history + (list query nil prefix))) + (let ((real-query (if include-deleted query + (concat not tag:deleted and ( query + (buffer
Re: [notmuch] [PATCH] Support for deletion (patch included)
Carl: The patch in the mail has problems; apparently I have to manually add scissorlines to the mail for it to be processed by git-am. I thought this was automatically added. (I hate the git UI -- nothing is consistent, concepts have different names, the definition of scissor lines is as precise as A line that mainly consists of scissors (either 8 or 8) and perforation (dash -) --, but I guess we can get used to it after a while...) I'll send you a proper patch as soon as I can. Meanwhile, I'm sure you have comments on this updated patch! Matthieu À: Carl Worth cwo...@cworth.org Cc: notmuch@notmuchmail.org Envoyé: Jeudi 25 Février 2010 00h00:04 GMT +00:00 GMT - Grande-Bretagne, Irlande, Portugal Objet: Re: [notmuch] [PATCH] Support for deletion (patch included) Hi Carl, Could you also write a commit message describing what the patch does? The easiest way for me to apply that would be if you would create a git commit, then run git format-patch origin/master and mail the resulting files, (the git send-email command can be used here, or you can insert the files into a mail-composition buffer and modify them as needed). OK, here it is (comments below). I had trouble splitting the patches into a patch series; I found git add -p, but isn't there a better interface for selecting patches? From bdee9558d93bffb97c80632f522288e059deb7c2 Mon Sep 17 00:00:00 2001 From: Matthieu Lemerre ra...@racin.rez-gif.supelec.fr Date: Thu, 25 Feb 2010 00:24:24 +0100 Subject: [PATCH 1/2] Add and use notmuch-show-forall-in-thread macro --- notmuch.el | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/notmuch.el b/notmuch.el index 6482170..5d7342a 100644 --- a/notmuch.el +++ b/notmuch.el @@ -321,17 +321,22 @@ pseudoheader summary (cons (notmuch-show-get-message-id) nil))) (notmuch-show-set-tags (sort (set-difference tags toremove :test 'string=) 'string)) -(defun notmuch-show-archive-thread-maybe-mark-read (markread) - (save-excursion +(defmacro notmuch-show-forall-in-thread (rest body) + Executes BODY with point in all messages of the current thread. + `(save-excursion (goto-char (point-min)) (while (not (eobp)) - (if markread - (notmuch-show-remove-tag unread inbox) - (notmuch-show-remove-tag inbox)) + ,@body (if (not (eobp)) (forward-char)) (if (not (re-search-forward notmuch-show-message-begin-regexp nil t)) - (goto-char (point-max) + (goto-char (point-max)) + +(defun notmuch-show-archive-thread-maybe-mark-read (markread) + (notmuch-show-forall-in-thread + (if markread + (notmuch-show-remove-tag unread inbox) + (notmuch-show-remove-tag inbox))) (let ((parent-buffer notmuch-show-parent-buffer)) (kill-this-buffer) (if parent-buffer -- 1.6.5 This first patch is helpful for factorizing out code. Basically, it allows to apply a message-only command to all the thread. From 0073152e3fa7dd11d88de28e87eec7762cdbbbeb Mon Sep 17 00:00:00 2001 From: Matthieu Lemerre ra...@racin.rez-gif.supelec.fr Date: Thu, 25 Feb 2010 00:25:51 +0100 Subject: [PATCH 2/2] Add support for deletion in the emacs interface --- notmuch.el | 56 +--- 1 files changed, 49 insertions(+), 7 deletions(-) diff --git a/notmuch.el b/notmuch.el index 5d7342a..0285573 100644 --- a/notmuch.el +++ b/notmuch.el @@ -92,6 +92,8 @@ (define-key map x 'notmuch-show-archive-thread-then-exit) (define-key map A 'notmuch-show-mark-read-then-archive-thread) (define-key map a 'notmuch-show-archive-thread) +(define-key map d 'notmuch-show-delete-thread) +(define-key map D 'notmuch-show-delete-message) (define-key map p 'notmuch-show-previous-message) (define-key map N 'notmuch-show-mark-read-then-next-open-message) (define-key map n 'notmuch-show-next-message) @@ -380,6 +382,23 @@ buffer. (notmuch-show-archive-thread) (kill-this-buffer)) +(defun notmuch-show-delete-message () + Delete current message (sets its deleted tag). + (interactive) + (notmuch-show-add-tag deleted)) + +(defun notmuch-show-delete-thread() + Delete each message in thread. + (interactive) + (notmuch-show-forall-in-thread + (notmuch-show-delete-message))) + +(defun notmuch-show-delete-thread-and-exit() + Delete each message in thread, then exit back to search results. + (interactive) + (notmuch-show-delete-thread) + (kill-this-buffer)) + (defun notmuch-show-mark-read-then-archive-then-exit () Remove unread tags from thread, then archive and exit to search results. (interactive) @@ -1227,6 +1246,7 @@ matching this search term are shown if non-nil. (define-key map [mouse-1] 'notmuch-search-show-thread) (define-key map * 'notmuch-search-operate-all) (define-key map a 'notmuch-search-archive-thread) +(define-key map d 'notmuch-search-delete-thread)
Re: [notmuch] [PATCH] Support for deletion (patch included)
Hi Carl, Could you also write a commit message describing what the patch does? The easiest way for me to apply that would be if you would create a git commit, then run git format-patch origin/master and mail the resulting files, (the git send-email command can be used here, or you can insert the files into a mail-composition buffer and modify them as needed). OK, here it is (comments below). I had trouble splitting the patches into a patch series; I found git add -p, but isn't there a better interface for selecting patches? From bdee9558d93bffb97c80632f522288e059deb7c2 Mon Sep 17 00:00:00 2001 From: Matthieu Lemerre ra...@racin.rez-gif.supelec.fr Date: Thu, 25 Feb 2010 00:24:24 +0100 Subject: [PATCH 1/2] Add and use notmuch-show-forall-in-thread macro --- notmuch.el | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/notmuch.el b/notmuch.el index 6482170..5d7342a 100644 --- a/notmuch.el +++ b/notmuch.el @@ -321,17 +321,22 @@ pseudoheader summary (cons (notmuch-show-get-message-id) nil))) (notmuch-show-set-tags (sort (set-difference tags toremove :test 'string=) 'string)) -(defun notmuch-show-archive-thread-maybe-mark-read (markread) - (save-excursion +(defmacro notmuch-show-forall-in-thread (rest body) + Executes BODY with point in all messages of the current thread. + `(save-excursion (goto-char (point-min)) (while (not (eobp)) - (if markread - (notmuch-show-remove-tag unread inbox) - (notmuch-show-remove-tag inbox)) + ,@body (if (not (eobp)) (forward-char)) (if (not (re-search-forward notmuch-show-message-begin-regexp nil t)) - (goto-char (point-max) + (goto-char (point-max)) + +(defun notmuch-show-archive-thread-maybe-mark-read (markread) + (notmuch-show-forall-in-thread + (if markread + (notmuch-show-remove-tag unread inbox) + (notmuch-show-remove-tag inbox))) (let ((parent-buffer notmuch-show-parent-buffer)) (kill-this-buffer) (if parent-buffer -- 1.6.5 This first patch is helpful for factorizing out code. Basically, it allows to apply a message-only command to all the thread. From 0073152e3fa7dd11d88de28e87eec7762cdbbbeb Mon Sep 17 00:00:00 2001 From: Matthieu Lemerre ra...@racin.rez-gif.supelec.fr Date: Thu, 25 Feb 2010 00:25:51 +0100 Subject: [PATCH 2/2] Add support for deletion in the emacs interface --- notmuch.el | 56 +--- 1 files changed, 49 insertions(+), 7 deletions(-) diff --git a/notmuch.el b/notmuch.el index 5d7342a..0285573 100644 --- a/notmuch.el +++ b/notmuch.el @@ -92,6 +92,8 @@ (define-key map x 'notmuch-show-archive-thread-then-exit) (define-key map A 'notmuch-show-mark-read-then-archive-thread) (define-key map a 'notmuch-show-archive-thread) +(define-key map d 'notmuch-show-delete-thread) +(define-key map D 'notmuch-show-delete-message) (define-key map p 'notmuch-show-previous-message) (define-key map N 'notmuch-show-mark-read-then-next-open-message) (define-key map n 'notmuch-show-next-message) @@ -380,6 +382,23 @@ buffer. (notmuch-show-archive-thread) (kill-this-buffer)) +(defun notmuch-show-delete-message () + Delete current message (sets its deleted tag). + (interactive) + (notmuch-show-add-tag deleted)) + +(defun notmuch-show-delete-thread() + Delete each message in thread. + (interactive) + (notmuch-show-forall-in-thread + (notmuch-show-delete-message))) + +(defun notmuch-show-delete-thread-and-exit() + Delete each message in thread, then exit back to search results. + (interactive) + (notmuch-show-delete-thread) + (kill-this-buffer)) + (defun notmuch-show-mark-read-then-archive-then-exit () Remove unread tags from thread, then archive and exit to search results. (interactive) @@ -1227,6 +1246,7 @@ matching this search term are shown if non-nil. (define-key map [mouse-1] 'notmuch-search-show-thread) (define-key map * 'notmuch-search-operate-all) (define-key map a 'notmuch-search-archive-thread) +(define-key map d 'notmuch-search-delete-thread) (define-key map - 'notmuch-search-remove-tag) (define-key map + 'notmuch-search-add-tag) (define-key map (kbd RET) 'notmuch-search-show-thread) @@ -1235,6 +1255,7 @@ matching this search term are shown if non-nil. (fset 'notmuch-search-mode-map notmuch-search-mode-map) (defvar notmuch-search-query-string) +(defvar notmuch-search-history nil) (defvar notmuch-search-oldest-first t Show the oldest mail first in the search-mode) @@ -1446,6 +1467,13 @@ This function advances the next thread when finished. (notmuch-search-remove-tag inbox) (forward-line)) +(defun notmuch-search-delete-thread () + Mark the currently selected thread as deleted (set its \deleted\ tag). +This function advances the next thread when finished. + (interactive) +
Re: [notmuch] Git ancestry and sync problems (was: Mail in git)
- martin f krafft madd...@madduck.net a écrit : Except I fear that as soon as we allow manipulation of the local store, we'll potentially run into this problem: http://notmuchmail.org/pipermail/notmuch/2010/001114.html id:20100112045152.ga15...@lapse.rw.madduck.net I don't understand the problem. Why not just letting all inbox mails in a regular Maildir, and use git only when they have been explicit archived? This way, mails are added to git only if we want to save them, and we rarely (never?) need to remove mail from the git store. Deleting mail is also much easier to do from the maildir. This mail flow would make much more sense to me. Thanks, Matthieu ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search.
Using a prefix arg to invert search order would conflict with my patch http://notmuchmail.org/pipermail/notmuch/2009/000914.html in which the prefix arg is used to show deleted messages. I don't known which behaviour for prefix patch would be best. Though we can also add toggle keys that toggle search order, or toggle display of deleted messages, which would solve the problem. Matthieu - Mail Original - De: Sebastian Spaeth sebast...@sspaeth.de À: notmuch@notmuchmail.org Envoyé: Jeudi 11 Février 2010 14h05:28 GMT +00:00 GMT - Grande-Bretagne, Irlande, Portugal Objet: Re: [notmuch] notmuch.el: Prefix arg inverts the sort order of notmuch-search. On Thu, 11 Feb 2010 14:01:14 +, David Edmondson d...@dme.org wrote: (let ((proc (start-process-shell-command notmuch-search buffer notmuch-command search (if oldest-first --sort=oldest-first --sort=newest-first) Doh, I should shut up when I haven't actually looked at the code. The only thing to my defense is that looking at elisp makes me feel dizzy. Sorry, Sebastian ___ 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: [notmuch] [PATCH] add notmuch-show-delete keybinding 'd'
Hi Sebastian, I posted a similar patch a while ago, that also did not show deleted messages by default. Don't know if Carl wants to integrate this though Matthieu - Mail Original - De: Sebastian Spaeth sebast...@sspaeth.de À: notmuch notmuch@notmuchmail.org Envoyé: Mercredi 20 Janvier 2010 10h32:10 GMT +00:00 GMT - Grande-Bretagne, Irlande, Portugal Objet: [notmuch] [PATCH] add notmuch-show-delete keybinding 'd' It adds a tag 'delete' and removes the tags 'inbox' and 'unread'. Signed-off-by: Sebastian Spaeth sebast...@sspaeth.de --- notmuch.el |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/notmuch.el b/notmuch.el index 97914f2..ff930c9 100644 --- a/notmuch.el +++ b/notmuch.el @@ -63,6 +63,7 @@ (define-key map m 'message-mail) (define-key map f 'notmuch-show-forward-current) (define-key map r 'notmuch-show-reply) +(define-key map d 'notmuch-show-delete) (define-key map | 'notmuch-show-pipe-message) (define-key map w 'notmuch-show-save-attachments) (define-key map V 'notmuch-show-view-raw-message) @@ -369,6 +370,13 @@ buffer. (let ((message-id (notmuch-show-get-message-id))) (notmuch-reply message-id))) +(defun notmuch-show-delete () + 'delete' current mail and remove 'unread' 'inbox' + (interactive) + (notmuch-show-add-tag delete) + (notmuch-show-remove-tag unread) + (notmuch-show-remove-tag inbox)) + (defun notmuch-show-forward-current () Forward the current message. (interactive) -- 1.6.3.3 ___ 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: [notmuch] Bug with commit 2e96464f9705be4ec772280cad71a6c9d5831e6f
I still confirm the bug. The problem is due to relying on non-standardized fields of directory entries (i.e. d_type), which don't behave the same on reiserfs than on ext2 (I use reiserfs). The following ugly patch solves my problem. diff --git a/notmuch-new.c b/notmuch-new.c index b740ee2..42d9f89 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -359,7 +359,7 @@ add_files_recursive (notmuch_database_t *notmuch, if (! S_ISREG (st.st_mode)) continue; - } else if (entry-d_type != DT_REG) { + } else if (entry-d_type != DT_REG entry-d_type != 0) { continue; } With this patch, mails are added by the database, but some directories also have d_type set to 0 and can slip through. It seems that the only portable way to test for directory types is stat, which is expensive... I don't known what's the best way to go. Matthieu - Mail Original - De: Ali Polatel a...@exherbo.org À: notmuch@notmuchmail.org Envoyé: Mercredi 13 Janvier 2010 11h21:52 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne Objet: Re: [notmuch] Bug with commit 2e96464f9705be4ec772280cad71a6c9d5831e6f Ali Polatel yazmış: ra...@free.fr yazmış: Hello, I just updated notmuch and now notmuch new cannot update my mail anymore... It tells me that there are 700 files found, but tells that there's no new mail. I did a git bisect, which tells me the first bad commit is commit 2e96464f9705be4ec772280cad71a6c9d5831e6f. I did not try to use the new xapian database or to update xapian; maybe this is the problem. I tested with several tools to get mail in the maildir format, including mb2md and getmail, and I always get the problem. Same problem here, I tried upgrading xapian to xapian-core-1.1.3_svn13824, the problem persists. Here's what happens here: 3074 a...@harikalardiyari rm -fr .maildir/.notmuch 3075 a...@harikalardiyari notmuch new Found 210302 total files (that's not much mail). No new mail. 3076 a...@harikalardiyari notmuch search from:a...@exherbo.org 3077 a...@harikalardiyari After doing git bisect which gave random results and testing notmuch using cworth's notmuch-test script on another file system I figured out my problem was due to file system corruption. Sorry for the noise... -- Regards, Ali Polatel ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch patch Description: Binary data ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch