From 83f531ad7ee4b9e9aacac4f45148c39101f17ab8 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Wed, 21 May 2014 10:58:50 +0100 Subject: [PATCH 1/4] emacs: make sure tagging on an empty query is harmless Currently notmuch-tag throws a "wrong-type-argument stringp nil" if passed a nil query-string. Catch this and provide a more useful error message. This fixes a case in notmuch-tree (if you try to tag when at the end of the buffer). Secondly, as pointed out by David (dme) `notmuch-search-find-stable-query-region' can return the query string () if there are no messages in the region. This gets passed to notmuch tag, and due to interactions in the optimize_query code in notmuch-tag.c becomes, in the case tag-change is -inbox, "( () ) and (tag:inbox)". This query matches some strange collection of messages which then get archived. This should probably be fixed, but in any case make `notmuch-search-find-stable-query-region' return a nil query-string in this case. This avoids data-loss (random tag removal) in this case. --- emacs/notmuch-tag.el | 2 ++ emacs/notmuch.el | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 07c260eb..f54aa9d6 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -387,6 +387,8 @@ notmuch-after-tag-hook will be run." (unless (string-match-p "^[-+]\\S-+$" tag-change) (error "Tag must be of the form `+this_tag' or `-that_tag'"))) tag-changes) + (unless query + (error "Nothing to tag!")) (unless (null tag-changes) (run-hooks 'notmuch-before-tag-hook) (if (<= (length query) notmuch-tag-argument-limit) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 6c0bc1bc..1adea9c2 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -428,14 +428,16 @@ matched and unmatched messages in the current thread." "Return the stable query for the current region. If ONLY-MATCHED is non-nil, include only matched messages. If it -is nil, include both matched and unmatched messages." +is nil, include both matched and unmatched messages. If there are +no messages in the region then return nil." (let ((query-list nil) (all (not only-matched))) (dolist (queries (notmuch-search-properties-in-region :query beg end)) (when (first queries) (push (first queries) query-list)) (when (and all (second queries)) (push (second queries) query-list))) - (concat "(" (mapconcat 'identity query-list ") or (") ")"))) + (when query-list + (concat "(" (mapconcat 'identity query-list ") or (") ")")))) (defun notmuch-search-find-authors () "Return the authors for the current thread" From ebf4aaa0f8e6e9e1ead07268a060ea22dcc46ad0 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 10 May 2014 08:55:21 -0700 Subject: [PATCH 2/4] doc/conf.py: Remove _static from html_static_path Avoid: $ make HAVE_SPHINX=1 sphinx-html python ./doc/mkdocdeps.py ./doc doc/_build doc/docdeps.mk sphinx-build -b html -d doc/_build/doctrees -q ./doc doc/_build/html Making output directory... WARNING: html_static_path entry '/home/wking/src/notmuch/notmuch/doc/_static' does not exist because we have no static source in doc/_static. --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index a926fe42..70ba1b8a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -42,7 +42,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = [] # Output file base name for HTML help builder. htmlhelp_basename = 'notmuchdoc' From 175144f6ad313527e1dfb45b6decedc26d569917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amadeusz=20=C5=BBo=C5=82nowski?= Date: Mon, 12 May 2014 12:35:41 +0200 Subject: [PATCH 3/4] Unset html_static_path in Python bindings docs html_static_path is a kind of source directory and it was set to destination directory (../html) which caused infinite recursion with Sphinx 1.2 and above. --- bindings/python/docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/python/docs/source/conf.py b/bindings/python/docs/source/conf.py index 9db377f7..5107a96e 100644 --- a/bindings/python/docs/source/conf.py +++ b/bindings/python/docs/source/conf.py @@ -140,7 +140,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['../html'] +html_static_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. From 90f9a5e65e8dab3fad0a60530d3ffc582f1b1a93 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 11 May 2014 21:22:25 -0500 Subject: [PATCH 4/4] build: fix order of rpath In my system `pkg-config --libs talloc` returns 'Wl,-rpath,/usr/lib -ltalloc' (probably wrongly) which causes the final LDFLAGS to be something like '-Wl,-rpath,/usr/lib -Wl,-rpath,/opt/notmuch/lib', which causes the RUNPATH to be '/usr/lib:/opt/notmuch/lib', so basically defeating the whole purpose of RUNPATH. I noticed this when my /opt/notmuch/bin/notmuch (0.17) started updating the database after I updated the system (which updated the system's notmuch). This shouldn't happen. Let's move the RUNPATH flags before other external flags have a chance of screwing the build. Signed-off-by: Felipe Contreras --- Makefile.local | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile.local b/Makefile.local index 086b5a11..4f8f4640 100644 --- a/Makefile.local +++ b/Makefile.local @@ -46,15 +46,16 @@ PV_FILE=bindings/python/notmuch/version.py # Smash together user's values with our extra values FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CPPFLAGS) $(CFLAGS) $(WARN_CFLAGS) $(extra_cflags) $(CONFIGURE_CFLAGS) FINAL_CXXFLAGS = $(CPPFLAGS) $(CXXFLAGS) $(WARN_CXXFLAGS) $(extra_cflags) $(extra_cxxflags) $(CONFIGURE_CXXFLAGS) -FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Lutil -lutil -Llib -lnotmuch $(AS_NEEDED_LDFLAGS) $(GMIME_LDFLAGS) $(TALLOC_LDFLAGS) $(ZLIB_LDFLAGS) +FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Lutil -lutil -Llib -lnotmuch +ifeq ($(LIBDIR_IN_LDCONFIG),0) +FINAL_NOTMUCH_LDFLAGS += $(RPATH_LDFLAGS) +endif +FINAL_NOTMUCH_LDFLAGS += $(AS_NEEDED_LDFLAGS) $(GMIME_LDFLAGS) $(TALLOC_LDFLAGS) $(ZLIB_LDFLAGS) FINAL_NOTMUCH_LINKER = CC ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1) FINAL_NOTMUCH_LDFLAGS += $(CONFIGURE_LDFLAGS) FINAL_NOTMUCH_LINKER = CXX endif -ifeq ($(LIBDIR_IN_LDCONFIG),0) -FINAL_NOTMUCH_LDFLAGS += $(RPATH_LDFLAGS) -endif FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS) .PHONY: all