[PATCH] emacs: prefer notmuch-emacs-version in User-Agent: header
Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA use that as a part of User-Agent: header to provide more accurate version information when sending emails. In case some incomplete installation of notmuch emacs MUA is used and `notmuch-emacs-version' is defined as "unknown" then fall back to ask version info from cli (as it used to be) -- the function to do that was removed from `notmuch-version' to `notmuch-cli-version' to make things clearer and more consistent. --- NEWS | 14 ++ emacs/notmuch-hello.el | 2 +- emacs/notmuch-lib.el | 4 ++-- emacs/notmuch-mua.el | 11 --- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index f7aaedf91d07..9664146768f3 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,20 @@ Library changes Add return status to notmuch_database_close and notmuch_database_destroy +Emacs Interface +--- + +`notmuch-emacs-version` is used in `User-Agent` header + + The value of recently introduced variable `notmuch-emacs-version` is + now used as a part of `User-Agent` header when sending emails. + +Removed `notmuch-version` function by renaming it to `notmuch-cli-version` + + With existing variable `notmuch-emacs-version` the accompanied + function which retrieves the version of `notmuch-command` is + better named as `notmuch-cli-version`. + nmbug-status diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 65d062760a71..7bfa752d2a04 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -628,7 +628,7 @@ (defvar notmuch-emacs-version) (defun notmuch-hello-versions () "Display the notmuch version(s)" (interactive) - (let ((notmuch-cli-version (notmuch-version))) + (let ((notmuch-cli-version (notmuch-cli-version))) (message "notmuch version %s" (if (string= notmuch-emacs-version notmuch-cli-version) notmuch-cli-version diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 19269e3c469b..ca18ff9d5487 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -192,8 +192,8 @@ (defun notmuch-assert-cli-sane () "Perhaps you haven't run \"notmuch setup\" yet? Try running this on the command line, and then retry your notmuch command"))) -(defun notmuch-version () - "Return a string with the notmuch version number." +(defun notmuch-cli-version () + "Return a string with the notmuch-command version number." (let ((long-string ;; Trim off the trailing newline. (substring (notmuch-command-to-string "--version") 0 -1))) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 2c5888600b6c..dbf5df28669d 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -100,12 +100,17 @@ (defun notmuch-mua-user-agent-full () " " (notmuch-mua-user-agent-emacs))) +;; the following variable is defined as being defconst in notmuch-version.el +(defvar notmuch-emacs-version) + (defun notmuch-mua-user-agent-notmuch () - "Generate a `User-Agent:' string suitable for notmuch." - (concat "Notmuch/" (notmuch-version) " (http://notmuchmail.org)")) + "Generate notmuch part of `User-Agent:' string suitable for notmuch." + (concat "Notmuch/" (if (string= notmuch-emacs-version "unknown") +(notmuch-cli-version) + notmuch-emacs-version) " (http://notmuchmail.org)")) (defun notmuch-mua-user-agent-emacs () - "Generate a `User-Agent:' string suitable for notmuch." + "Generate emacs part of `User-Agent:' string suitable for notmuch." (concat "Emacs/" emacs-version " (" system-configuration ")")) (defun notmuch-mua-add-more-hidden-headers () -- 2.0.0
[PATCH v3 00/13] Implement and use database "features"
Quoth Tomi Ollila on Aug 08 at 12:55 am: > On Fri, Aug 01 2014, Austin Clements wrote: > > > This is v3 of id:1406652492-27803-1-git-send-email-amdragon at mit.edu. > > This fixes one issue and tidies up another thing in > > notmuch_database_upgrade I found while working on change tracking > > support. Most of the patches are logically identical to v2, but the > > changes ripple through the patch context, so I'm sending a new series. > > > > First, this updates notmuch->features before starting the upgrade, > > rather than after, so that functions called by upgrade will use the > > new database features instead of the old (this didn't matter in this > > series because nothing modified the database differently depending on > > features). Second, this combines multiple _notmuch_message_sync calls > > into one, which cleans up the code, should further improve upgrade > > performance, and makes way for additional per-message upgrades. > > This series looks good to me. I looked through the diffs a few times and > notmuch_database_upgrade() in lib/database.cc to see that in full. > Tests pass (also T530-upgrade now that I downloaded that one test database.) > > I googled answers to few questions along the review; one thing still > interests me -- is there potential to have speed/memory problems > when doing upgrade transaction in large/very large databases. And > how long will the (final) commit_transaction() take (i.e how > many times handle_sigalrm() is called while that is in progress...) > > (my guess is that this transaction just builds a new revision and > if it is never committed the revision is never used -- and data is > written there in some batches of suitable size -- so memory usage > and transaction commit time is O(1)) Your guess is basically right. Xapian periodically flushes stuff to disk during a transaction basically just like it does when not in a transaction; AFAIK the only difference is when it flushes out the new revision number and updated free block metadata. Hence, speed and memory use aren't affected by the use of a transaction, and commit_transaction isn't particularly sensitive to how big the transaction is. > Tomi > > > > > The diff from v2 is below (excluding patch 2, which David pushed). > > > > diff --git a/lib/database.cc b/lib/database.cc > > index b323691..d90a924 100644 > > --- a/lib/database.cc > > +++ b/lib/database.cc > > @@ -1252,6 +1252,10 @@ notmuch_database_upgrade (notmuch_database_t > > *notmuch, > > /* Perform the upgrade in a transaction. */ > > db->begin_transaction (true); > > > > +/* Set the target features so we write out changes in the desired > > + * format. */ > > +notmuch->features = target_features; > > + > > /* Perform per-message upgrades. */ > > if (new_features & > > (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_BOOL_FOLDER)) { > > @@ -1280,7 +1284,6 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, > > if (filename && *filename != '\0') { > > _notmuch_message_add_filename (message, filename); > > _notmuch_message_clear_data (message); > > - _notmuch_message_sync (message); > > } > > talloc_free (filename); > > } > > @@ -1289,10 +1292,10 @@ notmuch_database_upgrade (notmuch_database_t > > *notmuch, > > * probabilistic and stemmed. Change it to the current > > * boolean prefix. Add "path:" prefixes while at it. > > */ > > - if (new_features & NOTMUCH_FEATURE_BOOL_FOLDER) { > > + if (new_features & NOTMUCH_FEATURE_BOOL_FOLDER) > > _notmuch_message_upgrade_folder (message); > > - _notmuch_message_sync (message); > > - } > > + > > + _notmuch_message_sync (message); > > > > notmuch_message_destroy (message); > > > > @@ -1348,7 +1351,6 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, > > } > > } > > > > -notmuch->features = target_features; > > db->set_metadata ("features", _print_features (local, > > notmuch->features)); > > db->set_metadata ("version", STRINGIFY (NOTMUCH_DATABASE_VERSION)); > >
[PATCH v2] emacs: Improved compatibility for window-body-width in Emacs < 24
Fix byte compiler warning "Warning: the function `window-body-width' is not known to be defined." by moving our compatibility wrapper before its use and simplify the definition to a defalias for the old name of the function. --- Tomi pointed out that window-body-width simply used to be called window-width, so this simplifies the wrapper to a defalias. emacs/notmuch-jump.el | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 05bbce5..5eb0949 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -25,6 +25,10 @@ (require 'notmuch-lib) (require 'notmuch-hello) +(unless (fboundp 'window-body-width) + ;; Compatibility for Emacs pre-24 + (defalias 'window-body-width 'window-width)) + ;;;###autoload (defun notmuch-jump-search () "Jump to a saved search by shortcut key. @@ -165,9 +169,3 @@ (defun notmuch-jump--make-keymap (action-map) (setq notmuch-jump--action ',(third action)) (exit-minibuffer map)) - -(unless (fboundp 'window-body-width) - ;; Compatibility for Emacs pre-24 - (defun window-body-width ( window) -(let ((edges (window-inside-edges window))) - (- (caddr edges) (car edges) -- 2.0.0
[PATCH] emacs: Fix byte compile warning on Emacs < 24
Fix "Warning: the function `window-body-width' is not known to be defined." by moving our compatibility wrapper before its use. --- emacs/notmuch-jump.el | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 05bbce5..35082a6 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -25,6 +25,12 @@ (require 'notmuch-lib) (require 'notmuch-hello) +(unless (fboundp 'window-body-width) + ;; Compatibility for Emacs pre-24 + (defun window-body-width ( window) +(let ((edges (window-inside-edges window))) + (- (caddr edges) (car edges) + ;;;###autoload (defun notmuch-jump-search () "Jump to a saved search by shortcut key. @@ -165,9 +171,3 @@ (defun notmuch-jump--make-keymap (action-map) (setq notmuch-jump--action ',(third action)) (exit-minibuffer map)) - -(unless (fboundp 'window-body-width) - ;; Compatibility for Emacs pre-24 - (defun window-body-width ( window) -(let ((edges (window-inside-edges window))) - (- (caddr edges) (car edges) -- 2.0.0
Matching on any header line
Good morning, I am using mutt-kz with notmuch as the backend. I was wondering if it is possible to match on any header line? I have the problem that often To/Cc do not reveal the real destination, so I would like to match on X-Original-To: or Delivered-To: header lines. So I was wondering, if there is generic support to match on something like "header:x-original-to:this at example.org"? Cheers, Nico p.s.: Please CC on reply, I am not subscribed. -- New PGP key: 659B 0D91 E86E 7E24 FD15 69D0 C729 21A1 293F 2D24
[PATCH v3 00/13] Implement and use database "features"
On Fri, Aug 01 2014, Austin Clements wrote: > This is v3 of id:1406652492-27803-1-git-send-email-amdragon at mit.edu. > This fixes one issue and tidies up another thing in > notmuch_database_upgrade I found while working on change tracking > support. Most of the patches are logically identical to v2, but the > changes ripple through the patch context, so I'm sending a new series. > > First, this updates notmuch->features before starting the upgrade, > rather than after, so that functions called by upgrade will use the > new database features instead of the old (this didn't matter in this > series because nothing modified the database differently depending on > features). Second, this combines multiple _notmuch_message_sync calls > into one, which cleans up the code, should further improve upgrade > performance, and makes way for additional per-message upgrades. This series looks good to me. I looked through the diffs a few times and notmuch_database_upgrade() in lib/database.cc to see that in full. Tests pass (also T530-upgrade now that I downloaded that one test database.) I googled answers to few questions along the review; one thing still interests me -- is there potential to have speed/memory problems when doing upgrade transaction in large/very large databases. And how long will the (final) commit_transaction() take (i.e how many times handle_sigalrm() is called while that is in progress...) (my guess is that this transaction just builds a new revision and if it is never committed the revision is never used -- and data is written there in some batches of suitable size -- so memory usage and transaction commit time is O(1)) Tomi > > The diff from v2 is below (excluding patch 2, which David pushed). > > diff --git a/lib/database.cc b/lib/database.cc > index b323691..d90a924 100644 > --- a/lib/database.cc > +++ b/lib/database.cc > @@ -1252,6 +1252,10 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, > /* Perform the upgrade in a transaction. */ > db->begin_transaction (true); > > +/* Set the target features so we write out changes in the desired > + * format. */ > +notmuch->features = target_features; > + > /* Perform per-message upgrades. */ > if (new_features & > (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_BOOL_FOLDER)) { > @@ -1280,7 +1284,6 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, > if (filename && *filename != '\0') { > _notmuch_message_add_filename (message, filename); > _notmuch_message_clear_data (message); > - _notmuch_message_sync (message); > } > talloc_free (filename); > } > @@ -1289,10 +1292,10 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, >* probabilistic and stemmed. Change it to the current >* boolean prefix. Add "path:" prefixes while at it. >*/ > - if (new_features & NOTMUCH_FEATURE_BOOL_FOLDER) { > + if (new_features & NOTMUCH_FEATURE_BOOL_FOLDER) > _notmuch_message_upgrade_folder (message); > - _notmuch_message_sync (message); > - } > + > + _notmuch_message_sync (message); > > notmuch_message_destroy (message); > > @@ -1348,7 +1351,6 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, > } > } > > -notmuch->features = target_features; > db->set_metadata ("features", _print_features (local, > notmuch->features)); > db->set_metadata ("version", STRINGIFY (NOTMUCH_DATABASE_VERSION)); > > ___ > notmuch mailing list > notmuch at notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] emacs: prefer notmuch-emacs-version in User-Agent: header
Now that we have `notmuch-emacs-version' defined in notmuch emacs MUA use that as a part of User-Agent: header to provide more accurate version information when sending emails. In case some incomplete installation of notmuch emacs MUA is used and `notmuch-emacs-version' is defined as unknown then fall back to ask version info from cli (as it used to be) -- the function to do that was removed from `notmuch-version' to `notmuch-cli-version' to make things clearer and more consistent. --- NEWS | 14 ++ emacs/notmuch-hello.el | 2 +- emacs/notmuch-lib.el | 4 ++-- emacs/notmuch-mua.el | 11 --- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index f7aaedf91d07..9664146768f3 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,20 @@ Library changes Add return status to notmuch_database_close and notmuch_database_destroy +Emacs Interface +--- + +`notmuch-emacs-version` is used in `User-Agent` header + + The value of recently introduced variable `notmuch-emacs-version` is + now used as a part of `User-Agent` header when sending emails. + +Removed `notmuch-version` function by renaming it to `notmuch-cli-version` + + With existing variable `notmuch-emacs-version` the accompanied + function which retrieves the version of `notmuch-command` is + better named as `notmuch-cli-version`. + nmbug-status diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 65d062760a71..7bfa752d2a04 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -628,7 +628,7 @@ (defvar notmuch-emacs-version) (defun notmuch-hello-versions () Display the notmuch version(s) (interactive) - (let ((notmuch-cli-version (notmuch-version))) + (let ((notmuch-cli-version (notmuch-cli-version))) (message notmuch version %s (if (string= notmuch-emacs-version notmuch-cli-version) notmuch-cli-version diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 19269e3c469b..ca18ff9d5487 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -192,8 +192,8 @@ (defun notmuch-assert-cli-sane () Perhaps you haven't run \notmuch setup\ yet? Try running this on the command line, and then retry your notmuch command))) -(defun notmuch-version () - Return a string with the notmuch version number. +(defun notmuch-cli-version () + Return a string with the notmuch-command version number. (let ((long-string ;; Trim off the trailing newline. (substring (notmuch-command-to-string --version) 0 -1))) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 2c5888600b6c..dbf5df28669d 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -100,12 +100,17 @@ (defun notmuch-mua-user-agent-full () (notmuch-mua-user-agent-emacs))) +;; the following variable is defined as being defconst in notmuch-version.el +(defvar notmuch-emacs-version) + (defun notmuch-mua-user-agent-notmuch () - Generate a `User-Agent:' string suitable for notmuch. - (concat Notmuch/ (notmuch-version) (http://notmuchmail.org))) + Generate notmuch part of `User-Agent:' string suitable for notmuch. + (concat Notmuch/ (if (string= notmuch-emacs-version unknown) +(notmuch-cli-version) + notmuch-emacs-version) (http://notmuchmail.org))) (defun notmuch-mua-user-agent-emacs () - Generate a `User-Agent:' string suitable for notmuch. + Generate emacs part of `User-Agent:' string suitable for notmuch. (concat Emacs/ emacs-version ( system-configuration ))) (defun notmuch-mua-add-more-hidden-headers () -- 2.0.0 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH] emacs: Fix byte compile warning on Emacs 24
Fix Warning: the function `window-body-width' is not known to be defined. by moving our compatibility wrapper before its use. --- emacs/notmuch-jump.el | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 05bbce5..35082a6 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -25,6 +25,12 @@ (require 'notmuch-lib) (require 'notmuch-hello) +(unless (fboundp 'window-body-width) + ;; Compatibility for Emacs pre-24 + (defun window-body-width (optional window) +(let ((edges (window-inside-edges window))) + (- (caddr edges) (car edges) + ;;;###autoload (defun notmuch-jump-search () Jump to a saved search by shortcut key. @@ -165,9 +171,3 @@ (defun notmuch-jump--make-keymap (action-map) (setq notmuch-jump--action ',(third action)) (exit-minibuffer map)) - -(unless (fboundp 'window-body-width) - ;; Compatibility for Emacs pre-24 - (defun window-body-width (optional window) -(let ((edges (window-inside-edges window))) - (- (caddr edges) (car edges) -- 2.0.0 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2] emacs: Improved compatibility for window-body-width in Emacs 24
Fix byte compiler warning Warning: the function `window-body-width' is not known to be defined. by moving our compatibility wrapper before its use and simplify the definition to a defalias for the old name of the function. --- Tomi pointed out that window-body-width simply used to be called window-width, so this simplifies the wrapper to a defalias. emacs/notmuch-jump.el | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 05bbce5..5eb0949 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -25,6 +25,10 @@ (require 'notmuch-lib) (require 'notmuch-hello) +(unless (fboundp 'window-body-width) + ;; Compatibility for Emacs pre-24 + (defalias 'window-body-width 'window-width)) + ;;;###autoload (defun notmuch-jump-search () Jump to a saved search by shortcut key. @@ -165,9 +169,3 @@ (defun notmuch-jump--make-keymap (action-map) (setq notmuch-jump--action ',(third action)) (exit-minibuffer map)) - -(unless (fboundp 'window-body-width) - ;; Compatibility for Emacs pre-24 - (defun window-body-width (optional window) -(let ((edges (window-inside-edges window))) - (- (caddr edges) (car edges) -- 2.0.0 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v3 00/13] Implement and use database features
Quoth Tomi Ollila on Aug 08 at 12:55 am: On Fri, Aug 01 2014, Austin Clements amdra...@mit.edu wrote: This is v3 of id:1406652492-27803-1-git-send-email-amdra...@mit.edu. This fixes one issue and tidies up another thing in notmuch_database_upgrade I found while working on change tracking support. Most of the patches are logically identical to v2, but the changes ripple through the patch context, so I'm sending a new series. First, this updates notmuch-features before starting the upgrade, rather than after, so that functions called by upgrade will use the new database features instead of the old (this didn't matter in this series because nothing modified the database differently depending on features). Second, this combines multiple _notmuch_message_sync calls into one, which cleans up the code, should further improve upgrade performance, and makes way for additional per-message upgrades. This series looks good to me. I looked through the diffs a few times and notmuch_database_upgrade() in lib/database.cc to see that in full. Tests pass (also T530-upgrade now that I downloaded that one test database.) I googled answers to few questions along the review; one thing still interests me -- is there potential to have speed/memory problems when doing upgrade transaction in large/very large databases. And how long will the (final) commit_transaction() take (i.e how many times handle_sigalrm() is called while that is in progress...) (my guess is that this transaction just builds a new revision and if it is never committed the revision is never used -- and data is written there in some batches of suitable size -- so memory usage and transaction commit time is O(1)) Your guess is basically right. Xapian periodically flushes stuff to disk during a transaction basically just like it does when not in a transaction; AFAIK the only difference is when it flushes out the new revision number and updated free block metadata. Hence, speed and memory use aren't affected by the use of a transaction, and commit_transaction isn't particularly sensitive to how big the transaction is. Tomi The diff from v2 is below (excluding patch 2, which David pushed). diff --git a/lib/database.cc b/lib/database.cc index b323691..d90a924 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1252,6 +1252,10 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, /* Perform the upgrade in a transaction. */ db-begin_transaction (true); +/* Set the target features so we write out changes in the desired + * format. */ +notmuch-features = target_features; + /* Perform per-message upgrades. */ if (new_features (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_BOOL_FOLDER)) { @@ -1280,7 +1284,6 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, if (filename *filename != '\0') { _notmuch_message_add_filename (message, filename); _notmuch_message_clear_data (message); - _notmuch_message_sync (message); } talloc_free (filename); } @@ -1289,10 +1292,10 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, * probabilistic and stemmed. Change it to the current * boolean prefix. Add path: prefixes while at it. */ - if (new_features NOTMUCH_FEATURE_BOOL_FOLDER) { + if (new_features NOTMUCH_FEATURE_BOOL_FOLDER) _notmuch_message_upgrade_folder (message); - _notmuch_message_sync (message); - } + + _notmuch_message_sync (message); notmuch_message_destroy (message); @@ -1348,7 +1351,6 @@ notmuch_database_upgrade (notmuch_database_t *notmuch, } } -notmuch-features = target_features; db-set_metadata (features, _print_features (local, notmuch-features)); db-set_metadata (version, STRINGIFY (NOTMUCH_DATABASE_VERSION)); ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch