* [PATCH 1/3] Add 'm' and ' ' bindings to notmuch-folder view
@ 2009-12-27 0:34 Keith Packard
2009-12-27 0:34 ` [PATCH 2/3] Look at whitespace to separate folder name from count Keith Packard
0 siblings, 1 reply; 4+ messages in thread
From: Keith Packard @ 2009-12-27 0:34 UTC (permalink / raw)
To: notmuch
This allows the user to compose new mail from the folder view, and
also to use <space> to show the current folder.
Signed-off-by: Keith Packard <keithp@keithp.com>
---
notmuch.el | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/notmuch.el b/notmuch.el
index 97914f2..3dbb64a 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1378,12 +1378,14 @@ current search results AND that are tagged with the given tag."
(define-key map "?" 'notmuch-help)
(define-key map "x" 'kill-this-buffer)
(define-key map "q" 'kill-this-buffer)
+ (define-key map "m" 'message-mail)
(define-key map ">" 'notmuch-folder-last)
(define-key map "<" 'notmuch-folder-first)
(define-key map "=" 'notmuch-folder)
(define-key map "s" 'notmuch-search)
(define-key map [mouse-1] 'notmuch-folder-show-search)
(define-key map (kbd "RET") 'notmuch-folder-show-search)
+ (define-key map " " 'notmuch-folder-show-search)
(define-key map "p" 'notmuch-folder-previous)
(define-key map "n" 'notmuch-folder-next)
map)
--
1.6.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] Look at whitespace to separate folder name from count
2009-12-27 0:34 [PATCH 1/3] Add 'm' and ' ' bindings to notmuch-folder view Keith Packard
@ 2009-12-27 0:34 ` Keith Packard
2009-12-27 0:34 ` [PATCH 3/3] Allow folders with no messages to be elided from list Keith Packard
0 siblings, 1 reply; 4+ messages in thread
From: Keith Packard @ 2009-12-27 0:34 UTC (permalink / raw)
To: notmuch
This allows folder names to contain any non-blank characters
Signed-off-by: Keith Packard <keithp@keithp.com>
---
notmuch.el | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/notmuch.el b/notmuch.el
index 3dbb64a..c02adc6 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1469,8 +1469,8 @@ Currently available key bindings:
(save-excursion
(beginning-of-line)
(let ((beg (point)))
- (forward-word)
- (filter-buffer-substring beg (point)))))
+ (re-search-forward "\\([ \t]*[^ \t]+\\)")
+ (filter-buffer-substring (match-beginning 1) (match-end 1)))))
(defun notmuch-folder-show-search (&optional folder)
"Show a search window for the search related to the specified folder."
--
1.6.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] Allow folders with no messages to be elided from list.
2009-12-27 0:34 ` [PATCH 2/3] Look at whitespace to separate folder name from count Keith Packard
@ 2009-12-27 0:34 ` Keith Packard
2010-02-08 22:43 ` Carl Worth
0 siblings, 1 reply; 4+ messages in thread
From: Keith Packard @ 2009-12-27 0:34 UTC (permalink / raw)
To: notmuch
This makes it easier to see folders with messages.
Eliding empty folders is togged with the 'e' binding.
Signed-off-by: Keith Packard <keithp@keithp.com>
---
lib/Makefile.local | 1 +
lib/notmuch.h | 11 +++++++++++
lib/query.cc | 41 +++++++++++++++++++++++++++++++++++++++++
notmuch-new.c | 1 +
notmuch.el | 29 ++++++++++++++++++++++++-----
5 files changed, 78 insertions(+), 5 deletions(-)
diff --git a/lib/Makefile.local b/lib/Makefile.local
index a7562c9..e42f533 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -2,6 +2,7 @@ dir=lib
extra_cflags += -I$(dir)
libnotmuch_c_srcs = \
+ $(dir)/date.c \
$(dir)/libsha1.c \
$(dir)/message-file.c \
$(dir)/messages.c \
diff --git a/lib/notmuch.h b/lib/notmuch.h
index 60834fb..f24da18 100644
--- a/lib/notmuch.h
+++ b/lib/notmuch.h
@@ -94,6 +94,7 @@ typedef enum _notmuch_status {
NOTMUCH_STATUS_NULL_POINTER,
NOTMUCH_STATUS_TAG_TOO_LONG,
NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW,
+ NOTMUCH_STATUS_INVALID_DATE,
NOTMUCH_STATUS_LAST_STATUS
} notmuch_status_t;
@@ -929,6 +930,16 @@ notmuch_tags_advance (notmuch_tags_t *tags);
void
notmuch_tags_destroy (notmuch_tags_t *tags);
+/* Convert a string into a time range
+ *
+ * This parses the provided string, providing two time values
+ * representing the begining and end of the period. It
+ * returns NOTMUCH_STATUS_INVALID_DATE if the string could not be
+ * parsed, otherwise it return NOTMUCH_STATUS_SUCCESS
+ */
+notmuch_status_t
+notmuch_date(const char *text, time_t *first, time_t *last);
+
NOTMUCH_END_DECLS
#endif
diff --git a/lib/query.cc b/lib/query.cc
index 9106b92..f511146 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -47,6 +47,47 @@ struct _notmuch_threads {
const char *thread_id;
};
+static char *
+notmuch_query_extract_word(notmuch_query_t *query, char *leader)
+{
+ char *token = strstr(query->query_string, leader);
+ int len = strlen(leader);
+ char *space;
+ char *word;
+ char *query_string;
+
+ if (!token)
+ return NULL;
+ space = strchr(token, ' ');
+ if (!space)
+ space = token + strlen(token);
+ word = talloc_strndup(query, token + len, space - token - len);
+ query_string = talloc(query, strlen(query->query_string) - (space - token));
+ strncpy(query_string, query->query_string, token - query->query_string);
+ strcat(query_string, space);
+ query->query_string = query_string;
+ return word;
+}
+
+static notmuch_status_t
+notmuch_query_edit(notmuch_query_t *query)
+{
+ char *before, *after;
+ time_t before_first, before_last, after_first, after_last;
+
+ /* edit date range */
+ before = notmuch_query_extract_word(query, "before:");
+ if (notmuch_date(before, &before_first, &before_last) != NOTMUCH_STATUS_SUCCESS)
+ before = NULL;
+ after = notmuch_query_extract_word(query, "after:");
+ if (notmuch_date(after, &after_first, &after_last) != NOTMUCH_STATUS_SUCCESS)
+ after = NULL;
+
+ if (before && after) {
+
+ }
+}
+
notmuch_query_t *
notmuch_query_create (notmuch_database_t *notmuch,
const char *query_string)
diff --git a/notmuch-new.c b/notmuch-new.c
index 9d20616..3974b28 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -264,6 +264,7 @@ add_files_recursive (notmuch_database_t *notmuch,
case NOTMUCH_STATUS_TAG_TOO_LONG:
case NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW:
case NOTMUCH_STATUS_LAST_STATUS:
+ case NOTMUCH_STATUS_INVALID_DATE:
INTERNAL_ERROR ("add_message returned unexpected value: %d", status);
goto DONE;
}
diff --git a/notmuch.el b/notmuch.el
index c02adc6..73917e7 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -1379,6 +1379,7 @@ current search results AND that are tagged with the given tag."
(define-key map "x" 'kill-this-buffer)
(define-key map "q" 'kill-this-buffer)
(define-key map "m" 'message-mail)
+ (define-key map "e" 'notmuch-folder-show-empty-toggle)
(define-key map ">" 'notmuch-folder-last)
(define-key map "<" 'notmuch-folder-first)
(define-key map "=" 'notmuch-folder)
@@ -1455,14 +1456,32 @@ Currently available key bindings:
(goto-char (point-max))
(forward-line -1))
+(defun notmuch-folder-count (search)
+ (car (process-lines notmuch-command "count" search)))
+
+(setq notmuch-folder-show-empty t)
+
+(defun notmuch-folder-show-empty-toggle ()
+ "Toggle the listing of empty folders"
+ (interactive)
+ (setq notmuch-folder-show-empty (not notmuch-folder-show-empty))
+ (notmuch-folder))
+
(defun notmuch-folder-add (folders)
(if folders
- (let ((name (car (car folders)))
+ (let* ((name (car (car folders)))
(inhibit-read-only t)
- (search (cdr (car folders))))
- (insert name)
- (indent-to 16 1)
- (call-process notmuch-command nil t nil "count" search)
+ (search (cdr (car folders)))
+ (count (notmuch-folder-count search)))
+ (if (or notmuch-folder-show-empty
+ (not (equal count "0")))
+ (progn
+ (insert name)
+ (indent-to 16 1)
+ (insert count)
+ (insert "\n")
+ )
+ )
(notmuch-folder-add (cdr folders)))))
(defun notmuch-folder-find-name ()
--
1.6.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] Allow folders with no messages to be elided from list.
2009-12-27 0:34 ` [PATCH 3/3] Allow folders with no messages to be elided from list Keith Packard
@ 2010-02-08 22:43 ` Carl Worth
0 siblings, 0 replies; 4+ messages in thread
From: Carl Worth @ 2010-02-08 22:43 UTC (permalink / raw)
To: Keith Packard, notmuch
[-- Attachment #1: Type: text/plain, Size: 717 bytes --]
On Sat, 26 Dec 2009 16:34:18 -0800, Keith Packard <keithp@keithp.com> wrote:
> This makes it easier to see folders with messages.
> Eliding empty folders is togged with the 'e' binding.
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
Thanks for the patches, Keith!
These are all very useful, and I've pushed all three...
> lib/Makefile.local | 1 +
> lib/notmuch.h | 11 +++++++++++
> lib/query.cc | 41 +++++++++++++++++++++++++++++++++++++++++
> notmuch-new.c | 1 +
> notmuch.el | 29 ++++++++++++++++++++++++-----
> 5 files changed, 78 insertions(+), 5 deletions(-)
...except that on this last one I only pushed changes to notmuch.el. ;-)
-Carl
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-02-08 22:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-27 0:34 [PATCH 1/3] Add 'm' and ' ' bindings to notmuch-folder view Keith Packard
2009-12-27 0:34 ` [PATCH 2/3] Look at whitespace to separate folder name from count Keith Packard
2009-12-27 0:34 ` [PATCH 3/3] Allow folders with no messages to be elided from list Keith Packard
2010-02-08 22:43 ` 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).