[PATCH] improve notmuch-hello layout

2023-05-25 Thread Rudolf Adamkovič
Howdy, howdy fellow e-mail hackers. :)

The attached patches are my first-cut attempt to:

(1) Make notmuch-hello play nicely with display-line-numbers-mode.
(2) Make notmuch-hello re-layout when window width changes.

WDYT?

Rudy
>From 278017d06bb986f4ec99118bfcfdec8dab970f2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Thu, 25 May 2023 16:22:08 +0200
Subject: [PATCH 1/2] emacs: fix notmuch-hello layout when
 display-line-numbers-mode is on

---
 emacs/notmuch-hello.el | 25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 4662e704..3235f555 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -412,6 +412,7 @@ supported for \"Customized queries section\" items."
 (defun notmuch-search-item-field-width ()
   (max 8 ; Don't let the search boxes be less than 8 characters wide.
(- (window-width)
+	  (line-number-display-width)
 	  notmuch-hello-indent ; space at bol
 	  notmuch-hello-indent ; space at eol
 	  1; for the space before the [save] button
@@ -508,23 +509,31 @@ should be. Returns a cons cell `(tags-per-line width)'."
 	 (cond
 	  ((integerp notmuch-column-control)
 	   (max 1
-		(/ (- (window-width) notmuch-hello-indent)
+		(/ (- (window-width)
+		  (line-number-display-width)
+		  notmuch-hello-indent)
 		   ;; Count is 9 wide (8 digits plus space), 1 for the space
 		   ;; after the name.
 		   (+ 9 1 (max notmuch-column-control widest)
 	  ((floatp notmuch-column-control)
-	   (let* ((available-width (- (window-width) notmuch-hello-indent))
+	   (let* ((available-width (- (window-width)
+  (line-number-display-width)
+  notmuch-hello-indent))
 		  (proposed-width (max (* available-width notmuch-column-control)
    widest)))
 	 (floor available-width proposed-width)))
 	  (t
 	   (max 1
-		(/ (- (window-width) notmuch-hello-indent)
+		(/ (- (window-width)
+		  (line-number-display-width)
+		  notmuch-hello-indent)
 		   ;; Count is 9 wide (8 digits plus space), 1 for the space
 		   ;; after the name.
 		   (+ 9 1 widest)))
 (cons tags-per-line (/ (max 1
-(- (window-width) notmuch-hello-indent
+(- (window-width)
+   (line-number-display-width)
+   notmuch-hello-indent
    ;; Count is 9 wide (8 digits plus
    ;; space), 1 for the space after the
    ;; name.
@@ -824,7 +833,9 @@ Complete list of currently available key bindings:
   (widget-create 'editable-field
 		 ;; Leave some space at the start and end of the
 		 ;; search boxes.
-		 :size (max 8 (- (window-width) notmuch-hello-indent
+		 :size (max 8 (- (window-width)
+ (line-number-display-width)
+ notmuch-hello-indent
  (length "Search: ")))
 		 :action #'notmuch-hello-search)
   ;; Add an invisible dot to make `widget-end-of-line' ignore
@@ -947,7 +958,9 @@ following:
 			 (customize-variable 'notmuch-hello-sections))
 		   :button-prefix "" :button-suffix ""
 		   "this page.")
-(let ((fill-column (- (window-width) notmuch-hello-indent)))
+(let ((fill-column (- (window-width)
+			  (line-number-display-width)
+			  notmuch-hello-indent)))
   (center-region start (point)
 
 ;;; Hello!
-- 
2.37.1 (Apple Git-137.1)

>From 4964ac4a656521a0e84615ea718c81fb4e95bedf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= 
Date: Thu, 25 May 2023 17:21:38 +0200
Subject: [PATCH 2/2] emacs: re-layout notmuch-hello when window width changes

---
 emacs/notmuch-hello.el | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 3235f555..f245a7dd 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -383,6 +383,10 @@ supported for \"Customized queries section\" items."
 (defvar notmuch-hello-first-run t
   "True if `notmuch-hello' is run for the first time, set to nil afterwards.")
 
+(defvar notmuch-hello-scheduled-to-run nil
+  "True if `notmuch-hello' is scheduled to run during the next
+re-display, and set to nil afterwards.")
+
 ;;; Widgets for inserters
 
 (define-widget 'notmuch-search-item 'item
@@ -701,12 +705,23 @@ with `notmuch-hello-query-counts'."
 	;; The user just switched to hello in this window (hello
 	;; is currently visible, was not visible on the last
 	;; configuration change, and this is not a new window)
-	(setq do-refresh t)
-(when (and do-refresh notmuch-hello-auto-refresh)
+	(setq do-refresh t)))
+	(when (eq cur-buf hello-buf)
+	  ;; This is the hello buffer, so check its last and current width.
+	  (let ((last-width (window-parameter window 'notmuch-hello-last-width))
+		(cur-width (window-width window)))
+	(unless (equal last-width cur-width)
+	  ;; The with of the window has changed, so do refresh.
+	  (set-window-parameter window 'notmuch-hello-last-width cur-width)
+	  (setq do-refresh t))
+(when 

Re: T350-crypto T357-index-decryption: possible race condition?

2023-05-25 Thread Michael J Gruber
[now from the subscribed address, sorry]

David Bremner venit, vidit, dixit 2023-05-12 21:17:45:

> Michael J Gruber  writes:
>
> > oh well, attachments ...
> >
>
> Can you encrypt to the key 6D92612D94E46381 interactively using an
> approriately simplified version of that command?

Took me a while, sorry. In that chroot:

```
 sh-5.2# gpg --no-tty --import ./test/gnupg-secret-key.asc
gpg: directory '/builddir/.gnupg' created
gpg: /builddir/.gnupg/trustdb.gpg: trustdb created
gpg: key 6D92612D94E46381: public key "Notmuch Test Suite
 (INSECURE!)" imported
gpg: key 6D92612D94E46381: secret key imported
gpg: Total number processed: 1
gpg:   imported: 1
gpg:   secret keys read: 1
gpg:   secret keys imported: 1

 sh-5.2# echo supersecret | gpg -ear 6D92612D94E46381
gpg: C44D36DEAD54AB16: There is no assurance this key belongs to the named user

sub  rsa1024/C44D36DEAD54AB16 2011-02-05 Notmuch Test Suite
 (INSECURE!)
 Primary key fingerprint: 5AEA B11F 5E33 DCE8 75DD  B75B 6D92 612D 94E4 6381
  Subkey fingerprint: 8987 5467 478A A81C EBD5  2E7E C44D 36DE AD54 AB16

It is NOT certain that the key belongs to the person named
in the user ID.  If you *really* know what you are doing,
you may answer the next question with yes.

Use this key anyway? (y/N)
```

Confirming that works, of course. Also, `gpg --always-trust -ear
6D92612D94E46381` works.

```
 sh-5.2# printf '%s:6:\n' "$FINGERPRINT" | gpg --quiet
--batch --no-tty --import-ownertrust
gpg: inserting ownertrust of 6
```
(like test-lib.sh does) and then encryption works - no questions asked.
So, all that works.

Are all gpg related tests emacs based? Either gpg or emacs is the red
herring here, or both ...

Unfortunately I have no clue about emacs/lisp and cannot dig further
there. I just know it's 100% reproducible (for f39 mock on f38, all fedoras
in copr, but not f38 mock on f38). Stomped.

Cheers
Michael
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] notmuch-mutt: convert ISO-8859-15 copyright statement to UTF-8

2023-05-25 Thread David Bremner
Paul Wise  writes:

> Suggested-by: isutf8 & check-all-the-things

Applied to master.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] vim: add per-message tagging

2023-05-25 Thread David Bremner
Felipe Contreras  writes:

> Also map space to mark a message as read and archived.

Is this a change that would make sense by itself? If so I think it would
be better as a separate commit, especially since I use "git shortlog" to
make up release notes.


> +function! s:show_message_tag(intags)
> + if empty(a:intags)
> + let tags = input('tags: ')
> + else
> + let tags = a:intags
> + endif
> + ruby do_tag('id:' + get_message.message_id, VIM::evaluate('l:tags'))
> +  call s:show_next_msg()
> +endfunction
> +

As we discussed, I can't meaningfully review the vimscript parts (and
nobody else seems interested / willing). I've (re?)  enabled push access
for you at

g...@git.notmuchmail.org:notmuch

For now the access is to everything under vim/. We can discuss direct
access for the ruby bindings later.  It's the first time I've used this
feature of gitolite, so if you can't get it to work let me know, either
by email or (perhaps more efficiently) by IRC on
irc://irc.libera.chat/notmuch
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] ruby: query: fix get sort

2023-05-25 Thread David Bremner
Felipe Contreras  writes:

> The order was wrong, right now `query.sort` doesn't return a number.
>

applied to master

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org