Re: timezone in notmuch
Tomi Ollila [2020-04-15T23:17:32+03] wrote: > I use this: > > https://github.com/domo141/nottoomuch/blob/master/build/01-date-local.patch > > I've been thinking if some hook could be added to notmuch-emacs so > that such a custom date mangling can be done outside of the > notmuch-emacs source... Formerly I used Emacs Gnus and its hook to change the date. For this discussion I adapted the idea to Notmuch. The code below is based on idea that after article display there is a hook which can do anything user wants. I wanted ISO 8601 date. ;; Add a hook for changing article's date string. (add-hook 'some-article-display-hook 'tl-notmuch-custom-article-date) (defmacro notmuch-narrow-to-article-headers (&rest body) ;; Implement macro which uses NARROW function to narrow current buffer ;; to article's headers only. `(progn ,@body)) (defun tl-notmuch-custom-article-date () (save-excursion (save-match-data (notmuch-narrow-to-article-headers (goto-char (point-min)) (when (re-search-forward "^Date: \\(.+\\)$" nil t) (let ((inhibit-read-only t)) (replace-match (tl-message-date-string-iso (match-string-no-properties 1)) nil t nil 1))) (defun tl-message-date-string-iso (string) ;; Parse message date STRING and return ISO 8601 time string. (require 'parse-time) (condition-case nil (let* ((date-list (parse-time-string string)) (year (nth 5 date-list)) (month (nth 4 date-list)) (day (nth 3 date-list)) (hour (nth 2 date-list)) (min (nth 1 date-list)) (sec (nth 0 date-list)) (tz-total-sec (nth 8 date-list))) (format "%04d-%02d-%02dT%02d:%02d:%02d%s" year month day hour min sec (if (not tz-total-sec) "" (let* ((tz-sign (if (>= tz-total-sec 0) "+" "-")) (tz-hour (truncate (abs tz-total-sec) 3600)) (tz-min (truncate (- (abs tz-total-sec) (* tz-hour 3600)) 60))) (cond ((= tz-hour tz-min 0) "Z") ((= tz-min 0) (format "%s%02d" tz-sign tz-hour)) (t (format "%s%02d:%02d" tz-sign tz-hour tz-min))) (error string))) -- /// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: easy (?) elisp project for notmuch [it's mostly DONE]
Jonas Bernoulli writes: > Nice to run into you. You too :) > Do you contribute to *all* the killer apps? ;D Heh. I think notmuch is great, but I haven't made any real contributions. Just a happy user and a lurker on the mailing list. > Kyle Meyer writes: >> From there, you can easily download an mbox for a message or thread >> from before you subscribed (e.g. to feed to 'notmuch insert'). > > Do you already have some tooling that you could share? Only very minimal. I have a script that takes a public-inbox thread mbox link, such as https://public-inbox.org/meta/20200406095621.5656-...@yhbt.net/t.mbox.gz It uses mbox2maildir from Sean's mailscripts to convert the mbox to a maildir and then calls 'notmuch insert' with each message. There might be a better approach, but it's been working fine for me. My main use case is that I follow some lists hosted on public-inbox.org and lore.kernel.org via nntp; if I want to reply to something, I import a thread into notmuch. Note that it hard codes my folder. --8<---cut here---start->8--- #!/bin/sh if test $# -ne 1 then echo "$0 " exit 1 fi cd "$(mktemp -d ${TMPDIR:-/tmp}/notmuch-import-XXX)" curl -fsS $1 | gunzip -c >t.mbox mbox2maildir t.mbox mdir for f in $(find mdir -type f) do notmuch insert --no-hooks --folder=kyleam/INBOX <$f done --8<---cut here---end--->8--- As a side note about tooling: David mentioned Sean's mailscripts in the context of debbugs. I haven't used that specific functionality yet, but it has other scripts that are really nice for working with patch series. mailscripts even gained some functionality for extracting a patch series from an mbox that was inspired [^1] by Konstantin Ryabitsev's get-lore-mbox.py [^2] tool for grabbing patch series from threads on lore.kernel.org, which uses public-inbox. All very exciting :) [^1]: https://lore.kernel.org/workflows/87lfp38p7s@iris.silentflame.com/ [^2]: I think this tool was renamed recently, but I can't find that information at the moment. > Kyle, have you considered mirroring emacs-devel and the Emacs debbugs > as well? I have... I dunno :/ The two higher-volume projects that I'm considering creating public-inbox archives for are Emacs (devel and debbugs) and Guix (patches, bugs, devel, user, ... they sure do like to split up discussion ...). It takes some work up front to create the initial archives, but my main hesitation is due to uncertainty about how my current VPS set up would fare. So, I'm letting things settle a bit. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: timezone in notmuch
Tomi Ollila writes: > I use this: > > https://github.com/domo141/nottoomuch/blob/master/build/01-date-local.patch > > I've been thinking if some hook could be added to notmuch-emacs so > that such a custom date mangling can be done outside of the notmuch-emacs > source... I would like to see something like this without having to patch notmuch. As much as I like notmuch-show-relative-dates, occasionally, I just want to be able to see the exact time an email was sent in my timezone. -- Brian May https://linuxpenguins.xyz/brian/ ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: easy (?) elisp project for notmuch [it's mostly DONE]
Hello, On Wed 15 Apr 2020 at 01:41PM -07, Sean Whitton wrote: > Debian/Ubuntu/etc. you can `apt-get install mailscripts` Oh, and `apt-get install elpa-mailscripts` to get `M-x notmuch-slurp-this-debbug` and `M-x notmuch-slurp-debbug`. -- Sean Whitton ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: easy (?) elisp project for notmuch [it's mostly DONE]
Hello, On Wed 15 Apr 2020 at 04:28PM -03, David Bremner wrote: > Jonas Bernoulli writes: > >> >> One related use case for "notmuch insert" that I had in mind is the >> import of debbugs threads. It someone is aware of an existing solution >> then please let me know. Kyle, have you considered mirroring >> emacs-devel and the Emacs debbugs as well? > > Sean Whitton (in copy) maintains a script called notmuch-slurp-debbug > that does that. I can't remember if it is tested on the GNU instance of > debbugs. > > https://git.spwhitton.name/mailscripts Untested, but should work, and it's a bug if it doesn't. Debian/Ubuntu/etc. you can `apt-get install mailscripts` -- Sean Whitton ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: performance problems with notmuch new
Don Zickus writes: >> runs in about 30s here (i7 4770 / SSD). Replacing --small with --medium >> takes about 10M (so a superlinear slowdown in wall clock time, since >> that represents a 10x scale-up in the corpus size.). > > Hmm, for me --small was 35s and --medium was 32 minutes. This is on a > i7-9750H / nvme. I would expect numbers similar to yours. I did another few tests test for --medium and they all take 7-9 minutes, depending what else is going on on the machine. Here's my breakdown of times (unfortunately a bit of hand editing is needed to clean up the warnings) performance-test/notmuch-time-test --medium T00-new.sh: Testing notmuch new [0.4 medium] Wall(s) Usr(s) Sys(s) Res(K) In/Out(512B) Initial notmuch new 66.29 62.22 2.82241148 0/1089784 notmuch new #20.030.000.0098640/160 notmuch new #30.000.000.0092920/8 notmuch new #40.000.000.0095560/8 notmuch new #50.000.000.0093960/8 notmuch new #60.000.000.0093160/8 new (7500 mv) 49.02 35.88 12.59 185152 0/392720 new (7500 mv back)59.41 43.04 15.88 185888 0/413824 new (7500 cp) 36.09 26.55 9.02182160 0/411840 T01-dump-restore.sh: Testing dump and restore [0.4 medium] Wall(s) Usr(s) Sys(s) Res(K) In/Out(512B) load nmbug tags 5.372.091.6312172 0/31864 dump *0.630.580.0411756 0/4344 restore * 0.720.650.0695720/0 T02-tag.sh: Testing tagging [0.4 medium] Wall(s) Usr(s) Sys(s) Res(K) In/Out(512B) tag * +new_tag54.45 31.93 20.26 86380 8/250512 tag * +existing_tag 0.000.000.0093960/0 tag * -existing_tag 46.73 26.07 20.08 20580 0/284248 tag * -missing_tag0.000.000.0093160/0 T03-reindex.sh: Testing reindexing [0.4 medium] Wall(s) Usr(s) Sys(s) Res(K) In/Out(512B) reindex * 78.39 63.06 14.31 229204 0/546136 reindex * 70.52 56.68 13.12 223980 0/333608 reindex * 78.02 62.61 14.92 225160 0/374424 T04-thread-subquery.sh: Testing thread subqueries [0.4 medium] Wall(s) Usr(s) Sys(s) Res(K) In/Out(512B) search thread:{} ... 0.370.330.0426508 0/24 search thread:{} ... 0.380.330.0423592 0/24 search thread:{} ... 0.370.340.0326612 0/24 415.28user 128.24system 9:13.07elapsed 98%CPU (0avgtext+0avgdata 241148maxresident)k 8inputs+7294896outputs (0major+458590minor)pagefaults 0swaps ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: timezone in notmuch
On Tue, Apr 14 2020, di...@santanas.co.za wrote: > Greetings :) > > In notmuch-show-mode, some emails have a date like this: Date: Thu, 09 > Apr 2020 14:34:42 + while others like this Date: Sun, 12 Apr 2020 > 21:04:01 +0200 > > Is this something I can change in notmuch to always show the date/time > in my local timezone (SAST/+0200)? I use this: https://github.com/domo141/nottoomuch/blob/master/build/01-date-local.patch I've been thinking if some hook could be added to notmuch-emacs so that such a custom date mangling can be done outside of the notmuch-emacs source... Tomi ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: easy (?) elisp project for notmuch [it's mostly DONE]
Jonas Bernoulli writes: > > One related use case for "notmuch insert" that I had in mind is the > import of debbugs threads. It someone is aware of an existing solution > then please let me know. Kyle, have you considered mirroring > emacs-devel and the Emacs debbugs as well? Sean Whitton (in copy) maintains a script called notmuch-slurp-debbug that does that. I can't remember if it is tested on the GNU instance of debbugs. https://git.spwhitton.name/mailscripts d ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: easy (?) elisp project for notmuch [it's mostly DONE]
Nice to run into you. Do you contribute to *all* the killer apps? ;D Kyle Meyer writes: > [ in case it's useful in the future ] > I've recently set up a public-inbox archive of notmuch Absolutely! In fact I already had a bookmark about that somewhere. > From there, you can easily download an mbox for a message or thread > from before you subscribed (e.g. to feed to 'notmuch insert'). Do you already have some tooling that you could share? > It might be possible to download a single message or thread from the > archive One related use case for "notmuch insert" that I had in mind is the import of debbugs threads. It someone is aware of an existing solution then please let me know. Kyle, have you considered mirroring emacs-devel and the Emacs debbugs as well? Cheers, Jonas ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 3/4] emacs: Explicitly depend on Emacs 24
We use various things that were not available in earlier versions. --- emacs/notmuch-pkg.el.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emacs/notmuch-pkg.el.tmpl b/emacs/notmuch-pkg.el.tmpl index de97baac..3eb0e04e 100644 --- a/emacs/notmuch-pkg.el.tmpl +++ b/emacs/notmuch-pkg.el.tmpl @@ -3,4 +3,4 @@ "notmuch" %VERSION% "Emacs based front-end (MUA) for notmuch" - nil) + '((emacs "24"))) -- 2.26.0 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 4/4] emacs: Use `cl-lib' instead of deprecated `cl'
Starting with Emacs 27 the old `cl' implementation is finally considered obsolete. Previously its use was strongly discouraged at run-time but one was still allowed to use it at compile-time. For the most part the transition is very simple and boils down to adding the "cl-" prefix to some symbols. A few replacements do not follow that simple pattern; e.g. `first' is replaced with `car', even though the alias `cl-first' exists, because the latter is not idiomatic emacs-lisp. In a few cases we start using `pcase-let' or `pcase-lambda' instead of renaming e.g. `first' to `car'. That way we can remind the reader of the meaning of the various parts of the data that is being deconstructed. An obsolete `lexical-let' and a `lexical-let*' are replaced with their regular variants `let' and `let*' even though we do not at the same time enable `lexical-binding' for that file. That is the right thing to do because it does not actually make a difference in those cases whether lexical bindings are used or not, and because this should be enabled in a separate commit. We need to explicitly depend on the `cl-lib' package because Emacs 24.1 and 24.2 lack that library. When using these releases we end up using the backport from GNU Elpa. We need to explicitly require the `pcase' library because `pcase-dolist' was not autoloaded until Emacs 25.1. --- emacs/notmuch-company.el | 5 +- emacs/notmuch-draft.el | 2 +- emacs/notmuch-hello.el | 147 ++- emacs/notmuch-jump.el| 45 +-- emacs/notmuch-lib.el | 18 ++--- emacs/notmuch-maildir-fcc.el | 35 + emacs/notmuch-mua.el | 76 +- emacs/notmuch-parser.el | 18 ++--- emacs/notmuch-pkg.el.tmpl| 3 +- emacs/notmuch-show.el| 103 emacs/notmuch-tag.el | 45 ++- emacs/notmuch-tree.el| 20 ++--- emacs/notmuch.el | 62 +++ test/test-lib.el | 2 +- 14 files changed, 292 insertions(+), 289 deletions(-) diff --git a/emacs/notmuch-company.el b/emacs/notmuch-company.el index 3e12e7a9..ac998f9b 100644 --- a/emacs/notmuch-company.el +++ b/emacs/notmuch-company.el @@ -27,7 +27,8 @@ ;;; Code: -(eval-when-compile (require 'cl)) +(eval-when-compile (require 'cl-lib)) + (require 'notmuch-lib) (defvar notmuch-company-last-prefix nil) @@ -65,7 +66,7 @@ (defun notmuch-company (command &optional arg &rest _ignore) (require 'company) (let ((case-fold-search t) (completion-ignore-case t)) -(case command +(cl-case command (interactive (company-begin-backend 'notmuch-company)) (prefix (and (derived-mode-p 'message-mode) (looking-back (concat notmuch-address-completion-headers-regexp ".*") diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el index e22e0d16..504b33be 100644 --- a/emacs/notmuch-draft.el +++ b/emacs/notmuch-draft.el @@ -152,7 +152,7 @@ (defun notmuch-draft--query-encryption () "Checks if we should save a message that should be encrypted. `notmuch-draft-save-plaintext' controls the behaviour." - (case notmuch-draft-save-plaintext + (cl-case notmuch-draft-save-plaintext ((ask) (unless (yes-or-no-p "(Customize `notmuch-draft-save-plaintext' to avoid this warning) This message contains mml tags that suggest it is intended to be encrypted. diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index aff8beb5..74996636 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -21,7 +21,8 @@ ;;; Code: -(eval-when-compile (require 'cl)) +(eval-when-compile (require 'cl-lib)) + (require 'widget) (require 'wid-edit) ; For `widget-forward'. @@ -44,17 +45,19 @@ (defun notmuch-saved-search-get (saved-search field) ((keywordp (car saved-search)) (plist-get saved-search field)) ;; It is not a plist so it is an old-style entry. - ((consp (cdr saved-search)) ;; It is a list (NAME QUERY COUNT-QUERY) -(case field - (:name (first saved-search)) - (:query (second saved-search)) - (:count-query (third saved-search)) - (t nil))) - (t ;; It is a cons-cell (NAME . QUERY) -(case field - (:name (car saved-search)) - (:query (cdr saved-search)) - (t nil) + ((consp (cdr saved-search)) +(pcase-let ((`(,name ,query ,count-query) saved-search)) + (cl-case field + (:name name) + (:query query) + (:count-query count-query) + (t nil + (t +(pcase-let ((`(,name . ,query) saved-search)) + (cl-case field + (:name name) + (:query query) + (t nil)) (defun notmuch-hello-saved-search-to-plist (saved-search) "Return a copy of SAVED-SEARCH in plist form. @@ -63,7 +66,7 @@ (defun notmuch-hello-saved-search-to-plist (saved-search) cases, for backwards compatibility, convert to plist form and return that." (if (keywordp (car saved-search)) -
[PATCH 0/4] Use cl-lib instead of deprecated cl
It is said that beginning with a cleanup of the existing code isn't the nicest thing to do but I tend to do it anyway. So I am glad that David mentioned yesterday that doing this cleanup would be an ideal way to get started. I have done quite a bit more cleanup already, some of which may be more controversial, but am limiting this initial patch series to just the cl-lib commit and a few harmless fixes. Jonas Bernoulli (4): gitignore: Ignore generated python-cffi files emacs: Declare function notmuch-show-get-message-id emacs: Explicitly depend on Emacs 24 emacs: Use `cl-lib' instead of deprecated `cl' .gitignore | 1 + emacs/notmuch-company.el | 5 +- emacs/notmuch-crypto.el | 2 + emacs/notmuch-draft.el | 2 +- emacs/notmuch-hello.el | 147 ++- emacs/notmuch-jump.el| 45 +-- emacs/notmuch-lib.el | 18 ++--- emacs/notmuch-maildir-fcc.el | 35 + emacs/notmuch-mua.el | 76 +- emacs/notmuch-parser.el | 18 ++--- emacs/notmuch-pkg.el.tmpl| 3 +- emacs/notmuch-show.el| 103 emacs/notmuch-tag.el | 45 ++- emacs/notmuch-tree.el| 20 ++--- emacs/notmuch.el | 62 +++ test/test-lib.el | 2 +- 16 files changed, 295 insertions(+), 289 deletions(-) -- 2.26.0 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 1/4] gitignore: Ignore generated python-cffi files
--- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 468b660a..1c8705ec 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ tags /releases /.stamps *.stamp +/bindings/python-cffi/build/ -- 2.26.0 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 2/4] emacs: Declare function notmuch-show-get-message-id
--- emacs/notmuch-crypto.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el index 4035ee37..30425fbc 100644 --- a/emacs/notmuch-crypto.el +++ b/emacs/notmuch-crypto.el @@ -24,6 +24,8 @@ (require 'epg) (require 'notmuch-lib) +(declare-function notmuch-show-get-message-id "notmuch-show" (&optional bare)) + (defcustom notmuch-crypto-process-mime t "Should cryptographic MIME parts be processed? -- 2.26.0 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: timezone in notmuch
>> There's no user customizable variable for this. The code in this part of >> notmuch show is fairly simple, so someone could probably figure out how >> to pass (notmuch-show-get-timestamp) to the appropriate emacs function >> to format the date in the local timezone. > > I should mention that having "notmuch-show-relative-dates" on hides this > problem, since it doesn't use timezones at all. Perhaps you would prefer > that (or perhaps not). Good to know thanks. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: performance problems with notmuch new
On Wed, Apr 15, 2020 at 01:01:52PM -0300, David Bremner wrote: > Don Zickus writes: > > > > > Tips for debugging this? > > > > I ran the notmuch performance/time-test, but after 15 minutes of waiting for > > the initial notmuch new to finish, I gave up and aborted. > > You can try one of the smaller corpus sizes > > $ make OPTIONS=--small time-test > > runs in about 30s here (i7 4770 / SSD). Replacing --small with --medium > takes about 10M (so a superlinear slowdown in wall clock time, since > that represents a 10x scale-up in the corpus size.). Hmm, for me --small was 35s and --medium was 32 minutes. This is on a i7-9750H / nvme. I would expect numbers similar to yours. Cheers, Don ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: performance problems with notmuch new
Don Zickus writes: > > Tips for debugging this? > > I ran the notmuch performance/time-test, but after 15 minutes of waiting for > the initial notmuch new to finish, I gave up and aborted. You can try one of the smaller corpus sizes $ make OPTIONS=--small time-test runs in about 30s here (i7 4770 / SSD). Replacing --small with --medium takes about 10M (so a superlinear slowdown in wall clock time, since that represents a 10x scale-up in the corpus size.). d ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
performance problems with notmuch new
Hi, I have noticed my 'notmuch new' command seems awfully slow, maybe 10-20 emails / second on large batches. It goes quick for the first few hundred (maybe close to 100/second), then quickly slows down to about 10/second after processing the first 500 or so. I am guessing that isn't an expected behaviour. So I am trying to figure out a good way to analyze and debug this? This could be a problem with my fedora distro or laptop. I just don't know where to look. Tips for debugging this? I ran the notmuch performance/time-test, but after 15 minutes of waiting for the initial notmuch new to finish, I gave up and aborted. I am using 'glass' for my xapian storage if that helps. Help? Cheers, Don ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch