Merge branch 'release'

This commit is contained in:
David Bremner 2021-05-15 09:10:58 -03:00
commit c84ccb70f3
13 changed files with 110 additions and 13 deletions

14
NEWS
View file

@ -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)
=========================

View file

@ -1 +1 @@
0.32
0.32.1

View file

@ -1,3 +1,3 @@
# this file should be kept in sync with ../../../version
__VERSION__ = '0.32'
__VERSION__ = '0.32.1'
SOVERSION = '5'

9
debian/changelog vendored
View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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) {

View file

@ -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

View file

@ -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\"")

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1 +1 @@
0.32
0.32.1