[PATCH] emacs: Use pop-to-buffer-same-window rather than switch-to-buffer
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. --- 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 27abc7d9..3a9750e1 100644 --- a/emacs/notmuch-draft.el +++ b/emacs/notmuch-draft.el @@ -228,7 +228,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 0ff5aaff..3b4ed2b7 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -967,7 +967,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 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index c9170466..4ee34f8e 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1270,7 +1270,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) @@ -2039,7 +2039,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)) @@ -2095,7 +2095,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 @@ -2503,7 +2503,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 ab90f652..7ed06ffd 100644 --- a/emacs/notmuch-tree.el +++ b/emacs/notmuch-tree.el @@ -527,9 +527,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)) @@ -1061,7 +1066,7 @@ The arguments are: query "*") (inhibit-read-only t)) -
Re: [PATCH v2 06/23] emacs: Use cl-incf where appropriate
Tomi Ollila writes: > NEWS for notmuch 0.29 says that: > > " > The minimum supported major version of Emacs is now 24. > > Support for GNU Emacs older than 25.1 is deprecated with this release, > and may be removed in a future release. > " > > So we have 3 options: > > 1) apply this patch and now drop support for emacs 24 > > 2) apply this patch and somehow infor emacs 24 users to install cl-lib from > ELPA I'm fine with either of these options. I'd hope we can specify what versions we need in emacs/notmuch-pkg.el.templ d ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v2] configure: check for pytest with python -m pytest
On Mon, Aug 03 2020, Đoàn Trần Công Danh wrote: > On different distro, pytest is suffixed with different patterns. > > On the other hand, `python3-pytest' could be invoked correctly, > via `python3 -m pytest', the latter is used by our tests, now. > > Switch to `$python -m pytest` to fix address all incompatible naming. > > Signed-off-by: Đoàn Trần Công Danh THis series looks good to me on my terminal, but does not apply to my tree (HEAD commit: 0e4695ab (origin/master) test: regression tests for n_indexopts_{get,set}_decrypt_policy) Tomi > --- > configure | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/configure b/configure > index db3538b3..f7c1c095 100755 > --- a/configure > +++ b/configure > @@ -814,7 +814,7 @@ if [ $have_python3 -eq 1 ]; then > printf "Checking for python3 pytest (>= 3.0)... " > conf=$(mktemp) > printf "[pytest]\nminversion=3.0\n" > $conf > -if pytest-3 -c $conf --version >/dev/null 2>&1; then > +if "$python" -m pytest -c $conf --version >/dev/null 2>&1; then > printf "Yes.\n" > have_python3_pytest=1 > else > -- > 2.28.0.163.g6104cc2f0b ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v2 06/23] emacs: Use cl-incf where appropriate
On Thu, Aug 06 2020, Jonas Bernoulli wrote: > David Bremner writes: >> "cl-incf is a Lisp macro in ‘aquamacs-tools.el’." >> >> What the actual heck? > > Indeed. Did you follow the link to the definition to figure out what's > going on? > > Ah... I found this: https://github.com/dholm/tabbar/commit/6d5a6935879. > IMO it's wrong to do that, but that is of no concern here. > >> Anyway, that aside, what version of emacs is this available from? > > Emacs 24.3. A forward compatibility implementation for older versions > is available at https://elpa.gnu.org/packages/cl-lib.html. > > I didn't find any information about what minimal Emacs version Notmuch > expects but https://notmuchmail.org/emacstips/#index1h2 implies that it > is 24.1. > > IMO it would be reasonable to expect at least 24.3, 24.5 or even 25.1. > See https://www.gnu.org/software/emacs/history.html for release dates. NEWS for notmuch 0.29 says that: " The minimum supported major version of Emacs is now 24. Support for GNU Emacs older than 25.1 is deprecated with this release, and may be removed in a future release. " So we have 3 options: 1) apply this patch and now drop support for emacs 24 2) apply this patch and somehow infor emacs 24 users to install cl-lib from ELPA 3) hold this particular patch until notmuch 0.31 is released and drop support for emacs 24 then (would that mean quite a few following patches not to apply anymore ;/ Anyway, the patch series V2 looked good to me (on terminal) Tomi > > Or you might want to just drop this commit. Or we could update the FAQ > to mention that one has to install cl-lib from GNU ELPA if one uses such > an ancient Emacs release. > > Jonas ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH 2/3] emacs/tree: enable moving to next thread in search results
* 2020-04-23 17:07:04-07, William Casarin wrote: > which I will send in a v2 once this gets some Concept ACKs. Feel free > to test in the meantime! Hopefully this makes tree-mode more usable > for people who only use notmuch-show. > > Basic usage following the previous emacs/tree improvements: > > Press M-Enter on a thread from search-mode to enter that thread in > notmuch-tree mode. With these patches, M-n and M-p move between search > result threads, and A works as you would expect as well (archive and > then move to next thread) This is a good improvement and I would like to test it but the patches don't apply anymore. Would you like to send updated series? -- /// Teemu Likonen - .-.. http://www.iki.fi/tlikonen/ // OpenPGP: 4E1055DC84E9DFF613D78557719D69D324539450 signature.asc Description: PGP signature ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH v5] Emacs: Ensure left-to-right display for message headers
On Friday, 2020-08-07 at 07:46:41 +03, Teemu Likonen wrote: > In notmuch-show buffer insert invisible U+200E LEFT-TO-RIGHT MARK > character at the beginning of message header paragraph if the From > header contains a right-to-left character. This ensures that the > header paragraph is always rendered in left-to-right mode. > > See Emacs Lisp reference manual section "(elisp) Bidirectional > Display" for more info. Reviewed-by: David Edmondson > --- > emacs/notmuch-show.el | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > > As the commit description says this version inserts U+200E > LEFT-TO-RIGHT MARK only if the first header line (From header) > contains a right-to-left character. > > This version is probably friendlier to the current test files which > don't expect to see U+200E LEFT-TO-RIGHT MARK in the output. > > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index c9170466..0eb27e33 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -466,10 +466,16 @@ unchanged ADDRESS if parsing fails." > (defun notmuch-show-insert-headerline (headers date tags depth) >"Insert a notmuch style headerline based on HEADERS for a > message at DEPTH in the current thread." > - (let ((start (point))) > + (let ((start (point)) > + (from (notmuch-sanitize > +(notmuch-show-clean-address (plist-get headers :From) > +(when (string-match "\\cR" from) > + ;; If the From header has a right-to-left character add > + ;; invisible U+200E LEFT-TO-RIGHT MARK character which forces > + ;; the header paragraph as left-to-right text. > + (insert (propertize (string ?\x200e) 'invisible t))) > (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width > depth)) > - (notmuch-sanitize > - (notmuch-show-clean-address (plist-get headers :From))) > + from > " (" > date > ") (" > -- > 2.20.1 dme. -- At least they're not lonely. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org