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 EE42C6DE12C1 for ; Sat, 8 Oct 2016 14:01:36 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.146 X-Spam-Level: X-Spam-Status: No, score=-0.146 tagged_above=-999 required=5 tests=[AWL=-0.125, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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 Pc88LakWNdhO for ; Sat, 8 Oct 2016 14:01:36 -0700 (PDT) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id 159826DE12C0 for ; Sat, 8 Oct 2016 14:01:36 -0700 (PDT) Received: by mail-wm0-f67.google.com with SMTP id i130so8133417wmg.0 for ; Sat, 08 Oct 2016 14:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adirat-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UmRo/+GmYaT8uqprGa0FVHomsQ71iMqpHPO30/EH9lU=; b=D+jk3BWE8wXuMa4uhK0gRscAcpdHpHXBWh5fBe990VYhucORwuaoRt7EesuZwGc76+ c7Edp7cKSKZQAvhLGTGaaZzQQS4yvjlSvV9JZCQ7CVznTmiZljL91bGVUMxYinU/I0UN AD9f/A+jneOV9n86exLdxYRYUBfVtWV3o39Gvh9YJtbV62GjnJR5F7htAO7uIA2fchIw 7/UCMfgX2TCN38W+mU24LUddaeoTpA30+sUGJaZasRkV/PCHneLd84UHf5esARZ8kL7b +SeI9WEwZB/kz+1wrTEcPMO/OSkBU4gd6mXUJKUXWGslhc2EEnUlHb+wppr5WHCMRmO4 AMZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UmRo/+GmYaT8uqprGa0FVHomsQ71iMqpHPO30/EH9lU=; b=i5Sewskgfinyl/uRHas7PpD2SW/9STfIBgNRoAtauUX4ogIssq1FTaeQHXvbEFYnSw bNU+zbOaY6O0B5F2rWHQrJo7esSM6DqWsog/rZMkebCG2MWrWmRSmCV25adLWrvvP7o+ JDOWtwWRtSPggSunqvTYCUuFvRMdd/ppmRNNiuI4CyuXt7IKRezIdBTYyWXHMVf3JrT6 soCM22G650C4Js2tFiYOIXk1mMRJvBuadGWa5dezGV/GkwZiDKm3suK88loN1DpuG4lr X0N0MntITY5XRJrcopaM5nw14F8X7o+UxarlpIhAQHQUV5PMyVKn/Rob2XZvQ39b3Cer B7+w== X-Gm-Message-State: AA6/9RkMLVekcAzZHNZDmDOoPxjMylIvqQ2ul4AvSerLJrWLDQI2aXMMHLs2xM3tJET4Fg== X-Received: by 10.194.103.138 with SMTP id fw10mr20914854wjb.93.1475960494476; Sat, 08 Oct 2016 14:01:34 -0700 (PDT) Received: from adiPC.lan ([188.24.54.197]) by smtp.gmail.com with ESMTPSA id bl3sm26649351wjc.26.2016.10.08.14.01.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Oct 2016 14:01:33 -0700 (PDT) From: Ioan-Adrian Ratiu To: notmuch@notmuchmail.org Subject: [PATCH v4 3/6] emacs: notmuch-search: add no-display functionality Date: Sun, 9 Oct 2016 00:01:36 +0300 Message-Id: <20161008210139.25322-4-adi@adirat.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161008210139.25322-1-adi@adirat.com> References: <20161008210139.25322-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, 08 Oct 2016 21:01:37 -0000 If no-display is non-nil when updating a notmuch-search buffer, do not force bring to foreground in a window said search results buffer. Signed-off-by: Ioan-Adrian Ratiu --- emacs/notmuch.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 17a784d..8d5e20c 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -925,7 +925,7 @@ PROMPT is the string to prompt with." ;;;###autoload (put 'notmuch-search 'notmuch-doc "Search for messages.") -(defun notmuch-search (&optional query oldest-first target-thread target-line) +(defun notmuch-search (&optional query oldest-first target-thread target-line no-display) "Display threads matching QUERY in a notmuch-search buffer. If QUERY is nil, it is read interactively from the minibuffer. @@ -936,6 +936,9 @@ Other optional parameters are used as follows: current if it appears in the search results. TARGET-LINE: The line number to move to if the target thread does not appear in the search results. + NO-DISPLAY: Do not try to foreground the search results buffer. If it is + already foregrounded i.e. displayed in a window, this has no + effect, meaning the buffer will remain visible. When called interactively, this will prompt for a query and use the configured default sort order." @@ -949,7 +952,9 @@ the configured default sort order." (let* ((query (or query (notmuch-read-query "Notmuch search: "))) (buffer (get-buffer-create (notmuch-search-buffer-title query)))) - (switch-to-buffer buffer) + (if no-display + (set-buffer buffer) + (switch-to-buffer buffer)) (notmuch-search-mode) ;; Don't track undo information for this buffer (set 'buffer-undo-list t) @@ -982,7 +987,7 @@ the configured default sort order." (set-process-query-on-exit-flag proc nil)))) (run-hooks 'notmuch-search-hook))) -(defun notmuch-search-refresh-view (&rest ignore) +(defun notmuch-search-refresh-view (&optional ignore no-display) "Refresh the current view. Erases the current buffer and runs a new search with the same @@ -997,7 +1002,7 @@ same relative position within the new buffer." (inhibit-read-only t)) (remove-overlays) (erase-buffer) - (notmuch-search query oldest-first target-thread target-line) + (notmuch-search query oldest-first target-thread target-line no-display) (goto-char (point-min)))) (defun notmuch-search-toggle-order () -- 2.10.0