unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [Sebastian Spaeth] Pull requests
@ 2010-03-01 14:57 Sebastian Spaeth
  2010-03-26  2:50 ` micah anderson
  2010-04-07 21:22 ` Carl Worth
  0 siblings, 2 replies; 10+ messages in thread
From: Sebastian Spaeth @ 2010-03-01 14:57 UTC (permalink / raw)
  To: Notmuch development list

[-- Attachment #1: Type: text/plain, Size: 88 bytes --]

Resending as this did not get through the list somehow. Sorry, if it
pops up twice now


[-- Attachment #2: Type: message/rfc822, Size: 2391 bytes --]

From: Sebastian Spaeth <Sebastian@SSpaeth.de>
To: Carl Worth <cworth@cworth.org>, Notmuch development list <notmuch@notmuchmail.org>
Date: Mon, 01 Mar 2010 15:13:31 +0100

From git repository git://github.com/spaetz/notmuch-all-feature.git I
would like to advocate the following branches for quick pulling. Each
contains 1 or 2 patches. They have all been based on todays
cworth/master, so it should be really painless.

I divided them into 3 'trivial' branches which should not require
lots of discussion and 3 'proposed' which I would really encourage to pull
as they improve my user experience.

TRIVIAL
=======
issue12_fontify-date

  Very trivial and obvious oversight. Make the date the same color as the
  rest of the headers.
  id:874omet1su.fsf@servo.finestructure.net

issue18-F-for-notmuch-folder

  Bind 'F' to get us to notmuch-folder from notmuch-search
  mail id:1265889583-25406-1-git-send-email-dme@dme.org

  
issue19-notmuch-buffer-use-subject

  Rather than using the ugly thread id as buffer name, use a nicer
  description based on the subject.
  mail id:m1wryiayhg.fsf@watt.gilman.jhu.edu

PROPOSED
========
The following patches are some that really improve my life..

issue17-colorize-lines

  Let us display thread lines colored based on (configurable) tag-color pairs  
  mail id:87aavpb3wh.fsf@servo.finestructure.net

issue20,22-citations

  Show first and last few lines of a citation, not only the first few
  lines. Show citations colorized.
  based on mail id:1266226909-19360-1-git-send-email-dme@dme.org
  and mail id:1266403911-16567-1-git-send-email-dme@dme.org

issue21-tag-by-thread-or-region

  Allow to tag multiple threads by selecting a region. This one is
  really, really handy.
  mail id:87sk90ragj.fsf@jhu.edu

POSSIBLY
========
issue8-maildirtag-import

  This is the "respect maildir" patch (with contributions from various
  people). As there is a similar patch from pioto, this might require
  some discussion before pulling.
  based on thread mail id:20100210031339.GH16686@mail.rocksoft.com

Thanks for considering.

Sebastian

P.S. I reworked my feature-all branch to contain above topic branches
and merging those branches into feature-all. This will hopefully allow
easier rebasing if patches bit-rot. The downside is that I killed the
history of that git repository. Please do a clean repull if you already
have it.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Sebastian Spaeth] Pull requests
  2010-03-01 14:57 [Sebastian Spaeth] Pull requests Sebastian Spaeth
@ 2010-03-26  2:50 ` micah anderson
  2010-03-27 23:30   ` Sebastian Spaeth
  2010-04-07 21:25   ` Carl Worth
  2010-04-07 21:22 ` Carl Worth
  1 sibling, 2 replies; 10+ messages in thread
From: micah anderson @ 2010-03-26  2:50 UTC (permalink / raw)
  To: Sebastian Spaeth, Notmuch development list

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

On Mon, 01 Mar 2010 15:57:00 +0100, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:

> From git repository git://github.com/spaetz/notmuch-all-feature.git I
> would like to advocate the following branches for quick pulling. Each
> contains 1 or 2 patches. They have all been based on todays
> cworth/master, so it should be really painless.

Thanks for pulling these all together! All the ones that you propose I
also use and would really like these to be merged as well.

The only other patch that I find absolutely crucial, that you do not
include, is the 'Preserve folder information when indexing' patch which,
although not perfect, does significantly change my life. 

micah

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Sebastian Spaeth] Pull requests
  2010-03-26  2:50 ` micah anderson
@ 2010-03-27 23:30   ` Sebastian Spaeth
  2010-04-07  5:15     ` micah anderson
  2010-04-07 21:25   ` Carl Worth
  1 sibling, 1 reply; 10+ messages in thread
