]> git.cworth.org Git - notmuch/commitdiff
Merge branch 'release'
authorDavid Bremner <david@tethera.net>
Sat, 15 May 2021 12:10:58 +0000 (09:10 -0300)
committerDavid Bremner <david@tethera.net>
Sat, 15 May 2021 12:10:58 +0000 (09:10 -0300)
13 files changed:
NEWS
bindings/python-cffi/version.txt
bindings/python/notmuch/version.py
debian/changelog
emacs/notmuch-compat.el
emacs/notmuch-tag.el
lib/open.cc
test/T055-path-config.sh
test/T310-emacs.sh
test/T560-lib-error.sh
test/T590-libconfig.sh
test/test-lib.el
version.txt

diff --git a/NEWS b/NEWS
index 13eff6e0327128f4b616f1ddda5117233ec0e429..c0ae6afe9c7b4307a15350673c0714db0f53879c 100644 (file)
--- 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)
 =========================
 
index 00d0c14da85fbca931ae67444e526eabe087c8b8..fd9620c08c1510d4be7d653d09b499dec0f4eb20 100644 (file)
@@ -1 +1 @@
-0.32
+0.32.1
index c9f317638158999f315f965d3244dbcca0fe1e48..fc867ea76070d3b3edae9230b8ab8ee4f230f2d0 100644 (file)
@@ -1,3 +1,3 @@
 # this file should be kept in sync with ../../../version
-__VERSION__ = '0.32'
+__VERSION__ = '0.32.1'
 SOVERSION = '5'
index 7f14b43872a71c1ca27ac4462808b8c08203d579..a813c59d1a096dbda869351c1366d433eab7bc05 100644 (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
index ad134dfee99c273f7ffb5895730364902abe40af..179bf59ca86116e79b64393ff76c41d65db53be9 100644 (file)
 (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
index f348d4ae2dc82c1b0c57570269cf4015a54d939b..ebccb5a089bf59394b6e17026d68bc8ca89c4147 100644 (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.
index 84b2d6b1e56d70b092b9f9d49f1f676c7f0f84bf..1ca69665c4e446ce4023b90713a86376c91310ee 100644 (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) {
index 2045a55568da7f7b5e9d5cc3c120e4113df7662e..8ef76aed9273305f0b977eb8d4d4ee3bbdb58474 100755 (executable)
@@ -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
index e64627c6729fab8a1606730f7f036bdccd5db0ba..851ef64eaf5cf6d14328515708203d2349f8757e 100755 (executable)
@@ -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\"")
index 89447e9a073da5d74342e32eba259d6a666e67d9..1f4482cbe3d30cadf43ca362aa7f4ea946e22d70 100755 (executable)
@@ -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
 
index 51dd29c845584fefbe4d8f089d440da4070ed8a1..745e1bb4c491ac7f7a2b2fe1e3aa4983d0ec80bd 100755 (executable)
@@ -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
index 4de5b292c6071cb54e3dcf89e4c06fb64288fa27..32d53736482493f3cf336c187b0990cd97d57223 100644 (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
index 00d0c14da85fbca931ae67444e526eabe087c8b8..fd9620c08c1510d4be7d653d09b499dec0f4eb20 100644 (file)
@@ -1 +1 @@
-0.32
+0.32.1