From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id C4D3E6DE0B7C for ; Sat, 10 Sep 2016 07:28:24 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.721 X-Spam-Level: X-Spam-Status: No, score=-0.721 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A92Qk4gzn-qd for ; Sat, 10 Sep 2016 07:28:24 -0700 (PDT) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by arlo.cworth.org (Postfix) with ESMTPS id CFCCE6DE0B6D for ; Sat, 10 Sep 2016 07:28:23 -0700 (PDT) Received: by mail-wm0-f68.google.com with SMTP id g64so2571329wma.3 for ; Sat, 10 Sep 2016 07:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adirat-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=vBVqXxnqpwIj9BNNu6pd7YtY6WSH6QkDNhUVQc55tLw=; b=khiq3JLaYCj25kdPWidQO/mo6Ov0twzTXlD8Ugv/7hDleAsLZfDPDCwpRbJ/8wCyzO 6eALVFcq1YlH6dtBeSY3pPCwXLTX2uvpBVDJfz0MsUiAGibpHkn2Y0s6pA6KtAmBYjuG wLnnS5eKJmCXcM9i416b0rPUf8+Ei3YVvZJqbuZeEYQsybVbxczyUcDj3sDf8HyxpXZl QmVonhhAIaP0fH73XRolb12gSJ9jwnnHm/LD+Da2SirvjGlM82ACU6LClR1F1091c5L7 uUT931I/6+i9ZQJfQUeCgkMAVmPLyWNb7kS8XVubhm2LnRW/OQMD8pChFCq40V0goNpo MciA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=vBVqXxnqpwIj9BNNu6pd7YtY6WSH6QkDNhUVQc55tLw=; b=dGR7KKA7sxjsMgTA5QJnqxSfdCpSDuHZR+r5lz6L5jMNnyFlTdVkes4tEDV//njfkp dneh4tT644ezg0WgUQICkUla2Pxod9pSq/rsW9N9k07haRsR1ieVoBUJunv0LLDXuLXn dC41QGTLZDMFWvN9pdjLCWskNNwpCkGPcGYh6qIiHfFfzgRG+4wPcLAbJ8LZMyZCrME/ fD7xNi3L2TeZXC1nxwc5WzzE/0nHR/wlZcqc+b0BQLNxm+mm3+gyfmXbZhfknZNWkbDA OJpjzy8ojhI4ekovt6gnVZtdzMWxEO262/7FQ6S5fHK4lXCC5y5iqA17s9dgP89kfg0w CHqA== X-Gm-Message-State: AE9vXwNm/Ecacv7BD4BHh/SsQNQ0ZmLrllTWigXqc4EDbuo6X6m3pyb/yewZREsNURJ8LA== X-Received: by 10.194.75.37 with SMTP id z5mr8755878wjv.102.1473517702162; Sat, 10 Sep 2016 07:28:22 -0700 (PDT) Received: from adiPC.lan ([188.24.78.211]) by smtp.gmail.com with ESMTPSA id s6sm8555457wjm.25.2016.09.10.07.28.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Sep 2016 07:28:21 -0700 (PDT) From: Ioan-Adrian Ratiu To: notmuch@notmuchmail.org Subject: [PATCH 2/4] emacs: adjust all types of notmuch show buffers Date: Sat, 10 Sep 2016 17:28:17 +0300 Message-Id: <20160910142819.19349-3-adi@adirat.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160910142819.19349-1-adi@adirat.com> References: <20160910142819.19349-1-adi@adirat.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2016 14:28:24 -0000 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 --- 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))))) ;; Movement related functions. -- 2.9.3