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`.
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)
=========================
# this file should be kept in sync with ../../../version
-__VERSION__ = '0.32'
+__VERSION__ = '0.32.1'
SOVERSION = '5'
+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
(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
(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)))
(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.
}
}
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) {
unset DATABASE_PATH
unset NOTMUCH_PROFILE
unset XAPIAN_PATH
+ rm -f "$HOME/mail"
cp notmuch-config-backup.${test_name} ${NOTMUCH_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}
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
symlink)
symlink_config
;;
+ home_mail)
+ home_mail_config
+ ;;
esac
test_begin_subtest "count ($config)"
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
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\"")
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
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
== 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
(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