From: Sebastian Spaeth @ 2010-03-27 23:30 UTC (permalink / raw)
  To: micah anderson, Notmuch development list

On Thu, 25 Mar 2010 22:50:52 -0400, micah anderson <micah@riseup.net> wrote:
> On Mon, 01 Mar 2010 15:57:00 +0100, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> 
> > From git repository git://github.com/spaetz/notmuch-all-feature.git I
> > would like to advocate the following branches for quick pulling. Each
> > contains 1 or 2 patches. They have all been based on todays
> > cworth/master, so it should be really painless.
> 
> Thanks for pulling these all together! All the ones that you propose I
> also use and would really like these to be merged as well.
> 
> The only other patch that I find absolutely crucial, that you do not
> include, is the 'Preserve folder information when indexing' patch which,
> although not perfect, does significantly change my life. 

Glad you find it useful. Yes, having the folder information would indeed
be nice. Is that patch working well for you? (Can you point me to the
mail ID of the patch you are using? There have been several versions
around).

Sebastian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Sebastian Spaeth] Pull requests
  2010-03-27 23:30   ` Sebastian Spaeth
@ 2010-04-07  5:15     ` micah anderson
  2010-04-07 10:01       ` Sebastian Spaeth
  2010-04-08 13:20       ` Michal Sojka
  0 siblings, 2 replies; 10+ messages in thread
From: micah anderson @ 2010-04-07  5:15 UTC (permalink / raw)
  To: Sebastian Spaeth, Notmuch development list


