unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: Ioan-Adrian Ratiu <adi@adirat.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH 2/4] emacs: adjust all types of notmuch show buffers
Date: Fri, 16 Sep 2016 21:34:12 +0100	[thread overview]
Message-ID: <87d1k3bn3v.fsf@qmul.ac.uk> (raw)
In-Reply-To: <20160910142819.19349-3-adi@adirat.com>


On Sat, 10 Sep 2016, Ioan-Adrian Ratiu <adi@adirat.com> wrote:
> The current notmuch-show-message-adjust logic only adjusts the buffer
> focused in the current window. Extend it to adjust any kind of buffer,
> even buffers in a window without focus or in a different frame or even
> not shown at all.
>
> This new logic is very useful to build upon for the auto-refresh all
> buffers feature because you can use similar code to refresh any buffer:
>
> (with-current-buffer "*random show buffer*"
>   (notmuch-refresh-this-buffer))
>
> Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
> ---
>  emacs/notmuch-show.el | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 6d3149b..74818cc 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1505,7 +1505,16 @@ All currently available key bindings:
>    (goto-char (notmuch-show-message-bottom)))
>  
>  (defun notmuch-show-message-adjust ()
> -  (recenter 0))
> +  (let ((buffer-window (get-buffer-window (current-buffer) t))
> +	(msg-position (point)))
> +    (if buffer-window
> +	(with-selected-window buffer-window
> +	  (goto-char msg-position)
> +	  (recenter 0))
> +      (save-window-excursion
> +	(select-window (display-buffer (current-buffer)))
> +	(goto-char msg-position)
> +	(recenter 0)))))

Hi

I haven't tested things yet, but what happens if the buffer is open in
multiple windows?

I think it would be worth adding something to the commit message along
the lines of

    notmuch-show-refresh-view calls notmuch-show-message-adjust in its
    call chain. Since we want to call notmuch-show-refresh-view on
    buffers than are not displayed we need to modify
    notmuch-show-message-adjust to work in this case.

Best wishes

Mark


>  ;; Movement related functions.
>  
> -- 
> 2.9.3
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

  reply	other threads:[~2016-09-16 20:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-10 14:28 [PATCH 0/4] Add refresh all buffers functionality Ioan-Adrian Ratiu
2016-09-10 14:28 ` [PATCH 1/4] emacs: reuse buffer when refreshing searches Ioan-Adrian Ratiu
2016-09-16 19:59   ` Mark Walters
2016-09-10 14:28 ` [PATCH 2/4] emacs: adjust all types of notmuch show buffers Ioan-Adrian Ratiu
2016-09-16 20:34   ` Mark Walters [this message]
2016-09-17  8:21     ` Ioan-Adrian Ratiu
2016-09-10 14:28 ` [PATCH 3/4] emacs: add refresh buffer optional no-display arg Ioan-Adrian Ratiu
2016-09-10 14:28 ` [PATCH 4/4] emacs: add refresh all buffers function Ioan-Adrian Ratiu
2016-09-16 20:40   ` Mark Walters
2016-09-17  8:58     ` Ioan-Adrian Ratiu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d1k3bn3v.fsf@qmul.ac.uk \
    --to=markwalters1009@gmail.com \
    --cc=adi@adirat.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).