[PATCH 5/5] doc: document database.autocommit variable
This exposes some database internals that most users will probably not understand. --- doc/man1/notmuch-config.rst | 10 ++ 1 file changed, 10 insertions(+) diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst index 75c59ff9..7d709bfb 100644 --- a/doc/man1/notmuch-config.rst +++ b/doc/man1/notmuch-config.rst @@ -78,6 +78,16 @@ paths are presumed relative to `$HOME` for items in section Directory containing hooks run by notmuch commands. See **notmuch-hooks(5)**. +History: this configuration value was introduced in notmuch 0.32. + +**database.autocommit** + +How often to commit transactions to disk. `0` means wait until +command completes, otherwise an integer `n` specifies to commit to +disk after every `n` completed transactions. + +History: this configuration value was introduced in notmuch 0.33. + **user.name** Your full name. -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 3/5] test: add known broken test for closing with open transaction
The expected output may need adjusting, but what is clear is that saving none of the changes is not desirable. --- test/T385-transactions.sh | 36 1 file changed, 36 insertions(+) create mode 100755 test/T385-transactions.sh diff --git a/test/T385-transactions.sh b/test/T385-transactions.sh new file mode 100755 index ..ebfec2ed --- /dev/null +++ b/test/T385-transactions.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +test_description='transactions' +. $(dirname "$0")/test-lib.sh || exit 1 + +make_shim no-close < +#include +notmuch_status_t +notmuch_database_close (notmuch_database_t *notmuch) +{ + return notmuch_database_begin_atomic (notmuch); +} +EOF + +for i in `seq 1 1024` +do +generate_message '[subject]="'"subject $i"'"' \ +'[body]="'"body $i"'"' +done + +test_begin_subtest "initial new" +NOTMUCH_NEW > OUTPUT +cat < EXPECTED +Added 1024 new messages to the database. +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "Some changes saved with open transaction" +test_subtest_known_broken +notmuch config set database.autocommit 1000 +rm -r ${MAIL_DIR}/.notmuch +notmuch_with_shim no-close new +output=$(notmuch count '*') +test_expect_equal "$output" "1000" + +test_done -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 2/5] lib/config: add NOTMUCH_CONFIG_AUTOCOMMIT
This will be used to control how often atomic transactions are committed. --- lib/config.cc| 4 lib/notmuch.h| 1 + test/T030-config.sh | 1 + test/T055-path-config.sh | 1 + test/T590-libconfig.sh | 4 5 files changed, 11 insertions(+) diff --git a/lib/config.cc b/lib/config.cc index 0ec66372..13eab5f1 100644 --- a/lib/config.cc +++ b/lib/config.cc @@ -593,6 +593,8 @@ _notmuch_config_key_to_string (notmuch_config_key_t key) return "user.other_email"; case NOTMUCH_CONFIG_USER_NAME: return "user.name"; +case NOTMUCH_CONFIG_AUTOCOMMIT: + return "database.autocommit"; default: return NULL; } @@ -638,6 +640,8 @@ _notmuch_config_default (notmuch_database_t *notmuch, notmuch_config_key_t key) return email; case NOTMUCH_CONFIG_NEW_IGNORE: return ""; +case NOTMUCH_CONFIG_AUTOCOMMIT: + return "8000"; case NOTMUCH_CONFIG_HOOK_DIR: case NOTMUCH_CONFIG_BACKUP_DIR: case NOTMUCH_CONFIG_OTHER_EMAIL: diff --git a/lib/notmuch.h b/lib/notmuch.h index 4b053932..5c3be342 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -2520,6 +2520,7 @@ typedef enum _notmuch_config_key { NOTMUCH_CONFIG_PRIMARY_EMAIL, NOTMUCH_CONFIG_OTHER_EMAIL, NOTMUCH_CONFIG_USER_NAME, +NOTMUCH_CONFIG_AUTOCOMMIT, NOTMUCH_CONFIG_LAST } notmuch_config_key_t; diff --git a/test/T030-config.sh b/test/T030-config.sh index 7a1660e9..751feaf3 100755 --- a/test/T030-config.sh +++ b/test/T030-config.sh @@ -51,6 +51,7 @@ cat < EXPECTED built_with.compact=something built_with.field_processor=something built_with.retry_lock=something +database.autocommit=8000 database.mail_root=MAIL_DIR database.path=MAIL_DIR foo.list=this;is another;list value; diff --git a/test/T055-path-config.sh b/test/T055-path-config.sh index 8ef76aed..bb3bf665 100755 --- a/test/T055-path-config.sh +++ b/test/T055-path-config.sh @@ -259,6 +259,7 @@ EOF built_with.compact=true built_with.field_processor=true built_with.retry_lock=true +database.autocommit=8000 database.backup_dir database.hook_dir database.mail_root=MAIL_DIR diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh index 745e1bb4..d922c3af 100755 --- a/test/T590-libconfig.sh +++ b/test/T590-libconfig.sh @@ -400,6 +400,7 @@ true USERNAME@FQDN NULL USER_FULL_NAME +8000 == stderr == EOF unset MAILDIR @@ -711,6 +712,7 @@ true test_su...@notmuchmail.org test_suite_ot...@notmuchmail.org;test_su...@otherdomain.org Notmuch Test Suite +8000 == stderr == EOF test_expect_equal_file EXPECTED OUTPUT @@ -742,6 +744,7 @@ true USERNAME@FQDN NULL USER_FULL_NAME +8000 == stderr == EOF test_expect_equal_file EXPECTED OUTPUT.clean @@ -808,6 +811,7 @@ EOF cat <<'EOF' >EXPECTED == stdout == aaabefore beforeval +database.autocommit 8000 database.backup_dir MAIL_DIR/.notmuch/backups database.hook_dir MAIL_DIR/.notmuch/hooks database.mail_root MAIL_DIR -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 4/5] lib: autocommit after some number of completed transactions
This change addresses two known issues with large sets of changes to the database. The first is that as reported by Steven Allen [1], notmuch commits are not "flushed" when they complete, which means that if there is an open transaction when the database closes (or e.g. the program crashes) then all changes since the last commit will be discarded (nothing is irrecoverably lost for "notmuch new", as the indexing process just restarts next time it is run). This does not really "fix" the issue reported in [1]; that seems rather difficult given how transactions work in Xapian. On the other hand, with the default settings, this should mean one only loses less than a minutes worth of work. The second issue is the occasionally reported "storm" of disk writes when notmuch finishes. I don't yet have a test for this, but I think committing as we go should reduce the amount of work when finalizing the database. [1]: id:20151025210215.ga3...@stebalien.com --- lib/database-private.h| 5 + lib/database.cc | 18 +- lib/open.cc | 12 test/T385-transactions.sh | 1 - 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/database-private.h b/lib/database-private.h index 1a73dacc..9706c17e 100644 --- a/lib/database-private.h +++ b/lib/database-private.h @@ -212,6 +212,11 @@ struct _notmuch_database { char thread_id_str[17]; uint64_t last_thread_id; +/* How many transactions have successfully completed since we last committed */ +int transaction_count; +/* when to commit and reset the counter */ +int transaction_threshold; + /* error reporting; this value persists only until the * next library call. May be NULL */ char *status_string; diff --git a/lib/database.cc b/lib/database.cc index db7feca2..dafea4ce 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -1125,13 +1125,21 @@ notmuch_database_end_atomic (notmuch_database_t *notmuch) db = notmuch->writable_xapian_db; try { db->commit_transaction (); - - /* This is a hack for testing. Xapian never flushes on a -* non-flushed commit, even if the flush threshold is 1. -* However, we rely on flushing to test atomicity. */ + notmuch->transaction_count++; + + /* Xapian never flushes on a non-flushed commit, even if the +* flush threshold is 1. However, we rely on flushing to test +* atomicity. On the other hand, we can't straight replace +* XAPIAN_FLUSH_THRESHOLD with our autocommit counter, because +* the former also applies outside notmuch atomic +* commits. Hence the follow complicated test */ const char *thresh = getenv ("XAPIAN_FLUSH_THRESHOLD"); - if (thresh && atoi (thresh) == 1) + if ((notmuch->transaction_threshold > 0 && +notmuch->transaction_count >= notmuch->transaction_threshold) || + (thresh && atoi (thresh) == 1)) { db->commit (); + notmuch->transaction_count = 0; + } } catch (const Xapian::Error &error) { _notmuch_database_log (notmuch, "A Xapian exception occurred committing transaction: %s.\n", error.get_msg ().c_str ()); diff --git a/lib/open.cc b/lib/open.cc index 1ca69665..706a23e1 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -256,6 +256,8 @@ _alloc_notmuch () notmuch->writable_xapian_db = NULL; notmuch->config_path = NULL; notmuch->atomic_nesting = 0; +notmuch->transaction_count = 0; +notmuch->transaction_threshold = 0; notmuch->view = 1; return notmuch; } @@ -365,6 +367,8 @@ _finish_open (notmuch_database_t *notmuch, notmuch_status_t status = NOTMUCH_STATUS_SUCCESS; char *incompat_features; char *message = NULL; +const char *autocommit_str; +char *autocommit_end; unsigned int version; const char *database_path = notmuch_database_get_path (notmuch); @@ -461,6 +465,14 @@ _finish_open (notmuch_database_t *notmuch, if (status) goto DONE; + autocommit_str = notmuch_config_get (notmuch, NOTMUCH_CONFIG_AUTOCOMMIT); + if (unlikely (!autocommit_str)) { + INTERNAL_ERROR ("missing configuration for autocommit"); + } + notmuch->transaction_threshold = strtoul (autocommit_str, &autocommit_end, 10); + if (*autocommit_end != '\0') + INTERNAL_ERROR ("Malformed database database.autocommit value: %s", autocommit_str); + status = _notmuch_database_setup_standard_query_fields (notmuch); if (status) goto DONE; diff --git a/test/T385-transactions.sh b/test/T385-transactions.sh index ebfec2ed..d8bb502d 100755 --- a/test/T385-transactions.sh +++ b/test/T385-transactions.sh @@ -26,7 +26,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "Some changes saved with open transaction" -test_subtest_known_broken notmuch config set database.autocommit 1000 rm -r ${M
Commit after some number of transactions
The main rational is explained in the commit message to [PATCH 4/5] lib: autocommit after some number of completed I'm not super-happy with the documentation in [5/5], as it explains things in terms of database concepts the user shouldn't really need to understand. [PATCH 5/5] doc: document database.autocommit variable The default value of 8000 was chose not to cause any noticable slowdown when indexing the "large" corpus of about 200k messages. The test machine is a recent Xeon with fast spinning rust drives; the whole index takes about 8.5 minutes on this machine. I'd be curious if other people notice a performance impact. On the same machine the threshold of 8000 means that less than 30 seconds worth of work would be discarded. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 1/5] database/close: remove misleading code / comment
Unfortunately, it doesn't make a difference if we call cancel_transaction or not, all uncommited changes are discarded if there is an open (unflushed) transaction. --- lib/database.cc | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 96458f6f..db7feca2 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -502,17 +502,9 @@ notmuch_database_close (notmuch_database_t *notmuch) * close it. Thus, we explicitly close it here. */ if (notmuch->open) { try { - /* If there's an outstanding transaction, it's unclear if -* closing the Xapian database commits everything up to -* that transaction, or may discard committed (but -* unflushed) transactions. To be certain, explicitly -* cancel any outstanding transaction before closing. */ - if (_notmuch_database_mode (notmuch) == NOTMUCH_DATABASE_MODE_READ_WRITE && - notmuch->atomic_nesting) - notmuch->writable_xapian_db->cancel_transaction (); - /* Close the database. This implicitly flushes -* outstanding changes. */ +* outstanding changes. If there is an open (non-flushed) +* transaction, ALL pending changes will be discarded */ notmuch->xapian_db->close (); } catch (const Xapian::Error &error) { status = NOTMUCH_STATUS_XAPIAN_EXCEPTION; -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH] configure: $(CC) -o /dev/null when output not run
When C compilation is used just to see whether compilation succeeds, there is no need to write any output file. Some compilations in configure already did this. Now also rm -f lines are used more consistently. While at it reformatted code that prints LIBNOTMUCH_{MAJOR,MINOR,MICRO}_VERSION). --- Hmm, these printf("libnotmuch_version_major=%d\n", LIBNOTMUCH_MAJOR_VERSION) lines leaked into this commit. I've always wanted to make this change (as it fits and looks clearer) but haven't found good commit for that Now edited commit message to mention the change. configure | 57 ++- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/configure b/configure index cfa9c09b..e907c6fc 100755 --- a/configure +++ b/configure @@ -362,7 +362,7 @@ errors=0 printf "int main(void){return 0;}\n" > minimal.c printf "Sanity checking C compilation environment... " -test_cmdline="${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal" +test_cmdline="${CC} ${CFLAGS} ${CPPFLAGS} minimal.c ${LDFLAGS} -o /dev/null" if ${test_cmdline} > /dev/null 2>&1 then printf "OK.\n" @@ -374,7 +374,7 @@ else fi printf "Sanity checking C++ compilation environment... " -test_cmdline="${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o minimal" +test_cmdline="${CXX} ${CXXFLAGS_for_sh} ${CPPFLAGS} minimal.c ${LDFLAGS} -o /dev/null" if ${test_cmdline} > /dev/null 2>&1 then printf "OK.\n" @@ -392,7 +392,7 @@ if [ $errors -gt 0 ]; then running configure in a clean environment, and if the problem persists, report a bug. EOF -rm -f minimal minimal.c +rm -f minimal.c exit 1 fi @@ -401,12 +401,9 @@ cat > _libversion.c < #include "lib/notmuch.h" int main(void) { -printf("libnotmuch_version_major=%d\n", - LIBNOTMUCH_MAJOR_VERSION); -printf("libnotmuch_version_minor=%d\n", - LIBNOTMUCH_MINOR_VERSION); -printf("libnotmuch_version_release=%d\n", - LIBNOTMUCH_MICRO_VERSION); +printf("libnotmuch_version_major=%d\n",LIBNOTMUCH_MAJOR_VERSION); +printf("libnotmuch_version_minor=%d\n",LIBNOTMUCH_MINOR_VERSION); +printf("libnotmuch_version_release=%d\n", LIBNOTMUCH_MICRO_VERSION); return 0; } EOF @@ -432,7 +429,6 @@ else fi - printf "Checking for Xapian development files (>= 1.4.0)... " have_xapian=0 for xapian_config in ${XAPIAN_CONFIG} xapian-config; do @@ -1045,7 +1041,7 @@ EOF fi printf "Checking for canonicalize_file_name... " -if ${CC} -o compat/have_canonicalize_file_name "$srcdir"/compat/have_canonicalize_file_name.c > /dev/null 2>&1 +if ${CC} -o /dev/null "$srcdir"/compat/have_canonicalize_file_name.c > /dev/null 2>&1 then printf "Yes.\n" have_canonicalize_file_name=1 @@ -1053,11 +1049,9 @@ else printf "No (will use our own instead).\n" have_canonicalize_file_name=0 fi -rm -f compat/have_canonicalize_file_name - printf "Checking for getline... " -if ${CC} -o compat/have_getline "$srcdir"/compat/have_getline.c > /dev/null 2>&1 +if ${CC} -o /dev/null "$srcdir"/compat/have_getline.c > /dev/null 2>&1 then printf "Yes.\n" have_getline=1 @@ -1065,10 +1059,9 @@ else printf "No (will use our own instead).\n" have_getline=0 fi -rm -f compat/have_getline printf "Checking for strcasestr... " -if ${CC} -o compat/have_strcasestr "$srcdir"/compat/have_strcasestr.c > /dev/null 2>&1 +if ${CC} -o /dev/null "$srcdir"/compat/have_strcasestr.c > /dev/null 2>&1 then printf "Yes.\n" have_strcasestr=1 @@ -1076,10 +1069,9 @@ else printf "No (will use our own instead).\n" have_strcasestr=0 fi -rm -f compat/have_strcasestr printf "Checking for strsep... " -if ${CC} -o compat/have_strsep "$srcdir"/compat/have_strsep.c > /dev/null 2>&1 +if ${CC} -o /dev/null "$srcdir"/compat/have_strsep.c > /dev/null 2>&1 then printf "Yes.\n" have_strsep="1" @@ -1087,10 +1079,9 @@ else printf "No (will use our own instead).\n" have_strsep="0" fi -rm -f compat/have_strsep printf "Checking for timegm... " -if ${CC} -o compat/have_timegm "$srcdir"/compat/have_timegm.c > /dev/null 2>&1 +if ${CC} -o /dev/null "$srcdir"/compat/have_timegm.c > /dev/null 2>&1 then printf "Yes.\n" have_timegm="1" @@ -1098,7 +1089,6 @@ else printf "No (will use our own instead).\n" have_timegm="0" fi -rm -f compat/have_timegm cat < _time_t.c #include @@ -1117,7 +1107,7 @@ else fi printf "Checking for dirent.d_type... " -if ${CC} -o compat/have_d_type "$srcdir"/compat/have_d_type.c > /dev/null 2>&1 +if ${CC} -o /dev/null "$srcdir"/compat/have_d_type.c > /dev/null 2>&1 then printf "Yes.\n" have_d_type="1" @@ -1125,10 +1115,9 @@ else printf "No (will use stat instead).\n" have_d_type="0" fi -rm -f compat/have_d_type printf "Checking for standard version of getpwuid_r... " -if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > /dev/n
[PATCH 4/5] doc: use program and option directives to document options
Use the program and option directives to document the subcommand options. This unifies a lot of option documentation throughout. This also makes it possible to reference options with :option:`--foo` (within .. program::) or :option:`subcommand --foo` (globally). This is left for later work. See https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#directive-program Note: There is a lot of indentation change, but intentionally there is no reflow. Using 'git diff -w' or 'git show -w' to ignore white space changes makes this a very easy change to review. --- doc/man1/notmuch-address.rst | 174 + doc/man1/notmuch-compact.rst | 20 +- doc/man1/notmuch-config.rst| 45 +++-- doc/man1/notmuch-count.rst | 71 --- doc/man1/notmuch-dump.rst | 146 +++--- doc/man1/notmuch-emacs-mua.rst | 80 doc/man1/notmuch-insert.rst| 100 +- doc/man1/notmuch-new.rst | 67 --- doc/man1/notmuch-reindex.rst | 47 ++--- doc/man1/notmuch-reply.rst | 117 +-- doc/man1/notmuch-restore.rst | 118 ++-- doc/man1/notmuch-search.rst| 234 +++--- doc/man1/notmuch-show.rst | 343 + doc/man1/notmuch-tag.rst | 37 ++-- doc/man1/notmuch.rst | 44 +++-- 15 files changed, 874 insertions(+), 769 deletions(-) diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst index 9eae65cbae8f..7423b6295508 100644 --- a/doc/man1/notmuch-address.rst +++ b/doc/man1/notmuch-address.rst @@ -20,89 +20,97 @@ See :any:`notmuch-search-terms(7)` for details of the supported syntax for Supported options for **address** include -``--format=``\ (**json**\ \|\ **sexp**\ \|\ **text**\ \|\ **text0**) -Presents the results in either JSON, S-Expressions, newline -character separated plain-text (default), or null character -separated plain-text (compatible with :manpage:`xargs(1)` -0 -option where available). - -``--format-version=N`` -Use the specified structured output format version. This is -intended for programs that invoke :any:`notmuch(1)` internally. If -omitted, the latest supported version will be used. - -``--output=(sender|recipients|count|address)`` -Controls which information appears in the output. This option can -be given multiple times to combine different outputs. When -neither ``--output=sender`` nor ``--output=recipients`` is -given, ``--output=sender`` is implied. - -**sender** -Output all addresses from the *From* header. - -Note: Searching for **sender** should be much faster than -searching for **recipients**, because sender addresses are -cached directly in the database whereas other addresses need -to be fetched from message files. - -**recipients** -Output all addresses from the *To*, *Cc* and *Bcc* headers. - -**count** -Print the count of how many times was the address encountered -during search. - -Note: With this option, addresses are printed only after the -whole search is finished. This may take long time. - -**address** -Output only the email addresses instead of the full mailboxes -with names and email addresses. This option has no effect on -the JSON or S-Expression output formats. - -``--deduplicate=(no|mailbox|address)`` -Control the deduplication of results. - -**no** -Output all occurrences of addresses in the matching -messages. This is not applicable with ``--output=count``. - -**mailbox** -Deduplicate addresses based on the full, case sensitive name -and email address, or mailbox. This is effectively the same as -piping the ``--deduplicate=no`` output to **sort | uniq**, except -for the order of results. This is the default. - -**address** -Deduplicate addresses based on the case insensitive address -part of the mailbox. Of all the variants (with different name -or case), print the one occurring most frequently among the -matching messages. If ``--output=count`` is specified, include all -variants in the count. - -``--sort=``\ (**newest-first**\ \|\ **oldest-first**) -This option can be used to present results in either chronological -order (**oldest-first**) or reverse chronological order -(**newest-first**). - -By default, results will be displayed in reverse chronological -order, (that is, the newest results will be displayed first). - -However, if either ``--output=count`` or ``--deduplicate=address`` is -specified, this option is ignored and the order of the results is -unspecified. - -``--exclude=(true|false)`` -A message is called "excluded" if it matches at least one tag in -search.exclude\_tags that does not appear explicitly in the search -terms. This option specifies whether to omit excluded mess
[PATCH 5/5] doc: example command-line option reference
Example reference to a command-line option using the option role reference. This creates a hyperlink in html, and the usual boldface style in man page. This could be used throughout the man pages. --- doc/man1/notmuch-config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst index af126289a97f..56f4a1600153 100644 --- a/doc/man1/notmuch-config.rst +++ b/doc/man1/notmuch-config.rst @@ -248,7 +248,7 @@ CONFIGURATION Notmuch configuration file search order: -1. File specified by ``--config=FILE`` global option; see +1. File specified by :option:`notmuch --config` global option; see :any:`notmuch(1)`. 2. File specified by :envvar:`NOTMUCH_CONFIG` environment variable. -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH 3/5] doc: use envvar directive and role for environment variables
Make man1/notmuch.rst the single point of truth for describing notmuch environment variables. Use the envvar directive for that, and reference them with the envvar role. Drive-by cleanup configuration file and hook directory search order documentation. --- doc/man1/notmuch-compact.rst | 10 doc/man1/notmuch-config.rst| 42 +- doc/man1/notmuch-emacs-mua.rst | 10 doc/man1/notmuch.rst | 36 + 4 files changed, 49 insertions(+), 49 deletions(-) diff --git a/doc/man1/notmuch-compact.rst b/doc/man1/notmuch-compact.rst index 85f611bf44e5..3e3e70c532ca 100644 --- a/doc/man1/notmuch-compact.rst +++ b/doc/man1/notmuch-compact.rst @@ -35,16 +35,6 @@ Supported options for **compact** include ``--quiet`` Do not report database compaction progress to stdout. -ENVIRONMENT -=== - -The following environment variables can be used to control the behavior -of notmuch. - -**NOTMUCH\_CONFIG** -Specifies the location of the notmuch configuration file. Notmuch -will use ${HOME}/.notmuch-config if this variable is not set. - SEE ALSO diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst index 5c980a8a4bb8..129d4b810261 100644 --- a/doc/man1/notmuch-config.rst +++ b/doc/man1/notmuch-config.rst @@ -235,39 +235,39 @@ paths are presumed relative to `$HOME` for items in section :any:`notmuch-search-terms(7)` for more information about named queries. -ENVIRONMENT -=== - -The following environment variables can be used to control the behavior -of notmuch. - -**NOTMUCH\_CONFIG** -Specifies the location of the notmuch configuration file. - -**NOTMUCH_PROFILE** -Selects among notmuch configurations. - FILES = CONFIGURATION - -If ``NOTMUCH_CONFIG`` is unset, notmuch tries (in order) +Notmuch configuration file search order: -- ``$XDG_CONFIG_HOME/notmuch//config`` where is - defined by ``$NOTMUCH_PROFILE`` or "default" -- ``${HOME}/.notmuch-config`` where is - ``.$NOTMUCH_PROFILE`` or "" +1. File specified by ``--config=FILE`` global option; see + :any:`notmuch(1)`. + +2. File specified by :envvar:`NOTMUCH_CONFIG` environment variable. + +3. ``$XDG_CONFIG_HOME/notmuch//config`` where + is defined by :envvar:`NOTMUCH_PROFILE` environment variable if + set, ``$XDG_CONFIG_HOME/notmuch/default/config`` otherwise. + +4. ``$HOME/.notmuch-config.`` where is defined + by :envvar:`NOTMUCH_PROFILE` environment variable if set, + ``$HOME/.notmuch-config`` otherwise. Hooks - -If ``database.hook_dir`` is unset, notmuch tries (in order) +Notmuch hook directory search order: + +1. Directory specified by ``database.hook_dir`` configuration option. + +2. ``$XDG_CONFIG_HOME/notmuch//hooks`` where + is defined by :envvar:`NOTMUCH_PROFILE` environment variable if + set, ``$XDG_CONFIG_HOME/notmuch/default/hooks`` otherwise. -- ``$XDG_CONFIG_HOME/notmuch//hooks`` where is - defined by ``$NOTMUCH_PROFILE`` or "default" -- ``/.notmuch/hooks`` +3. ``/.notmuch/hooks`` SEE ALSO diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst index a599b6ebc7bf..c0d5b1a7c476 100644 --- a/doc/man1/notmuch-emacs-mua.rst +++ b/doc/man1/notmuch-emacs-mua.rst @@ -72,11 +72,13 @@ Options may be specified multiple times. ENVIRONMENT VARIABLES = -**EMACS** -Name of emacs command to invoke. Defaults to "emacs". +.. envvar:: EMACS -**EMACSCLIENT** -Name of emacsclient command to invoke. Defaults to "emacsclient". + Name of emacs command to invoke. Defaults to "emacs". + +.. envvar:: EMACSCLIENT + + Name of emacsclient command to invoke. Defaults to "emacsclient". SEE ALSO diff --git a/doc/man1/notmuch.rst b/doc/man1/notmuch.rst index 7b84ef447935..93135bdd6abb 100644 --- a/doc/man1/notmuch.rst +++ b/doc/man1/notmuch.rst @@ -52,7 +52,7 @@ Supported global options for ``notmuch`` include ``--config=FILE`` Specify the configuration file to use. This overrides any -configuration file specified by ${NOTMUCH\_CONFIG}. The empty +configuration file specified by :envvar:`NOTMUCH_CONFIG`. The empty string is a permitted and sometimes useful value of *FILE*, which tells ``notmuch`` to use only configuration metadata from the database. @@ -79,7 +79,7 @@ use, (or to reconfigure it later). The setup command will prompt for your full name, your primary email address, any alternate email addresses you use, and the directory containing your email archives. Your answers will be written to a -configuration file in ${NOTMUCH\_CONFIG} (if set) or +configuration file in :envvar:`NOTMUCH_CONFIG` (if set) or ${HOME}/.notmuch-config . This configuration file will be created with descriptive comments, making it easy to edit by hand later to change the configuration. Or you can run **notmuch setup** again to change the @@ -128,8 +128,8 @
[PATCH 2/5] doc: cross-reference notmuch man pages with actual links
Add internal hyperlink targets for man pages and cross-reference them using the any role reference. There are a number of alternatives to accomplish this, but this seems like the combination that retains the man page section number and the same boldface style in the man pages. As a bonus, we get sanity checking on the links; for example notmuch-search-terms.rst had a reference to notmuch-properties(1) i.e. the wrong section. The obvious semantic follow-up change would be to only have meaningful "see also" references instead of having them all everywhere. --- doc/man1/notmuch-address.rst | 32 doc/man1/notmuch-compact.rst | 26 +++-- doc/man1/notmuch-config.rst | 60 +++-- doc/man1/notmuch-count.rst| 28 +++--- doc/man1/notmuch-dump.rst | 40 ++- doc/man1/notmuch-emacs-mua.rst| 4 +- doc/man1/notmuch-insert.rst | 30 --- doc/man1/notmuch-new.rst | 49 --- doc/man1/notmuch-reindex.rst | 34 doc/man1/notmuch-reply.rst| 30 --- doc/man1/notmuch-restore.rst | 38 +- doc/man1/notmuch-search.rst | 32 doc/man1/notmuch-show.rst | 37 ++ doc/man1/notmuch-tag.rst | 30 --- doc/man1/notmuch.rst | 64 +-- doc/man5/notmuch-hooks.rst| 54 +- doc/man7/notmuch-properties.rst | 36 + doc/man7/notmuch-search-terms.rst | 48 --- 18 files changed, 359 insertions(+), 313 deletions(-) diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst index 9193aefe1db6..9eae65cbae8f 100644 --- a/doc/man1/notmuch-address.rst +++ b/doc/man1/notmuch-address.rst @@ -1,3 +1,5 @@ +.. _notmuch-address(1): + === notmuch-address === @@ -13,7 +15,7 @@ DESCRIPTION Search for messages matching the given search terms, and display the addresses from them. Duplicate addresses are filtered out. -See **notmuch-search-terms(7)** for details of the supported syntax for +See :any:`notmuch-search-terms(7)` for details of the supported syntax for . Supported options for **address** include @@ -26,7 +28,7 @@ Supported options for **address** include ``--format-version=N`` Use the specified structured output format version. This is -intended for programs that invoke **notmuch(1)** internally. If +intended for programs that invoke :any:`notmuch(1)` internally. If omitted, the latest supported version will be used. ``--output=(sender|recipients|count|address)`` @@ -116,16 +118,16 @@ This command supports the following special exit status codes SEE ALSO -**notmuch(1)**, -**notmuch-config(1)**, -**notmuch-count(1)**, -**notmuch-dump(1)**, -**notmuch-hooks(5)**, -**notmuch-insert(1)**, -**notmuch-new(1)**, -**notmuch-reply(1)**, -**notmuch-restore(1)**, -**notmuch-search-terms(7)**, -**notmuch-show(1)**, -**notmuch-tag(1)**, -**notmuch-search(1)** +:any:`notmuch(1)`, +:any:`notmuch-config(1)`, +:any:`notmuch-count(1)`, +:any:`notmuch-dump(1)`, +:any:`notmuch-hooks(5)`, +:any:`notmuch-insert(1)`, +:any:`notmuch-new(1)`, +:any:`notmuch-reply(1)`, +:any:`notmuch-restore(1)`, +:any:`notmuch-search(1)`, +:any:`notmuch-search-terms(7)`, +:any:`notmuch-show(1)`, +:any:`notmuch-tag(1)` diff --git a/doc/man1/notmuch-compact.rst b/doc/man1/notmuch-compact.rst index b05593ec2213..85f611bf44e5 100644 --- a/doc/man1/notmuch-compact.rst +++ b/doc/man1/notmuch-compact.rst @@ -1,3 +1,5 @@ +.. _notmuch-compact(1): + === notmuch-compact === @@ -46,15 +48,15 @@ of notmuch. SEE ALSO -**notmuch(1)**, -**notmuch-count(1)**, -**notmuch-dump(1)**, -**notmuch-hooks(5)**, -**notmuch-insert(1)**, -**notmuch-new(1)**, -**notmuch-reply(1)**, -**notmuch-restore(1)**, -**notmuch-search(1)**, -**notmuch-search-terms(7)**, -**notmuch-show(1)**, -**notmuch-tag(1)** +:any:`notmuch(1)`, +:any:`notmuch-count(1)`, +:any:`notmuch-dump(1)`, +:any:`notmuch-hooks(5)`, +:any:`notmuch-insert(1)`, +:any:`notmuch-new(1)`, +:any:`notmuch-reply(1)`, +:any:`notmuch-restore(1)`, +:any:`notmuch-search(1)`, +:any:`notmuch-search-terms(7)`, +:any:`notmuch-show(1)`, +:any:`notmuch-tag(1)` diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst index 75c59ff97188..5c980a8a4bb8 100644 --- a/doc/man1/notmuch-config.rst +++ b/doc/man1/notmuch-config.rst @@ -1,3 +1,5 @@ +.. _notmuch-config(1): + == notmuch-config == @@ -76,7 +78,7 @@ paths are presumed relative to `$HOME` for items in section **database.hook_dir** Directory containing hooks run by notmuch commands. See -**notmuch-hooks(5)**. +:any:`notmuch-hooks(5)`. **user.name** Your full name. @@ -103,7 +105,7 @@ paths are presumed relative to `$HOME` for items in section **new.ign
[PATCH 1/5] doc: use manpage role references to external man pages
Using manpage role references generates helpful links in html documentation, while retaining the same boldface style in the man pages. The external man page site is configurable. The Debian manpage site seems like a good fit for Notmuch. --- doc/conf.py | 5 + doc/man1/notmuch-address.rst | 4 ++-- doc/man1/notmuch-dump.rst | 16 doc/man1/notmuch-emacs-mua.rst| 15 +-- doc/man1/notmuch-reply.rst| 2 +- doc/man1/notmuch-restore.rst | 6 +++--- doc/man1/notmuch-search.rst | 4 ++-- doc/man1/notmuch-show.rst | 2 +- doc/man1/notmuch.rst | 5 +++-- doc/man7/notmuch-search-terms.rst | 2 +- 10 files changed, 35 insertions(+), 26 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index d0f7f66ce83e..4a4a34212cc3 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -80,6 +80,11 @@ htmlhelp_basename = 'notmuchdoc' # Despite the name, this actually affects manual pages as well. html_use_smartypants = False +# See: +# - https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-manpages_url +# - https://manpages.debian.org/ +manpages_url = 'https://manpages.debian.org/{page}.{section}.html' + # -- Options for manual page output --- # One entry per manual page. List of tuples diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst index 2a7df6f0d80f..9193aefe1db6 100644 --- a/doc/man1/notmuch-address.rst +++ b/doc/man1/notmuch-address.rst @@ -21,8 +21,8 @@ Supported options for **address** include ``--format=``\ (**json**\ \|\ **sexp**\ \|\ **text**\ \|\ **text0**) Presents the results in either JSON, S-Expressions, newline character separated plain-text (default), or null character -separated plain-text (compatible with **xargs(1)** -0 option where -available). +separated plain-text (compatible with :manpage:`xargs(1)` -0 +option where available). ``--format-version=N`` Use the specified structured output format version. This is diff --git a/doc/man1/notmuch-dump.rst b/doc/man1/notmuch-dump.rst index ec6335b2febc..0a7a23876cf3 100644 --- a/doc/man1/notmuch-dump.rst +++ b/doc/man1/notmuch-dump.rst @@ -27,7 +27,7 @@ the remaining arguments are search terms. Supported options for **dump** include ``--gzip`` -Compress the output in a format compatible with **gzip(1)**. +Compress the output in a format compatible with :manpage:`gzip(1)`. ``--format=(sup|batch-tag)`` Notmuch restore supports two plain text dump formats, both with @@ -36,8 +36,8 @@ Supported options for **dump** include **batch-tag** The default **batch-tag** dump format is intended to more robust against malformed message-ids and tags containing -whitespace or non-\ **ascii(7)** characters. Each line has the -form:: +whitespace or non-\ :manpage:`ascii(7)` characters. Each line +has the form:: +<*encoded-tag*\ > +<*encoded-tag*\ > ... -- id:<*quoted-message-id*\ > @@ -54,11 +54,11 @@ Supported options for **dump** include **sup** The **sup** dump file format is specifically chosen to be -compatible with the format of files produced by sup-dump. So -if you've previously been using sup for mail, then the -**notmuch restore** command provides you a way to import all -of your tags (or labels as sup calls them). Each line has the -following form:: +compatible with the format of files produced by +:manpage:`sup-dump(1)`. So if you've previously been using sup +for mail, then the **notmuch restore** command provides you a +way to import all of your tags (or labels as sup calls +them). Each line has the following form:: <*message-id*\ > **(** <*tag*\ > ... **)** diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst index a0476136f503..a1e65eddd9f1 100644 --- a/doc/man1/notmuch-emacs-mua.rst +++ b/doc/man1/notmuch-emacs-mua.rst @@ -41,8 +41,9 @@ Supported options for **emacs-mua** include Even if a window system is available, use the current terminal. ``--client`` -Use **emacsclient**, rather than **emacs**. For **emacsclient** to -work, you need an already running Emacs with a server, or use +Use :manpage:`emacsclient(1)`, rather than +:manpage:`emacs(1)`. For :manpage:`emacsclient(1)` to work, you +need an already running Emacs with a server, or use ``--auto-daemon``. ``--auto-daemon`` @@ -60,9 +61,9 @@ Supported options for **emacs-mua** include Output the resulting elisp to stdout instead of evaluating it. The supported positional parameters and short options are a compatible -subset of the **mutt** MUA command-line options. The options and -positional parameters modifying the message can't be combined with the -mailto: URL. +subset of the :manpage:`mutt(1)` MUA command-line o
[PATCH 0/5] doc: man page cleanup
I saw [1] and decided to give it some love. :) Mostly this is all about adding html cross-references all over the place while trying to keep the roff man pages roughly the same. Also updating the man page rst becomes easier by setting a clean example. BR, Jani. [1] https://notmuchmail.org/doc/latest/ Jani Nikula (5): doc: use manpage role references to external man pages doc: cross-reference notmuch man pages with actual links doc: use envvar directive and role for environment variables doc: use program and option directives to document options doc: example command-line option reference doc/conf.py | 5 + doc/man1/notmuch-address.rst | 204 doc/man1/notmuch-compact.rst | 48 ++-- doc/man1/notmuch-config.rst | 147 ++-- doc/man1/notmuch-count.rst| 87 --- doc/man1/notmuch-dump.rst | 176 +++--- doc/man1/notmuch-emacs-mua.rst| 101 doc/man1/notmuch-insert.rst | 128 +- doc/man1/notmuch-new.rst | 102 doc/man1/notmuch-reindex.rst | 71 +++--- doc/man1/notmuch-reply.rst| 121 +- doc/man1/notmuch-restore.rst | 154 ++-- doc/man1/notmuch-search.rst | 264 +++-- doc/man1/notmuch-show.rst | 380 -- doc/man1/notmuch-tag.rst | 63 ++--- doc/man1/notmuch.rst | 139 ++- doc/man5/notmuch-hooks.rst| 54 +++-- doc/man7/notmuch-properties.rst | 36 +-- doc/man7/notmuch-search-terms.rst | 50 ++-- 19 files changed, 1245 insertions(+), 1085 deletions(-) -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v3] test: replace notmuch_passwd_sanitize() with _libconfig_sanitize()
On Fri, May 21 2021, Felipe Contreras wrote: > On Thu, May 20, 2021 at 2:43 AM Tomi Ollila wrote: >> >> On Wed, May 19 2021, Felipe Contreras wrote: >> >> > On Wed, May 19, 2021 at 12:34 PM Tomi Ollila wrote: >> > >> >> Haha, as we do _libconfig_sanitize < OUTPUT > OUTPUT.clean >> >> reading python script from stdin don't work (perl has __DATA__ ;). >> >> (bitten again, I did and tested the change... :D). >> > >> > That can be fixed with: >> > >> > python /dev/fd/3 3<> > EOF >> >> According to >> >> https://unix.stackexchange.com/questions/123602/portability-of-file-descriptor-links >> >> that solution could be portable enough. > > What the operating system does doesn't really matter, bash emulates /dev/fd/x: In this case, /dev/fd/3 is given as a parameter to a command, not part of redirections -- bash cannot know how the program is going to use the arguments it gets... Anyway, the [PATCH v4] in id:20210520134628.11653-1-tomi.oll...@iki.fi implemented your suggestion ${NOTMUCH_PYTHON} /dev/fd/3 3<<'EOF' ... > "If the operating system on which Bash is running provides these > special files, bash will use them; otherwise it will emulate them > internally with the behavior described below." > > https://www.gnu.org/software/bash/manual/html_node/Redirections.html ... "Bash handles several filenames specially when they are used in redirections, as described in the following table." is just before your snippet >;D > > And as far as I know the testing framework only works correctly on bash... > So... > >> Another way still using -c ... I've played to look how it actually looks is >> (diff since patch v3) >> >> -sq = chr(39) # single quote >> -l = l.replace(sq + name, sq + "USER_FULL_NAME", 1) >> +l = l.replace("'\''" + name, "'\''USER_FULL_NAME", 1) > > Yes, that works too. But that's what I said in another mail that is > weird stuff. I had to read it again three times and then copy to a > proper text editor with monospace font to see if it was correct. To me '\'' is /idiomatic/ way to embed ' in the middle of a long argument string... >> Tested the above. That python /dev/fd/3 3<> have to be tested to see how it looks like and behaves... :D > > Yeap. Took me a while to find the right documentation to figure that > out, but in my opinion it's better to write a helper for the tests > once, and then forget about it and just re-use it for all. > > -- > Felipe Contreras ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH] emacs: use new face for notmuch-jump and related
The minibuffer-prompt face that was used before made it impossible to differentiate between two distinct UI elements: (i) the prompt's text which itself cannot be acted upon, (ii) the actionable keys used to jump to searches/tags. The use of a named face, notmuch-jump-key, makes it possible for users or theme developers to apply properties that are specific to each of those two cases. In the interest of backward compatibility, the new face inherits from minibuffer-prompt. --- NEWS | 4 emacs/notmuch-jump.el | 9 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c0ae6afe..83e42b44 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,10 @@ Emacs Restore the dynamically bound variables `tag-changes` and `query` in in `notmuch-before-tag-hook` and `notmuch-after-tag-hook`. +Add `notmuch-jump-key` face to fontify keys in `notmuch-jump` and +related functions. To ensure backward compatibility, the new face +inherits from `minibuffer-prompt`. + Notmuch 0.32 (2021-05-02) = diff --git a/emacs/notmuch-jump.el b/emacs/notmuch-jump.el index 6fab5a79..e228c8a2 100644 --- a/emacs/notmuch-jump.el +++ b/emacs/notmuch-jump.el @@ -62,6 +62,11 @@ (defun notmuch-jump-search () (error "To use notmuch-jump, %s" "please customize shortcut keys in notmuch-saved-searches." +(defface notmuch-jump-key + '((t :inherit minibuffer-prompt)) + "Default face used for keys in `notmuch-jump' and related." + :group 'notmuch-faces) + (defvar notmuch-jump--action nil) ;;;###autoload @@ -88,7 +93,7 @@ (defun notmuch-jump (action-map prompt) (buffer-string))) (full-prompt (concat table "\n\n" - (propertize prompt 'face 'minibuffer-prompt))) + (propertize prompt 'face 'notmuch-jump-key))) ;; By default, the minibuffer applies the minibuffer face to ;; the entire prompt. However, we want to clearly ;; distinguish bindings (which we put in the prompt face @@ -123,7 +128,7 @@ (defun notmuch-jump--format-actions (action-map) ;; Format each action (mapcar (pcase-lambda (`(,key ,desc)) (setq key (format-kbd-macro key)) - (concat (propertize key 'face 'minibuffer-prompt) + (concat (propertize key 'face 'notmuch-jump-key) (make-string (- key-width (length key)) ? ) " " desc)) action-map))) -- 2.31.1 -- Protesilaos Stavrou https://protesilaos.com ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH] emacs: update default mailing list archives for stashing links
Gmane web interface is long gone, remove it. Make MARC the new default. Update LKML to Lore, where it already redirects anyway. Also add Notmuch web archive. --- Note: I observed M-x customize-variable RET notmuch-show-stash-mlarchive-link-default RET does not take user customized notmuch-show-stash-mlarchive-link-alist into account. It should, but I don't know how to fix that. --- emacs/notmuch-show.el | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index ba93febb34ff..a415a95c25bf 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -189,10 +189,10 @@ each attachment handler is logged in buffers with names beginning ;;; Options (defcustom notmuch-show-stash-mlarchive-link-alist - '(("Gmane" . "https://mid.gmane.org/";) -("MARC" . "https://marc.info/?i=";) + '(("MARC" . "https://marc.info/?i=";) ("Mail Archive, The" . "https://mid.mail-archive.com/";) -("LKML" . "https://lkml.kernel.org/r/";) +("Lore" . "https://lore.kernel.org/r/";) +("Notmuch" . "https://nmbug.notmuchmail.org/nmweb/show/";) ;; FIXME: can these services be searched by `Message-Id' ? ;; ("MarkMail" . "http://markmail.org/";) ;; ("Nabble" . "http://nabble.com/";) @@ -217,7 +217,7 @@ return the ML archive reference URI." (function :tag "Function returning the URL"))) :group 'notmuch-show) -(defcustom notmuch-show-stash-mlarchive-link-default "Gmane" +(defcustom notmuch-show-stash-mlarchive-link-default "MARC" "Default Mailing List Archive to use when stashing links. This is used when `notmuch-show-stash-mlarchive-link' isn't -- 2.30.2 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v3] test: replace notmuch_passwd_sanitize() with _libconfig_sanitize()
On Thu, May 20, 2021 at 2:43 AM Tomi Ollila wrote: > > On Wed, May 19 2021, Felipe Contreras wrote: > > > On Wed, May 19, 2021 at 12:34 PM Tomi Ollila wrote: > > > >> Haha, as we do _libconfig_sanitize < OUTPUT > OUTPUT.clean > >> reading python script from stdin don't work (perl has __DATA__ ;). > >> (bitten again, I did and tested the change... :D). > > > > That can be fixed with: > > > > python /dev/fd/3 3< > EOF > > According to > > https://unix.stackexchange.com/questions/123602/portability-of-file-descriptor-links > > that solution could be portable enough. What the operating system does doesn't really matter, bash emulates /dev/fd/x: "If the operating system on which Bash is running provides these special files, bash will use them; otherwise it will emulate them internally with the behavior described below." https://www.gnu.org/software/bash/manual/html_node/Redirections.html And as far as I know the testing framework only works correctly on bash... So... > Another way still using -c ... I've played to look how it actually looks is > (diff since patch v3) > > -sq = chr(39) # single quote > -l = l.replace(sq + name, sq + "USER_FULL_NAME", 1) > +l = l.replace("'\''" + name, "'\''USER_FULL_NAME", 1) Yes, that works too. But that's what I said in another mail that is weird stuff. I had to read it again three times and then copy to a proper text editor with monospace font to see if it was correct. > Tested the above. That python /dev/fd/3 3< have to be tested to see how it looks like and behaves... :D Yeap. Took me a while to find the right documentation to figure that out, but in my opinion it's better to write a helper for the tests once, and then forget about it and just re-use it for all. -- Felipe Contreras ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org