[-- Attachment #1.1: Type: text/plain, Size: 1487 bytes --]

On 2010-03-27, micah anderson wrote:
> On Thu, 25 Mar 2010 22:50:52 -0400, micah anderson <micah@riseup.net> wrote:
> > On Mon, 01 Mar 2010 15:57:00 +0100, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> > 
> > > From git repository git://github.com/spaetz/notmuch-all-feature.git I
> > > would like to advocate the following branches for quick pulling. Each
> > > contains 1 or 2 patches. They have all been based on todays
> > > cworth/master, so it should be really painless.
> > 
> > Thanks for pulling these all together! All the ones that you propose I
> > also use and would really like these to be merged as well.
> > 
> > The only other patch that I find absolutely crucial, that you do not
> > include, is the 'Preserve folder information when indexing' patch which,
> > although not perfect, does significantly change my life. 
> 
> Glad you find it useful. Yes, having the folder information would indeed
> be nice. Is that patch working well for you? (Can you point me to the
> mail ID of the patch you are using? There have been several versions
> around).

The patch works really well for me. I also had difficulty figuring out
which was the latest. The thread is
thread:4ca0710d708e648c214ba3a67469f5bd, and the Message-ID is:
1265122868-12133-1-git-send-email-sojkam1@fel.cvut.cz

I had to rebase the patch to get it to apply with the other features
that you have in your branch. I'm attaching that rebased patch to this
message.





[-- Attachment #1.2: Type: application/pgp-signature, Size: 835 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: folder.diff --]
[-- Type: text/x-diff, Size: 4412 bytes --]

commit 91e11a2a406683f1f80e19334da8124a25ec89fe
Author: Micah Anderson <micah@riseup.net>
Date:   Thu Mar 25 23:07:10 2010 -0400

    add folder patch, rebased

diff --git a/lib/database.cc b/lib/database.cc
index c91e97c..6364623 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -84,9 +84,9 @@ typedef struct {
  *	MESSAGE_ID:	The unique ID of the mail mess (see "id" above)
  *
  * In addition, terms from the content of the message are added with
- * "from", "to", "attachment", and "subject" prefixes for use by the
- * user in searching. But the database doesn't really care itself
- * about any of these.
+ * "from", "to", "attachment", "subject" and "folder" prefixes for use
+ * by the user in searching. But the database doesn't really care
+ * itself about any of these.
  *
  * The data portion of a mail document is empty.
  *
@@ -155,7 +155,8 @@ prefix_t PROBABILISTIC_PREFIX[]= {
     { "from",			"XFROM" },
     { "to",			"XTO" },
     { "attachment",		"XATTACHMENT" },
-    { "subject",		"XSUBJECT"}
+    { "subject",		"XSUBJECT"},
+    { "folder", 		"XFOLDER"}
 };
 
 int
@@ -1362,6 +1363,7 @@ _notmuch_database_link_message (notmuch_database_t *notmuch,
 notmuch_status_t
 notmuch_database_add_message (notmuch_database_t *notmuch,
 			      const char *filename,
+			      const char *folder_name,
 			      notmuch_message_t **message_ret)
 {
     notmuch_message_file_t *message_file;
@@ -1477,6 +1479,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
 	    date = notmuch_message_file_get_header (message_file, "date");
 	    _notmuch_message_set_date (message, date);
 
+	    if (folder_name != NULL)
+		_notmuch_message_gen_terms (message, "folder", folder_name);
+
 	    _notmuch_message_index_file (message, filename);
 	} else {
 	    ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 0d9cb0f..e475072 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -263,6 +263,7 @@ notmuch_database_get_directory (notmuch_database_t *database,
 notmuch_status_t
 notmuch_database_add_message (notmuch_database_t *database,
 			      const char *filename,
+			      const char *folder_name,
 			      notmuch_message_t **message);
 
 /* Remove a message from the given notmuch database.
diff --git a/notmuch-new.c b/notmuch-new.c
index 93da1d7..394d76c 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -21,6 +21,7 @@
 #include "notmuch-client.h"
 
 #include <unistd.h>
+#include <glib.h>
 
 typedef struct _filename_node {
     char *filename;
@@ -224,6 +225,35 @@ derive_tags_from_maildir_flags (notmuch_message_t *message,
     }
 }
 
+static char*
+_get_folder_base_name(const char *path)
+{
+    gchar *full_folder_name = NULL;
+    gchar *folder_base_name = NULL;
+
+    /* Find name of "folder" containing the email. */
+    full_folder_name = g_strdup(path);
+    while (1) {
+	folder_base_name = g_path_get_basename(full_folder_name);
+
+	if (strcmp(folder_base_name, "cur") == 0
+	    || strcmp(folder_base_name, "new") == 0) {
+	    gchar *parent_name = g_path_get_dirname(full_folder_name);
+	    g_free(full_folder_name);
+	    full_folder_name = parent_name;
+	} else
+	    break;
+    }
+
+    g_free(full_folder_name);
+
+    if (strcmp(folder_base_name, ".") == 0) {
+	g_free(folder_base_name);
+	folder_base_name = NULL;
+    }
+    return folder_base_name;
+}
+
 /* Examine 'path' recursively as follows:
  *
  *   o Ask the filesystem for the mtime of 'path' (fs_mtime)
@@ -277,6 +307,7 @@ add_files_recursive (notmuch_database_t *notmuch,
     notmuch_filenames_t *db_subdirs = NULL;
     struct stat st;
     notmuch_bool_t is_maildir, new_directory;
+    char *folder_base_name = NULL;
 
     if (stat (path, &st)) {
 	fprintf (stderr, "Error reading directory %s: %s\n",
@@ -464,7 +495,10 @@ add_files_recursive (notmuch_database_t *notmuch,
 	    fflush (stdout);
 	}
 
-	status = notmuch_database_add_message (notmuch, next, &message);
+	folder_base_name = _get_folder_base_name(path);
+	status = notmuch_database_add_message (notmuch, next,
+					       folder_base_name,
+					       &message);
 	switch (status) {
 	/* success */
 	case NOTMUCH_STATUS_SUCCESS:
@@ -561,6 +595,8 @@ add_files_recursive (notmuch_database_t *notmuch,
 	notmuch_filenames_destroy (db_files);
     if (directory)
 	notmuch_directory_destroy (directory);
+    if (folder_base_name)
+	g_free(folder_base_name);
 
     return ret;
 }

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Sebastian Spaeth] Pull requests
  2010-04-07  5:15     ` micah anderson
@ 2010-04-07 10:01       ` Sebastian Spaeth
  2010-04-08 13:20       ` Michal Sojka
  1 sibling, 0 replies; 10+ messages in thread
From: Sebastian Spaeth @ 2010-04-07 10:01 UTC (permalink / raw)
  To: micah anderson, Notmuch development list

On 2010-04-07, micah anderson wrote:
> > > The only other patch that I find absolutely crucial, that you do not
> > > include, is the 'Preserve folder information when indexing' patch which,
> > > although not perfect, does significantly change my life. 

This patch in included in my branch now. There is a branch with just
that patch over cworth/master in
http://github.com/spaetz/notmuch-all-feature/tree/issue28-search-folder-name

However, testing this, it does not seem to work for me:
I dumped and restored all mails, redoing my database and
notmuch count folder:inbox shows 2 messages that contain "folder:" in
their body. weird. I'll investigate.

Sebastian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Sebastian Spaeth] Pull requests
  2010-03-01 14:57 [Sebastian Spaeth] Pull requests Sebastian Spaeth
  2010-03-26  2:50 ` micah anderson
@ 2010-04-07 21:22 ` Carl Worth
  1 sibling, 0 replies; 10+ messages in thread
From: Carl Worth @ 2010-04-07 21:22 UTC (permalink / raw)
  To: Sebastian Spaeth, Notmuch development list

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

On Mon, 01 Mar 2010 15:57:00 +0100, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> >From git repository git://github.com/spaetz/notmuch-all-feature.git I
> would like to advocate the following branches for quick pulling. Each
> contains 1 or 2 patches. They have all been based on todays
> cworth/master, so it should be really painless.

Thanks Sebastian, both for pulling these together and mentioning them
here.

I've now gone through everything in this list and either merged the
patch or asked for further work, (and in either case I've replied to
one of the original messages proposing the patch).

Keep up the good work!

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Sebastian Spaeth] Pull requests
  2010-03-26  2:50 ` micah anderson
  2010-03-27 23:30   ` Sebastian Spaeth
@ 2010-04-07 21:25   ` Carl Worth
  1 sibling, 0 replies; 10+ messages in thread
From: Carl Worth @ 2010-04-07 21:25 UTC (permalink / raw)
  To: micah anderson, Sebastian Spaeth, Notmuch development list

[-- Attachment #1: Type: text/plain, Size: 644 bytes --]

On Thu, 25 Mar 2010 22:50:52 -0400, micah anderson <micah@riseup.net> wrote:
> The only other patch that I find absolutely crucial, that you do not
> include, is the 'Preserve folder information when indexing' patch which,
> although not perfect, does significantly change my life. 

This, (along with "allow mailing-list headers to be indexed"), is near
the top of my mental todo list for notmuch. The trick with these is to
smoothly do the re-indexing for people that aren't building an index
From scratch, (or providing a "notmuch upgrade" command to do that when
convenient or so). I'll have to give that some thought.

-Carl


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Sebastian Spaeth] Pull requests
  2010-04-07  5:15     ` micah anderson
  2010-04-07 10:01       ` Sebastian Spaeth
@ 2010-04-08 13:20       ` Michal Sojka
  2010-04-09  7:30         ` Sebastian Spaeth
  1 sibling, 1 reply; 10+ messages in thread
From: Michal Sojka @ 2010-04-08 13:20 UTC (permalink / raw)
  To: micah anderson, Sebastian Spaeth, Notmuch development list

On Wed, 07 Apr 2010, micah anderson wrote:
> On 2010-03-27, micah anderson wrote:
> > On Thu, 25 Mar 2010 22:50:52 -0400, micah anderson <micah@riseup.net> wrote:
> > > On Mon, 01 Mar 2010 15:57:00 +0100, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> > > 
> > > > From git repository git://github.com/spaetz/notmuch-all-feature.git I
> > > > would like to advocate the following branches for quick pulling. Each
> > > > contains 1 or 2 patches. They have all been based on todays
> > > > cworth/master, so it should be really painless.
> > > 
> > > Thanks for pulling these all together! All the ones that you propose I
> > > also use and would really like these to be merged as well.
> > > 
> > > The only other patch that I find absolutely crucial, that you do not
> > > include, is the 'Preserve folder information when indexing' patch which,
> > > although not perfect, does significantly change my life. 
> > 
> > Glad you find it useful. Yes, having the folder information would indeed
> > be nice. Is that patch working well for you? (Can you point me to the
> > mail ID of the patch you are using? There have been several versions
> > around).
> 
> The patch works really well for me. I also had difficulty figuring out
> which was the latest.

I think that the patch you sent was not the latest version. The latest
is in id:1265122868-12133-1-git-send-email-sojkam1@fel.cvut.cz, but it
is not rebased to the current master.

I do not use this patch right now, since I didn't find time to apply it
on top of my mailstore abstraction patches. What I remember from when I
used it is, that it was really problematic with mail sent by me to
mailing lists. There were two version of the message - one in sent
folder and one in list folder - and the "folder tag" was not assigned
deterministically.

I think that now I know how to implement this correctly, I only need
some time. Also, the problem is very similar to synchronization of
maildir flags to multiple files, which is what I'm solving right now. So
probably, after I finish maildir flag synchronization I can work on this
patch.

-Michal

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Sebastian Spaeth] Pull requests
  2010-04-08 13:20       ` Michal Sojka
@ 2010-04-09  7:30         ` Sebastian Spaeth
  2010-04-09  7:49           ` Michal Sojka
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Spaeth @ 2010-04-09  7:30 UTC (permalink / raw)
  To: Michal Sojka, micah anderson, Notmuch development list

On 2010-04-08, Michal Sojka wrote:
> I think that the patch you sent was not the latest version. The latest
> is in id:1265122868-12133-1-git-send-email-sojkam1@fel.cvut.cz, but it
> is not rebased to the current master.

Not sure what I am doing wrong, but with this patch even after a
dump/delete/new/restore. I get

./notmuch count to:
11788
./notmuch count folder:
247
./notmuch count folder:inbox
0

My folders have no weird naming, they are e.g.:
/home/spaetz/mail/INBOX/cur/1258732076_0.22934.spaetz-macbook,U=468,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S

Sebastian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Sebastian Spaeth] Pull requests
  2010-04-09  7:30         ` Sebastian Spaeth
@ 2010-04-09  7:49           ` Michal Sojka
  0 siblings, 0 replies; 10+ messages in thread
From: Michal Sojka @ 2010-04-09  7:49 UTC (permalink / raw)
  To: Sebastian Spaeth, micah anderson, Notmuch development list

On Fri, 09 Apr 2010, Sebastian Spaeth wrote:
> On 2010-04-08, Michal Sojka wrote:
> > I think that the patch you sent was not the latest version. The latest
> > is in id:1265122868-12133-1-git-send-email-sojkam1@fel.cvut.cz, but it
> > is not rebased to the current master.
> 
> Not sure what I am doing wrong, but with this patch even after a
> dump/delete/new/restore. I get
> 
> ./notmuch count to:
> 11788
> ./notmuch count folder:
> 247
> ./notmuch count folder:inbox
> 0

Hi Sebastian,

I do not have time to help you with this right now, but you can try the
following patch to debug what's happening. It should apply on top of
your issue28-search-folder-name branch.

-Michal

diff --git a/notmuch-new.c b/notmuch-new.c
index e787407..ebeb287 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -416,6 +416,7 @@ add_files_recursive (notmuch_database_t *notmuch,
        case NOTMUCH_STATUS_SUCCESS:
            state->added_messages++;
            tag_inbox_and_unread (message);
+           printf("DBG: Added new message: folder=%s  message=%s\n", folder, next);
            break;
        /* Non-fatal issues (go on to next file) */
        case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID:

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-04-09  7:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-01 14:57 [Sebastian Spaeth] Pull requests Sebastian Spaeth
2010-03-26  2:50 ` micah anderson
2010-03-27 23:30   ` Sebastian Spaeth
2010-04-07  5:15     ` micah anderson
2010-04-07 10:01       ` Sebastian Spaeth
2010-04-08 13:20       ` Michal Sojka
2010-04-09  7:30         ` Sebastian Spaeth
2010-04-09  7:49           ` Michal Sojka
2010-04-07 21:25   ` Carl Worth
2010-04-07 21:22 ` Carl Worth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).