aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-05-15 09:10:58 -0300
committerDavid Bremner <david@tethera.net>2021-05-15 09:10:58 -0300
commitc84ccb70f3ed2b2228346499b5110311039a0ecf (patch)
tree373ab71c8d6799b393dab21a46d4a773fac6ae53
parentccd2ef38718efa3c9268eb68ad54454609e4451c (diff)
parentb580009e2bc69efb019983bf2f7dc5052c19545a (diff)
Merge branch 'release'
-rw-r--r--NEWS14
-rw-r--r--bindings/python-cffi/version.txt2
-rw-r--r--bindings/python/notmuch/version.py2
-rw-r--r--debian/changelog9
-rw-r--r--emacs/notmuch-compat.el12
-rw-r--r--emacs/notmuch-tag.el8
-rw-r--r--lib/open.cc19
-rwxr-xr-xtest/T055-path-config.sh22
-rwxr-xr-xtest/T310-emacs.sh22
-rwxr-xr-xtest/T560-lib-error.sh4
-rwxr-xr-xtest/T590-libconfig.sh4
-rw-r--r--test/test-lib.el3
-rw-r--r--version.txt2
13 files changed, 110 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index 13eff6e0..c0ae6afe 100644
--- a/NEWS
+++ b/NEWS
@@ -6,9 +6,12 @@ Vim
Respect excluded tags when showing a thread.
-Notmuch 0.32.1 (UNRELEASED)
+Notmuch 0.32.1 (2021-05-15)
===========================
+General
+-------
+
Restore handling of relative values for `database.path` that was
broken by 0.32. Extend this handling to `database.mail_root`,
`database.backup_dir`, and `database.hook_dir`.
@@ -17,6 +20,15 @@ Reload certain metadata from Xapian database in
notmuch_database_reopen. This fixes a bug when adding messages to the
database in a pre-new hook.
+Fix default of `$HOME/mail` for `database.path`. In release 0.32, this
+default worked only in "notmuch config".
+
+Emacs
+-----
+
+Restore the dynamically bound variables `tag-changes` and `query` in
+in `notmuch-before-tag-hook` and `notmuch-after-tag-hook`.
+
Notmuch 0.32 (2021-05-02)
=========================
diff --git a/bindings/python-cffi/version.txt b/bindings/python-cffi/version.txt
index 00d0c14d..fd9620c0 100644
--- a/bindings/python-cffi/version.txt
+++ b/bindings/python-cffi/version.txt
@@ -1 +1 @@
-0.32
+0.32.1
diff --git a/bindings/python/notmuch/version.py b/bindings/python/notmuch/version.py
index c9f31763..fc867ea7 100644
--- a/bindings/python/notmuch/version.py
+++ b/bindings/python/notmuch/version.py
@@ -1,3 +1,3 @@
# this file should be kept in sync with ../../../version
-__VERSION__ = '0.32'
+__VERSION__ = '0.32.1'
SOVERSION = '5'
diff --git a/debian/changelog b/debian/changelog
index 7f14b438..a813c59d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+notmuch (0.32.1-1) experimental; urgency=medium
+
+ * New upstream bugfix release
+ * Configuration bug fixes (see /usr/share/doc/notmuch/NEWS.gz)
+ * Bug fix for {pre,after}-tag hooks in emacs, related to lexical scope
+ transition.
+
+ -- David Bremner <bremner@debian.org> Sat, 15 May 2021 09:01:27 -0300
+
notmuch (0.32-1) experimental; urgency=medium
* New upstream release
diff --git a/emacs/notmuch-compat.el b/emacs/notmuch-compat.el
index ad134dfe..179bf59c 100644
--- a/emacs/notmuch-compat.el
+++ b/emacs/notmuch-compat.el
@@ -41,6 +41,18 @@
(unless (fboundp 'message--fold-long-headers)
(add-hook 'message-header-hook 'notmuch-message--fold-long-headers))
+;; `dlet' isn't available until Emacs 28.1. Below is a copy, with the
+;; addition of `with-no-warnings'.
+(defmacro notmuch-dlet (binders &rest body)
+ "Like `let*' but using dynamic scoping."
+ (declare (indent 1) (debug let))
+ `(let (_)
+ (with-no-warnings ; Quiet "lacks a prefix" warning.
+ ,@(mapcar (lambda (binder)
+ `(defvar ,(if (consp binder) (car binder) binder)))
+ binders))
+ (let* ,binders ,@body)))
+
(provide 'notmuch-compat)
;;; notmuch-compat.el ends here
diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index f348d4ae..ebccb5a0 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -486,7 +486,9 @@ notmuch-after-tag-hook will be run."
(unless query
(error "Nothing to tag!"))
(when tag-changes
- (run-hooks 'notmuch-before-tag-hook)
+ (notmuch-dlet ((tag-changes tag-changes)
+ (query query))
+ (run-hooks 'notmuch-before-tag-hook))
(if (<= (length query) notmuch-tag-argument-limit)
(apply 'notmuch-call-notmuch-process "tag"
(append tag-changes (list "--" query)))
@@ -494,7 +496,9 @@ notmuch-after-tag-hook will be run."
(let ((batch-op (concat (mapconcat #'notmuch-hex-encode tag-changes " ")
" -- " query)))
(notmuch-call-notmuch-process :stdin-string batch-op "tag" "--batch")))
- (run-hooks 'notmuch-after-tag-hook)))
+ (notmuch-dlet ((tag-changes tag-changes)
+ (query query))
+ (run-hooks 'notmuch-after-tag-hook))))
(defun notmuch-tag-change-list (tags &optional reverse)
"Convert TAGS into a list of tag changes.
diff --git a/lib/open.cc b/lib/open.cc
index 84b2d6b1..1ca69665 100644
--- a/lib/open.cc
+++ b/lib/open.cc
@@ -209,8 +209,25 @@ _choose_database_path (void *ctx,
}
}
if (! *database_path) {
+ notmuch_status_t status;
+
*database_path = _xdg_dir (ctx, "XDG_DATA_HOME", ".local/share", profile);
- *split = true;
+ status = _db_dir_exists (*database_path, message);
+ if (status) {
+ *database_path = NULL;
+ } else {
+ *split = true;
+ }
+ }
+
+ if (! *database_path) {
+ notmuch_status_t status;
+
+ *database_path = talloc_asprintf (ctx, "%s/mail", getenv ("HOME"));
+ status = _db_dir_exists (*database_path, message);
+ if (status) {
+ *database_path = NULL;
+ }
}
if (*database_path == NULL) {
diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh
index 2045a555..8ef76aed 100755
--- a/test/T055-path-config.sh
+++ b/test/T055-path-config.sh
@@ -16,6 +16,7 @@ restore_config () {
unset DATABASE_PATH
unset NOTMUCH_PROFILE
unset XAPIAN_PATH
+ rm -f "$HOME/mail"
cp notmuch-config-backup.${test_name} ${NOTMUCH_CONFIG}
}
@@ -42,6 +43,18 @@ symlink_config () {
unset DATABASE_PATH
}
+
+home_mail_config () {
+ local dir
+ backup_config
+ dir="${HOME}/mail"
+ ln -s $MAIL_DIR $dir
+ notmuch config set database.path
+ notmuch config set database.mail_root
+ XAPIAN_PATH="$MAIL_DIR/.notmuch/xapian"
+ unset DATABASE_PATH
+}
+
xdg_config () {
local dir
local profile=${1:-default}
@@ -66,7 +79,7 @@ xdg_config () {
notmuch --config=${CONFIG_PATH} config set database.path
}
-for config in traditional split XDG XDG+profile symlink; do
+for config in traditional split XDG XDG+profile symlink home_mail; do
#start each set of tests with an known set of messages
add_email_corpus
@@ -90,6 +103,9 @@ for config in traditional split XDG XDG+profile symlink; do
symlink)
symlink_config
;;
+ home_mail)
+ home_mail_config
+ ;;
esac
test_begin_subtest "count ($config)"
@@ -236,7 +252,9 @@ EOF
test_begin_subtest "Config list ($config)"
notmuch config list | notmuch_dir_sanitize | sed -e "s/^database.backup_dir=.*$/database.backup_dir/" \
-e "s/^database.hook_dir=.*$/database.hook_dir/" \
- -e "s/^database.path=.*$/database.path/" > OUTPUT
+ -e "s/^database.path=.*$/database.path/" \
+ -e "s,^database.mail_root=CWD/home/mail,database.mail_root=MAIL_DIR," \
+ > OUTPUT
cat <<EOF > EXPECTED
built_with.compact=true
built_with.field_processor=true
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index e64627c6..851ef64e 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -162,6 +162,28 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")
output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
+test_begin_subtest "notmuch-show: before-tag-hook is run, variables are defined"
+output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil)
+ (notmuch-before-tag-hook (function notmuch-test-tag-hook)))
+ (notmuch-show "id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com")
+ (execute-kbd-macro "+activate-hook\n")
+ (execute-kbd-macro "-activate-hook\n")
+ notmuch-test-tag-hook-output)')
+test_expect_equal "$output" \
+'(("id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com" "-activate-hook")
+ ("id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com" "+activate-hook"))'
+
+test_begin_subtest "notmuch-show: after-tag-hook is run, variables are defined"
+output=$(test_emacs '(let ((notmuch-test-tag-hook-output nil)
+ (notmuch-after-tag-hook (function notmuch-test-tag-hook)))
+ (notmuch-show "id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com")
+ (execute-kbd-macro "+activate-hook\n")
+ (execute-kbd-macro "-activate-hook\n")
+ notmuch-test-tag-hook-output)')
+test_expect_equal "$output" \
+'(("id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com" "-activate-hook")
+ ("id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com" "+activate-hook"))'
+
test_begin_subtest "Message with .. in Message-Id:"
add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
test_emacs '(notmuch-search "id:\"123..456@example\"")
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 89447e9a..1f4482cb 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -22,7 +22,7 @@ EOF
cat <<'EOF' >EXPECTED
== stdout ==
== stderr ==
-Error: Cannot open database at CWD/home/.local/share/notmuch/default: No such file or directory.
+Error: could not locate database.
EOF
test_expect_equal_file EXPECTED OUTPUT
@@ -93,7 +93,7 @@ EOF
cat <<'EOF' >EXPECTED
== stdout ==
== stderr ==
-Error: Cannot open database at CWD/home/.local/share/notmuch/default: No such file or directory.
+Error: could not locate database.
EOF
test_expect_equal_file EXPECTED OUTPUT
diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh
index 51dd29c8..745e1bb4 100755
--- a/test/T590-libconfig.sh
+++ b/test/T590-libconfig.sh
@@ -546,8 +546,8 @@ cat <<'EOF' >EXPECTED
== stdout ==
== stderr ==
error opening database
-Something went wrong trying to read or write a file
-Error: Cannot open database at CWD/home/.local/share/notmuch/default: No such file or directory.
+No database found
+Error: could not locate database.
EOF
test_expect_equal_file EXPECTED OUTPUT
diff --git a/test/test-lib.el b/test/test-lib.el
index 4de5b292..32d53736 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -99,6 +99,9 @@ running, quit if it terminated."
(add-hook 'notmuch-hello-refresh-hook
(lambda () (cl-incf notmuch-hello-refresh-hook-counter)))
+(defvar notmuch-test-tag-hook-output nil)
+(defun notmuch-test-tag-hook () (push (cons query tag-changes) notmuch-test-tag-hook-output))
+
(defun notmuch-test-mark-links ()
"Enclose links in the current buffer with << and >>."
;; Links are often created by jit-lock functions
diff --git a/version.txt b/version.txt
index 00d0c14d..fd9620c0 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-0.32
+0.32.1