[notmuch] Snippet to jump to message in Gnus from notmuch-show buffer
On Wed, 02 Dec 2009 12:51:41 -0800, Carl wrote: > Hrm... still seeing the same inscrutable stuff that I find every time I > try to read gnus documentation. The "I want to read my mail!" post > describes "nnml" as "a one-file-one-mail backend" but then the closest > it gets to how to use it is: > So if you want to go with nnmbox, you can simply say: > (setq gnus-secondary-select-methods '((nnmbox ""))) > (The same for the other methods, kind of.) > And I'm lost. Besides the "kind of", which just makes me uneasy, how > does it make sense to configure an mbox backend with just an empty > string? Surely something needs to be told where to find an actual mbox > file? It uses its defaults. I use nnml to store my email (I like the one-file per email, indexed). To do that, I've simply added: ; Get email, and store in nnml: (setq gnus-secondary-select-methods '((nnml ""))) to my .gnus. Note that this makes Gnus fetch your email and store it in nnml-"format" under ~/Mail/ I would expect that setting mail-sources to an empty list will make Gnus not fetch your email for you. If you store your maildirs somewhere Gnus doesn't expect, you can configure the select-method further - see the nnmaildir node in the manual for instance, you can set 'directory' etc. > Or is this just selecting a backend for how GNUS should store mail that > it fetches? Yes, exactly. > Is there any hope for someone like me that doesn't want GNUS involved in > fetching mail, but just wants to use GNUS to read mail files that I have > in a big hierarchy of directories? Mail files in what format? I think the quickest way to do that is using foreign groups (but I've usually only used that to view mbox and RMAIL-files, maybe configuring a secondary select method is better with maildir). (It's "Gnus" by the way - "GNUS" was the predecessor of Gnus). > I keep feeling there must be a simple document somewhere that explains > how to do that---but I just can't find it. Simple and Gnus isn't always compatible :-) Best regards, Adam -- "Favours for the ungrateful Adam Sj?gren Unqualified & hateful" asjo at koldfront.dk
[notmuch] [PATCH -v2] notmuch.el: Support for customizing search result display
From: Aneesh Kumar K.VThis patch helps in customizing search result display similar to mutt's index_format. The customization is done by defining an alist as below (setq notmuch-search-result-format '(("date" . "%s ") ("authors" . "%-40s ") ("subject" . "%s ") ("tags" . "(%s)"))) The supported keywords are date, count, authors, subject and tags. Signed-off-by: Aneesh Kumar K.V --- Changes from V1: tags can be specified any where in the result format. Dropped notmuch-tag-face-alist which implies we cannot fontify select list of tag names. notmuch.el | 56 +++- 1 files changed, 39 insertions(+), 17 deletions(-) diff --git a/notmuch.el b/notmuch.el index 1e5bf5b..bd8a6ce 100644 --- a/notmuch.el +++ b/notmuch.el @@ -119,6 +119,14 @@ pattern can still test against the entire line).") (defvar notmuch-show-body-read-visible nil) (defvar notmuch-show-citations-visible nil) (defvar notmuch-show-signatures-visible nil) +(defcustom notmuch-search-result-format nil + "Search result formating. Supported fields are + date, count, authors, subject, tags +ex: (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\) + \(\"subject\" . \"%s\"\)\)\)" +:type '(alist :key-type (string) :value-type (string)) +:group 'notmuch) + (defvar notmuch-show-headers-visible nil) ; XXX: This should be a generic function in emacs somewhere, not here @@ -1060,11 +1068,6 @@ thread from that buffer can be show when done with this one)." "Notmuch search mode face used to highligh tags." :group 'notmuch) -(defvar notmuch-tag-face-alist nil - "List containing the tag list that need to be highlighed") - -(defvar notmuch-search-font-lock-keywords nil) - ;;;###autoload (defun notmuch-search-mode () "Major mode displaying results of a notmuch search. @@ -1100,17 +1103,7 @@ Complete list of currently available key bindings: (setq truncate-lines t) (setq major-mode 'notmuch-search-mode mode-name "notmuch-search") - (setq buffer-read-only t) - (if (not notmuch-tag-face-alist) - (add-to-list 'notmuch-search-font-lock-keywords (list - "(\\([^)]*\\))$" '(1 'notmuch-tag-face))) -(let ((notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))) - (loop for notmuch-search-tag in notmuch-search-tags - do (add-to-list 'notmuch-search-font-lock-keywords (list - (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$") - `(1 ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist - (set (make-local-variable 'font-lock-defaults) - '(notmuch-search-font-lock-keywords t))) + (setq buffer-read-only t)) (defun notmuch-search-find-thread-id () "Return the thread for the current thread" @@ -1217,6 +1210,30 @@ This function advances the next thread when finished." (insert (format " (process returned %d)" exit-status))) (insert "\n")) +(defun insert-tags (tags) + (insert (concat "(" (propertize tags +'font-lock-face 'notmuch-tag-face) ")"))) + +(defun insert-field (field date count authors subject tags) +(if (string-equal field "date") +(insert (format (cdr (assoc field notmuch-search-result-format)) date)) + (if (string-equal field "count") +(insert (format (cdr (assoc field notmuch-search-result-format)) count)) + (if (string-equal field "authors") +(insert (format (cdr (assoc field notmuch-search-result-format)) authors)) + (if (string-equal field "subject") + (insert (format (cdr (assoc field notmuch-search-result-format)) subject)) + (if (string-equal field "tags") + (insert-tags (format (cdr (assoc field notmuch-search-result-format)) tags))) +) + +(defun notmuch-search-show-result (date count authors subject tags) +(let ((fields) (field)) + (setq fields (mapcar 'car notmuch-search-result-format)) + (loop for field in fields + do (insert-field field date count authors subject tags))) +(insert "\n")) + (defun notmuch-search-process-filter (proc string) "Process and filter the output of \"notmuch search\"" (let ((buffer (process-buffer proc))) @@ -1239,7 +1256,12 @@ This function advances the next thread when finished." (set 'authors (concat (substring authors 0 (- 40 3)) "..."))) (goto-char (point-max)) (let ((beg (point-marker))) - (insert (format "%s %-7s %-40s %s (%s)\n" date count authors subject tags)) + (if (not notmuch-search-result-format) + (progn (insert (format "%s %-7s %-40s %s" date count authors subject)) + ;; insert the fontified tag +
[notmuch] [PATCH 1/2] notmuch-show: limit display to only matching messages
, + notmuch_thread_get_thread_id (thread)); - show_messages (ctx, messages, 0); + show_messages (ctx, messages, 0, entire_thread); - notmuch_thread_destroy (thread); - } + notmuch_thread_destroy (thread); } notmuch_query_destroy (query); -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091202/f1d37d5f/attachment.pgp>
[notmuch] [PATCH] Make search filters handle disjunctive queries.
Jan, thanks for looking into this. On Wed, 2 Dec 2009 15:38:54 +0100, Jan Janak wrote: > This seems close enough to what you want and maybe we could somehow make it > work with notmuch, too. This would be interesting to have, because then we > could complete multiple tag names with a single TAB press not only in your > expressions, but everywhere. Yes, I think that is desirable. > Let me know if you do not plan to work on this and I'll see if I can make it > work. I'm not using tags heavily at the moment, and am busy with other things so I'm unlikely to get to it in the next couple weeks. If you can make completion work with this sort of input, I'll update my filter-by-tags patch. Jed
[notmuch] [PATCH] Make search filters handle disjunctive queries.
Jed, On 02-12 14:46, Jed Brown wrote: > On Wed, 2 Dec 2009 14:18:08 +0100, Jan Janak wrote: > > I haven't been really following this thread in detail. What is that you need > > from notmuch-select-tag-with-completion? To be able to process a list of > > tags > > separated by spaces? Maybe I could help you with that. > > No, it would need to take input separated by spaces, now I just get `[No > match]' when I try to enter a space. I think it's just not how > completing-read works, the idea would be for the user to be able to type > > shorttag and not long > > which would complete to > > shorttag and not longboringtagname I see. > The point of my patch was to be able to filter using arbitrary > expressions where every non-operator, i.e. `and', `or', `not', `(', and > `)', is interpreted as a tag name. Is there an easy way to accept this > input without sacrificing completion? I am not completely sure, but there might be a way to do this with some of the low-level completion functions. For example, the documentation on completion styles: http://www.gnu.org/software/emacs/elisp/html_node/Completion-Styles.html#Completion-Styles mentions in the last paragraph that there is a style which completes each word in the input separately. This can be enabled with (partial-completion-mode), and indeed, if I enable this mode, try to visit a file and type ~/.n-c then it correctly completes ~/.notmuch-config. This seems close enough to what you want and maybe we could somehow make it work with notmuch, too. This would be interesting to have, because then we could complete multiple tag names with a single TAB press not only in your expressions, but everywhere. Right now we can only add one tag at a time with notmuch-search-add-tag and similar functions. If we could make partial completion work, we could add several tags with one command and still have their names completed. Let me know if you do not plan to work on this and I'll see if I can make it work. -Jan
[notmuch] [PATCH] Make search filters handle disjunctive queries.
On Wed, 2 Dec 2009 14:18:08 +0100, Jan Janak wrote: > I haven't been really following this thread in detail. What is that you need > from notmuch-select-tag-with-completion? To be able to process a list of tags > separated by spaces? Maybe I could help you with that. No, it would need to take input separated by spaces, now I just get `[No match]' when I try to enter a space. I think it's just not how completing-read works, the idea would be for the user to be able to type shorttag and not long which would complete to shorttag and not longboringtagname The point of my patch was to be able to filter using arbitrary expressions where every non-operator, i.e. `and', `or', `not', `(', and `)', is interpreted as a tag name. Is there an easy way to accept this input without sacrificing completion? Jed
[notmuch] [PATCH] Make search filters handle disjunctive queries.
On 02-12 11:59, Jed Brown wrote: > A patch for notmuch-search-filter follows, my change to > notmuch-search-filter-by-tag is not very useful since > notmuch-select-tag-with-completion does not allow a space to be > inserted. I don't know how to get completion on multiple > space-separated terms. notmuch-select-tag-with-completion uses "\n" as tag separator. This is because it gets the output of 'notmuch search-tags' as input and there is one tag on a line. I haven't been really following this thread in detail. What is that you need from notmuch-select-tag-with-completion? To be able to process a list of tags separated by spaces? Maybe I could help you with that. -Jan
[notmuch] [PATCH 2/4] notmuch: Config option to specify tags to be applied by 'notmuch new'.
On Wed, 25 Nov 2009 22:50:08 +0100, Jan Janak wrote: > On 25-11 15:56, Bart Trojanowski wrote: > > I really want this feature to get in, so I am going to do my best to > > review your code :) > > > > Here are some more sticking points... > > > > > +char ** > > > +notmuch_config_get_new_tags (notmuch_config_t *config, size_t *length); > > > > If you are not giving over control of the pointer to the caller please > > return const char * const *. > > I followed Carl's style there, in particular the following function: > notmuch_config_get_user_other_email > > I can, of course, change that. But maybe we should wait for Carl to see > which way he prefers. Call me stupid. Anything more complex than "const char *" and I can never figure out where to put the const to express what's desired. If "const char * const *" means what we want it to, then feel free to return that, (and fix up existing cases). But maybe add a little block of example code to the documentation of the function so that idiots like me can still figure out how to declare the right kind of variable to call the function. -Carl -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091202/c3572aa1/attachment-0001.pgp>
[notmuch] [PATCH 0/4] Make tags applied by 'notmuch new' configurable.
by simply treating an empty configuration value as "inbox;unread"? We could even make the notmuch-config code notice a case like this and write out the new configuration file with the new option explicitly in it, (with documentation). I'd definitely like to see a smooth upgrade path where existing users get as much benefit from a complete and well-documented configuration file as new users. (I've been frustrated by too many programs where the only way to get a well-documented configuration is to start from scratch.) > The last patch in the set adds a new command line option to 'notmuch new'. > The name of the option is --tag and it can be used to override any tags > configured in the configuration file. For example: > > notmuch new --tag=outbox --tag=read > > adds the tags 'outbox' and 'read' and ignores any tags from the configuration > file. I don't like the idea of adding command-line-based tags to "notmuch new", at least the way "notmuch new" currently works, (searching through a mail store for any new files). In the actual patch, you identified a use-case for this that is important, (importing a new collection of messages and wanting them all tagged together). The problem of doing this with the existing "notmuch new" is that it's too easy to accidentally tag more than is intended. The only way to make it work would be to: 1. Turn off anything delivering mail to the mailstore 2. Ensure that the delivery is actually complete somehow, (and not still pending in local MTA queues, etc.) 3. Run "notmuch new" to ensure all recently-delivered mail is incorporated. 4. Copy the new collection of mail into the mail store. 5. Run "notmuch new --tag" with the collection-specific tag. 6. Turn on mail delivery again. That's too hard, and far too error-prone. (I don't know of any good way to do step (2) on my system, for example.) If we had something like "notmuch import" that took files (perhaps even an mbox) and copied them into the mail store, then *that* command could legitimately accept a --tag option. Meanwhile, the way I think I'd like to see this operation supported is by a search specification that operates on the filenames. People have already asked for support for doing tagging based on directory names, (which will apparently allow people to keep their collection of Gmail-created tags). So I'd like to see something like this instead for the use case: mv some-archive ~/mail-store/some-archive notmuch tag +some-archive filename:some-archive* This idea seems very much in line with what you advocated earlier, (handling the maildir "unread" flag after the fact, rather than in "notmuch new"). And yes, I realize that I'm arguing on different sides of the issue here. Trying to decide how much "notmuch new" should or shouldn't do is a tricky thing, and I'm hoping that by arguing from both sides I'll better be able to see the right answer. :-) -Carl -- next part -- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091202/248e331f/attachment.pgp>
[notmuch] Snippet to jump to message in Gnus from notmuch-show buffer
On Fri, 27 Nov 2009 23:10:30 +0100, Tassilo Horn wrote: > Well, if you only want to have a look at a maildir or mbox, and don't > want to make the group permanent and let gnus fetch mail, then this > should do the trick. > > M-x gnus RET ;; brings you into the *Group* buffer, and then ... > | `G m' > | Make a new group (`gnus-group-make-group'). Gnus will prompt you For viewing an mbox, I successfully used "C-u G f" that you mentioned earlier. So I've at least now seen gnus in action, thanks! What I'd really to view is a maildir though, but I haven't gotten "G m" to work with that yet. It prompts me for a "group name", (which I assume is just an arbitrary string), then a "from method" which offers tab completion for things that look promising (such as "nnmh" and "nnmaildir") but I can't get anything to work past that. I never see anything prompting for an actual directory, and it either ends up creating an empty directory, (such as ${HOME}/Mail/), or complaining "Wrong type argument: stringp, nil". I even guessthat that maybe it wants "nnmaildir:/path/to/maildir" or maybe "nnmaildir+/path/to/maildir" but the prompt won't accept either of these (just says "[No match]"). And now I've got an entry in the *Group* buffer for each of my attempts, which variously complain ("Couldn't open server" for nnmaildir:foo, "Group nnmh:bar contains no messages", and "Couldn't activate group test: No such group"---I can't remember how I created that one). Where are all of these groups stored now? (I couldn't find anything matching ~/.gnus* nor any changes to my .emacs file.) Yet I still see these broken groups even with "emacs -q -f gnus". And how do I delete these? Update: It looks like I've got stuff in ~/.newsrc, ~/.newsrc-dribble, and ~/.newsrc.eld from my various thrashing here. Still not clear how to delete things---.newsrc.eld says I shouldn't delete it but should touch ~/.newsrc instead, but that doesn't seem to have any effect. I went ahead and deleted ~/.newsrc* and most of this stuff does seem to be nicely cleaned up. All that's left is that I now get a warning on starting gnus of "Gnus auto-save file exits. Do you want to read it? (y or n)". If I do read it, then I get some of the junk groups back. I can't figure out where this auto-save file exists, (it's even hiding
[notmuch] [PATCH] Make search filters handle disjunctive queries.
notmuch-search-filter now accepts an arbitrary query and will group if necessary so that we get tag:inbox AND (gravy OR biscuits) instead of the former tag:inbox AND gravy OR biscuits Signed-off-by: Jed Brown --- notmuch.el |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/notmuch.el b/notmuch.el index 2509651..0bf82f5 100644 --- a/notmuch.el +++ b/notmuch.el @@ -995,6 +995,8 @@ thread from that buffer can be show when done with this one)." (defvar notmuch-search-oldest-first t "Show the oldest mail first in the search-mode") +(defvar notmuch-search-disjunctive-regexp "\\<[oO][rR]\\>") + (defun notmuch-search-scroll-up () "Move forward through search results by one window's worth." (interactive) @@ -1327,7 +1329,8 @@ search." Runs a new search matching only messages that match both the current search results AND the additional query string provided." (interactive "sFilter search: ") - (notmuch-search (concat notmuch-search-query-string " and " query) notmuch-search-oldest-first)) + (let ((grouped-query (if (string-match-p notmuch-search-disjunctive-regexp query) (concat "( " query " )") query))) +(notmuch-search (concat notmuch-search-query-string " and " grouped-query) notmuch-search-oldest-first))) (defun notmuch-search-filter-by-tag (tag) "Filter the current search results based on a single tag. -- 1.6.5.3
[notmuch] [PATCH] Make search filters handle disjunctive queries.
A patch for notmuch-search-filter follows, my change to notmuch-search-filter-by-tag is not very useful since notmuch-select-tag-with-completion does not allow a space to be inserted. I don't know how to get completion on multiple space-separated terms. On Tue, 01 Dec 2009 18:56:59 -0800, Carl Worth wrote: > PS. Hmm... "notmuch reply" needs to be more clever to avoid duplicate > addresses in the To: and Cc: lines. See above. Yes, uniquifying the headers actually requires some effort, unless I'm missing something in the gmime API (which I've never looked at before). Jed
[notmuch] Problem building notmuch
Den Tue, Dec 01, 2009 at 05:46:04PM +0100 skrev Jed Brown: > On Tue, 1 Dec 2009 10:33:05 +0100, Steen Manniche > wrote: > > Probably unusable system info: > > % uname -a > > Linux algorithm 2.6.31-ARCH #1 SMP PREEMPT Fri Oct 23 11:12:58 CEST > > 2009 i686 Intel(R) Core(TM)2 Duo CPU P9500 @ 2.53GHz GenuineIntel > > GNU/Linux > > This is pretty much my fault because I made the talloc package that is > on AUR. The problem is that you have both talloc-1 (from the smbclient > package) and talloc-2 (from the AUR talloc). The libtalloc.so symlink > points at smbclient's copy, but smbclient doesn't include a pkgconfig > for talloc, thus you are using the talloc-2 header and talloc-1 library. > > How do other distros handle talloc-1/talloc-2 incompatibility? I have no idea, but the man pages of ld and gcc together with some guru assistance helped me construct the following 'hack': % mkdir LIBS && cd LIBS % ln -s /usr/lib/libtalloc.so.2.0.0 libtalloc.so % cd .. % g++ debugger.o gmime-filter-reply.o notmuch.o notmuch-config.o notmuch-count.o notmuch-dump.o notmuch-new.o notmuch-reply.o notmuch-restore.o notmuch-search.o notmuch-search-tags.o notmuch-setup.o notmuch-show.o notmuch-tag.o notmuch-time.o query-string.o show-message.o lib/notmuch.a -LLIBS -lgmime-2.4 -lz -lnsl -lgobject-2.0 -lglib-2.0 -ltalloc -lxapian -o notmuch The thing to note in the above line is -LLIBS All this causes a good make and ldd reports % ldd notmuch linux-gate.so.1 => (0xb78ad000) libgmime-2.4.so.2 => /usr/lib/libgmime-2.4.so.2 (0xb7836000) libz.so.1 => /usr/lib/libz.so.1 (0xb7822000) libnsl.so.1 => /lib/libnsl.so.1 (0xb780b000) libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb77d1000) libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb771f000) libtalloc.so.2 => /usr/lib/libtalloc.so.2 (0xb7715000) libxapian.so.15 => /usr/lib/libxapian.so.15 (0xb75bf000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb74ca000) libm.so.6 => /lib/libm.so.6 (0xb74a4000) libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb7486000) libc.so.6 => /lib/libc.so.6 (0xb734) libpthread.so.0 => /lib/libpthread.so.0 (0xb7327000) libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb7323000) libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb731f000) librt.so.1 => /lib/librt.so.1 (0xb7316000) libpcre.so.0 => /lib/libpcre.so.0 (0xb72e4000) /lib/ld-linux.so.2 (0xb78ae000) libdl.so.2 => /lib/libdl.so.2 (0xb72e) and notmuch works. Thanks for the fast reply, Jed. And I hope you get the package problem solved. Best regards, Steen
[notmuch] [PATCH 2/2] * free the response data from 'prompt'
Free the results of the prompt; this patch does the minimal job for that. It may be nice to refactor the function a bit. Signed-off-by: Dirk-Jan C. Binnema --- notmuch-setup.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/notmuch-setup.c b/notmuch-setup.c index 622bbaa..293c852 100644 --- a/notmuch-setup.c +++ b/notmuch-setup.c @@ -119,12 +119,16 @@ notmuch_setup_command (unused (void *ctx), prompt ("Your full name [%s]: ", notmuch_config_get_user_name (config)); if (strlen (response)) notmuch_config_set_user_name (config, response); - +free (response); +response = NULL; + prompt ("Your primary email address [%s]: ", notmuch_config_get_user_primary_email (config)); if (strlen (response)) notmuch_config_set_user_primary_email (config, response); - +free (response); +response = NULL; + other_emails = g_ptr_array_new (); old_other_emails = notmuch_config_get_user_other_email (config, @@ -136,12 +140,17 @@ notmuch_setup_command (unused (void *ctx), else g_ptr_array_add (other_emails, talloc_strdup (ctx, old_other_emails[i])); + free (response); + response = NULL; } do { prompt ("Additional email address [Press 'Enter' if none]: "); if (strlen (response)) g_ptr_array_add (other_emails, talloc_strdup (ctx, response)); + free (response); + response = NULL; + } while (strlen (response)); if (other_emails->len) notmuch_config_set_user_other_email (config, @@ -158,6 +167,8 @@ notmuch_setup_command (unused (void *ctx), absolute_path = make_path_absolute (ctx, response); notmuch_config_set_database_path (config, absolute_path); } +free (response); +response = NULL; if (! notmuch_config_save (config)) { if (is_new) -- 1.6.3.3
[notmuch] [PATCH 1/2] * notmuch-config: fix small leak from 'g_key_file_to_data'
Signed-off-by: Dirk-Jan C. Binnema --- notmuch-config.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/notmuch-config.c b/notmuch-config.c index fc65d6b..95430db 100644 --- a/notmuch-config.c +++ b/notmuch-config.c @@ -317,9 +317,11 @@ notmuch_config_save (notmuch_config_t *config) fprintf (stderr, "Error saving configuration to %s: %s\n", config->filename, error->message); g_error_free (error); + g_free (data); return 1; } +g_free (data); return 0; } -- 1.6.3.3
Re: [notmuch] [PATCH] Make search filters handle disjunctive queries.
Jed, On 02-12 14:46, Jed Brown wrote: On Wed, 2 Dec 2009 14:18:08 +0100, Jan Janak j...@ryngle.com wrote: I haven't been really following this thread in detail. What is that you need from notmuch-select-tag-with-completion? To be able to process a list of tags separated by spaces? Maybe I could help you with that. No, it would need to take input separated by spaces, now I just get `[No match]' when I try to enter a space. I think it's just not how completing-read works, the idea would be for the user to be able to type shorttag and not longTAB which would complete to shorttag and not longboringtagname I see. The point of my patch was to be able to filter using arbitrary expressions where every non-operator, i.e. `and', `or', `not', `(', and `)', is interpreted as a tag name. Is there an easy way to accept this input without sacrificing completion? I am not completely sure, but there might be a way to do this with some of the low-level completion functions. For example, the documentation on completion styles: http://www.gnu.org/software/emacs/elisp/html_node/Completion-Styles.html#Completion-Styles mentions in the last paragraph that there is a style which completes each word in the input separately. This can be enabled with (partial-completion-mode), and indeed, if I enable this mode, try to visit a file and type ~/.n-cTAB then it correctly completes ~/.notmuch-config. This seems close enough to what you want and maybe we could somehow make it work with notmuch, too. This would be interesting to have, because then we could complete multiple tag names with a single TAB press not only in your expressions, but everywhere. Right now we can only add one tag at a time with notmuch-search-add-tag and similar functions. If we could make partial completion work, we could add several tags with one command and still have their names completed. Let me know if you do not plan to work on this and I'll see if I can make it work. -Jan ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH] Make search filters handle disjunctive queries.
Jan, thanks for looking into this. On Wed, 2 Dec 2009 15:38:54 +0100, Jan Janak j...@ryngle.com wrote: This seems close enough to what you want and maybe we could somehow make it work with notmuch, too. This would be interesting to have, because then we could complete multiple tag names with a single TAB press not only in your expressions, but everywhere. Yes, I think that is desirable. Let me know if you do not plan to work on this and I'll see if I can make it work. I'm not using tags heavily at the moment, and am busy with other things so I'm unlikely to get to it in the next couple weeks. If you can make completion work with this sort of input, I'll update my filter-by-tags patch. Jed ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[notmuch] [PATCH (rebased)] Handle message renames in mail spool
In order to handle message renames the following changes were deemed necessary: * Mtime check on individual files was disabled. As files may be moved around without changing their mtime, it's necessary to parse them even if they appear old in case old message was moved. mtime check on directories was kept as moving files changes mtime of directory. * If message being parsed is already found in database under different path, then this message is considered to be moved, path is updated in database and this file does not undergo further processing. Note that after applying this patch notmuch still does not handle copying files (which is harmless, database will point to the last copy of message found during 'notmuch new') and deleting files (which is more serious, as dangling entries will show up in searches). Signed-off-by: Mikhail Gusarov dotted...@dottedmag.net --- lib/database.cc | 32 ++- notmuch-new.c | 116 ++ 2 files changed, 78 insertions(+), 70 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 23ddd4a..45d8fc7 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -993,19 +993,31 @@ notmuch_database_add_message (notmuch_database_t *notmuch, if (private_status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) { _notmuch_message_set_filename (message, filename); _notmuch_message_add_term (message, type, mail); - } else { - ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID; - goto DONE; - } - ret = _notmuch_database_link_message (notmuch, message, message_file); - if (ret) - goto DONE; + ret = _notmuch_database_link_message (notmuch, message, message_file); + if (ret) + goto DONE; - date = notmuch_message_file_get_header (message_file, date); - _notmuch_message_set_date (message, date); + date = notmuch_message_file_get_header (message_file, date); + _notmuch_message_set_date (message, date); - _notmuch_message_index_file (message, filename); + _notmuch_message_index_file (message, filename); + } else { + const char *old_filename = notmuch_message_get_filename (message); + if (strcmp (old_filename, filename) == 0) { + /* We have already seen it */ + goto DONE; + } else { + if (access (old_filename, R_OK) == 0) { + /* old_filename still exists, we've got a duplicate */ + ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID; + goto DONE; + } else { + /* Message file has been moved/renamed */ + _notmuch_message_set_filename (message, filename); + } + } + } _notmuch_message_sync (message); } catch (const Xapian::Error error) { diff --git a/notmuch-new.c b/notmuch-new.c index 9d20616..d595fc4 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -217,66 +217,62 @@ add_files_recursive (notmuch_database_t *notmuch, } if (S_ISREG (st-st_mode)) { - /* If the file hasn't been modified since the last -* add_files, then we need not look at it. */ - if (path_dbtime == 0 || st-st_mtime path_dbtime) { - state-processed_files++; - - if (state-verbose) { - if (state-output_is_a_tty) - printf(\r\033[K); - - printf (%i/%i: %s, - state-processed_files, - state-total_files, - next); - - putchar((state-output_is_a_tty) ? '\r' : '\n'); - fflush (stdout); - } - - status = notmuch_database_add_message (notmuch, next, message); - switch (status) { - /* success */ - case NOTMUCH_STATUS_SUCCESS: - state-added_messages++; - tag_inbox_and_unread (message); - break; - /* Non-fatal issues (go on to next file) */ - case NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID: - /* Stay silent on this one. */ - break; - case NOTMUCH_STATUS_FILE_NOT_EMAIL: - fprintf (stderr, Note: Ignoring non-mail file: %s\n, -next); - break; - /* Fatal issues. Don't process anymore. */ - case NOTMUCH_STATUS_READONLY_DATABASE: - case NOTMUCH_STATUS_XAPIAN_EXCEPTION: - case NOTMUCH_STATUS_OUT_OF_MEMORY: - fprintf (stderr, Error: %s. Halting processing.\n, -notmuch_status_to_string (status)); - ret = status; -