Re: New release for Emacs 27.1?

2020-08-11 Thread Tomi Ollila
On Wed, Aug 12 2020, Damien Cassou wrote:

> Hi,
>
> Emacs 27.1 being officially out, is it the right moment to release
> Notmuch? People will face problems otherwise because Notmuch got some
> fixes for Emacs 27.1 recently.

Release cycle for 0.31 could be shorter, just for that reason. 

There are 2 patch (series) (re)sent yesterday, which could be considered
for inclusion, provided we get those reviewed and tested =D

See https://nmbug.notmuchmail.org/status/#Review

(Not to forget older good (also emacs-related) changes that are in
 review queue, but those need more to get into -- and/or don't apply
 anymore due to merge conflict...)

Tomi

>
> Best,
>
> -- 
> Damien Cassou
>
> "Success is the ability to go from one failure to another without
> losing enthusiasm." --Winston Churchill
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


New release for Emacs 27.1?

2020-08-11 Thread Damien Cassou
Hi,

Emacs 27.1 being officially out, is it the right moment to release
Notmuch? People will face problems otherwise because Notmuch got some
fixes for Emacs 27.1 recently.

Best,

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 2/3] emacs/tree: enable moving to next thread in search results

2020-08-11 Thread William Casarin
This introduces a new function called
notmuch-tree-next-thread-from-search which is analogous to
notmuch-show-next-thread. It will switch to the next or previous
thread from the parent search results.

We rename notmuch-tree-{prev,next}-thread to a more descriptive
notmuch-tree-{prev,next}-thread-in-tree to reflect the fact that it
only moves to the next thread in the current tree.

notmuch-tree-next-thread now switches to the next thread in the
current tree first, but if there are none, it looks for the next tree
in the search results.

This makes notmuch-tree feel more like notmuch-show when using the
M-Enter, M-n and M-p bindings.

Signed-off-by: William Casarin 
---
 emacs/notmuch-tree.el | 40 +---
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 29f64851..bf500b60 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -725,12 +725,14 @@ nil otherwise."
 (while (not (or (notmuch-tree-get-prop :first) (eobp)))
   (forward-line -1
 
-(defun notmuch-tree-prev-thread ()
+(defun notmuch-tree-prev-thread-in-tree ()
+  "Move to the previous thread in the current tree"
   (interactive)
   (forward-line -1)
-  (notmuch-tree-thread-top))
+  (notmuch-tree-thread-top)
+  (not (bobp)))
 
-(defun notmuch-tree-next-thread ()
+(defun notmuch-tree-next-thread-in-tree ()
   "Get the next thread in the current tree. Returns t if a thread was
 found or nil if not."
   (interactive)
@@ -739,6 +741,38 @@ found or nil if not."
 (forward-line 1))
   (not (eobp)))
 
+(defun notmuch-tree-next-thread-from-search ( previous)
+  "Move to the next thread in the parent search results, if any.
+
+If PREVIOUS is non-nil, move to the previous item in the
+search results instead."
+  (interactive "P")
+  (let ((parent-buffer notmuch-tree-parent-buffer))
+(notmuch-tree-quit t)
+(when (buffer-live-p parent-buffer)
+  (switch-to-buffer parent-buffer)
+  (if previous
+ (notmuch-search-previous-thread)
+   (notmuch-search-next-thread))
+  (notmuch-tree-from-search-thread
+
+(defun notmuch-tree-next-thread ( previous)
+  "Move to the next thread in the current tree or parent search
+results
+
+If PREVIOUS is non-nil, move to the previous thread in the tree or
+search results instead."
+  (interactive)
+  (unless (if previous (notmuch-tree-prev-thread-in-tree)
+   (notmuch-tree-next-thread-in-tree))
+(notmuch-tree-next-thread-from-search previous)))
+
+(defun notmuch-tree-prev-thread ()
+  "Move to the previous thread in the current tree or parent search
+results"
+  (interactive)
+  (notmuch-tree-next-thread t))
+
 (defun notmuch-tree-thread-mapcar (function)
   "Iterate through all messages in the current thread
  and call FUNCTION for side effects."
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 3/3] emacs/tree: add notmuch-tree-archive-thread-then-next

2020-08-11 Thread William Casarin
Now that notmuch-tree-next-thread acts more like its notmuch-show
counterpart, let's update the binding to move to the next thread after
archiving.

Signed-off-by: William Casarin 
---
 emacs/notmuch-tree.el | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index bf500b60..2bb7c80f 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -338,7 +338,7 @@ FUNC."
 (define-key map [mouse-1] 'notmuch-tree-show-message)
 (define-key map "x" 'notmuch-tree-archive-message-then-next-or-exit)
 (define-key map "X" 'notmuch-tree-archive-thread-then-exit)
-(define-key map "A" 'notmuch-tree-archive-thread)
+(define-key map "A" 'notmuch-tree-archive-thread-then-next)
 (define-key map "a" 'notmuch-tree-archive-message-then-next)
 (define-key map "z" 'notmuch-tree-to-tree)
 (define-key map "n" 'notmuch-tree-next-matching-message)
@@ -497,6 +497,12 @@ NOT change the database."
 (notmuch-tree-close-message-window)
 (notmuch-tree query)))
 
+(defun notmuch-tree-archive-thread-then-next ()
+  "Archive all messages in the current buffer, then show next thread from 
search."
+  (interactive)
+  (notmuch-tree-archive-thread)
+  (notmuch-tree-next-thread))
+
 (defun notmuch-unthreaded-from-tree-current-query ()
   "Switch from tree view to unthreaded view."
   (interactive)
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH v2 1/3] emacs/tree: introduce notmuch-tree-parent-buffer variable

2020-08-11 Thread William Casarin
This variable will be used in a similar fashion to
notmuch-show-parent-buffer. It will be used to navigate between
threads from the parent search buffer.

Signed-off-by: William Casarin 
---

This is a rebased version of id:20200423234715.6633-1-j...@jb55.com on
top of Jonas' emacs cleanups.

This patch series makes it easier to navigate threads in tree mode.

Basic usage: a thread is entered via M-RET. Then you can use A to
archive and jump to the next thread.

 emacs/notmuch-tree.el | 6 +-
 emacs/notmuch.el  | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index fbba4bb3..29f64851 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -222,6 +222,9 @@ For example:
   "A buffer local copy of argument open-target to the function notmuch-tree.")
 (make-variable-buffer-local 'notmuch-tree-open-target)
 
+(defvar notmuch-tree-parent-buffer nil)
+(make-variable-buffer-local 'notmuch-tree-parent-buffer)
+
 (defvar notmuch-tree-message-window nil
   "The window of the message pane.
 
@@ -1050,7 +1053,7 @@ the same as for the function notmuch-tree."
  ")")
 notmuch-tree-basic-query))
 
-(defun notmuch-tree ( query query-context target buffer-name 
open-target unthreaded)
+(defun notmuch-tree ( query query-context target buffer-name 
open-target unthreaded parent-buffer)
   "Display threads matching QUERY in tree view.
 
 The arguments are:
@@ -1080,6 +1083,7 @@ The arguments are:
   ;; Don't track undo information for this buffer
   (set 'buffer-undo-list t)
   (notmuch-tree-worker query query-context target open-target unthreaded)
+  (setq notmuch-tree-parent-buffer parent-buffer)
   (setq truncate-lines t))
 
 (defun notmuch-unthreaded ( query query-context target buffer-name 
open-target)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index babddbb6..8132cea6 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -545,7 +545,7 @@ thread."
notmuch-search-query-string
nil
(notmuch-prettify-subject (notmuch-search-find-subject))
-   t))
+   t nil (current-buffer)))
 
 (defun notmuch-search-reply-to-thread ( prompt-for-sender)
   "Begin composing a reply-all to the entire current thread in a new buffer."

base-commit: 1c80020e701c7323de137c0616fc8864443d7bd3
-- 
2.28.0
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH] notmuch-mutt: replace shell pipeline with internal pipe processing

2020-08-11 Thread David Bremner
Tomi Ollila  writes:

> The shell pipeline used to symlink files based in search results
> to "cache" directory for mutt(1) to use was prone to portability
> problems (due to /bin/sh differences).
>
> The replacement executes `notmuch search` without intermediate shell
> (so shell_quote was removed in this case), reads the filenames from
> piped output and symlinks files internally.
> ---
>
> Now also tested a bit by me (remoteusage provides stale symlinks ;)

tested by the original bug reporter

   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=966100#22

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


[PATCH v2] emacs: Use pop-to-buffer-same-window rather than switch-to-buffer

2020-08-11 Thread Sean Whitton
This means that notmuch commands obey display-buffer-alist so the user
can customize how buffers show up.

It also permits the use of C-x 4 4, C-x 5 5 and C-x t t, available in
Emacs 28.  For example, one can use C-x 4 4 M-x notmuch-jump-search RET
to open a saved search in another window rather than the current window.
Or in notmuch-search mode, C-x 5 5 RET to view the message at point in
a new frame.

notmuch-tree has custom buffer display logic, so bind
display-buffer-overriding-action to make pop-to-buffer-same-window
behave exactly as switch-to-buffer while that function is running.
---
Changes since v1: rebased onto latest master.

 emacs/notmuch-draft.el |  3 ++-
 emacs/notmuch-hello.el |  2 +-
 emacs/notmuch-show.el  |  8 
 emacs/notmuch-tree.el  | 13 +
 emacs/notmuch.el   |  4 ++--
 5 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/emacs/notmuch-draft.el b/emacs/notmuch-draft.el
index 759e6c9e..283830ad 100644
--- a/emacs/notmuch-draft.el
+++ b/emacs/notmuch-draft.el
@@ -232,7 +232,8 @@ applied to newly inserted messages)."
 (draft (equal tags (notmuch-update-tags tags notmuch-draft-tags
 (when (or draft
  (yes-or-no-p "Message does not appear to be a draft: edit as new? 
"))
-  (switch-to-buffer (get-buffer-create (concat "*notmuch-draft-" id "*")))
+  (pop-to-buffer-same-window
+   (get-buffer-create (concat "*notmuch-draft-" id "*")))
   (setq buffer-read-only nil)
   (erase-buffer)
   (let ((coding-system-for-read 'no-conversion))
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index c127bba9..bb60a890 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -973,7 +973,7 @@ following:
   (let ((notmuch-hello-auto-refresh nil))
 (if no-display
(set-buffer "*notmuch-hello*")
-  (switch-to-buffer "*notmuch-hello*")))
+  (pop-to-buffer-same-window "*notmuch-hello*")))
   ;; Install auto-refresh hook
   (when notmuch-hello-auto-refresh
 (add-hook 'window-configuration-change-hook
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b0f2d28b..98d9c935 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1241,7 +1241,7 @@ matched."
(eval (car (get 'mm-inline-override-types 
'standard-value
 (cons "application/*" mm-inline-override-types)
   mm-inline-override-types)))
-(switch-to-buffer (get-buffer-create buffer-name))
+(pop-to-buffer-same-window (get-buffer-create buffer-name))
 ;; No need to track undo information for this buffer.
 (setq buffer-undo-list t)
 (notmuch-show-mode)
@@ -1998,7 +1998,7 @@ to show, nil otherwise."
   (let* ((id (notmuch-show-get-message-id))
 (buf (get-buffer-create (concat "*notmuch-raw-" id "*")))
 (inhibit-read-only t))
-(switch-to-buffer buf)
+(pop-to-buffer-same-window buf)
 (erase-buffer)
 (let ((coding-system-for-read 'no-conversion))
   (call-process notmuch-command nil t nil "show" "--format=raw" id))
@@ -2057,7 +2057,7 @@ message."
  (set-buffer-modified-p nil)
  (setq buffer-read-only t)
  (unless (zerop exit-code)
-   (switch-to-buffer-other-window buf)
+   (pop-to-buffer buf)
(message (format "Command '%s' exited abnormally with code %d"
 shell-command exit-code
 
@@ -2465,7 +2465,7 @@ If the part is displayed in an external application then 
close
 the new buffer."
   (let ((buf (get-buffer-create (generate-new-buffer-name
 (concat " *notmuch-internal-part*")
-(switch-to-buffer buf)
+(pop-to-buffer-same-window buf)
 (if (eq (mm-display-part handle) 'external)
(kill-buffer buf)
   (goto-char (point-min))
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index fbba4bb3..f36a6e72 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -543,9 +543,14 @@ NOT change the database."
   (setq notmuch-tree-message-window
(split-window-vertically (/ (window-height) 4)))
   (with-selected-window notmuch-tree-message-window
-   ;; Since we are only displaying one message do not indent.
-   (let ((notmuch-show-indent-messages-width 0)
- (notmuch-show-only-matching-messages t))
+   (let (;; Since we are only displaying one message do not indent.
+ (notmuch-show-indent-messages-width 0)
+ (notmuch-show-only-matching-messages t)
+ ;; Ensure that `pop-to-buffer-same-window' uses the
+ ;; window we want it to use.
+ (display-buffer-overriding-action
+'((display-buffer-same-window)
+  (inhibit-same-window . nil
  (setq buffer (notmuch-show id
   ;; We need the `let' as notmuch-tree-message-window is buffer local.
   (let ((window notmuch-tree-message-window))
@@ -1076,7 +1081,7 @@ The arguments 

[PATCH] configure: Check if emacs >= 25 (instead of >= 24) is available

2020-08-11 Thread Tomi Ollila
"The minimum supported major version of GNU Emacs is now 25.1."

25.1 is the first "released" version of Emacs 25.
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index a357eb91..40e8b255 100755
--- a/configure
+++ b/configure
@@ -829,8 +829,8 @@ if [ -z "${EMACSETCDIR-}" ]; then
 fi
 
 if [ $WITH_EMACS = "1" ]; then
-printf "Checking if emacs (>= 24) is available... "
-if emacs --quick --batch --eval '(if (< emacs-major-version 24) 
(kill-emacs 1))' > /dev/null 2>&1; then
+printf "Checking if emacs (>= 25) is available... "
+if emacs --quick --batch --eval '(if (< emacs-major-version 25) 
(kill-emacs 1))' > /dev/null 2>&1; then
 printf "Yes.\n"
 else
 printf "No (disabling emacs related parts of build)\n"
-- 
2.26.2
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org