From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Some testing issues Date: Fri, 14 Jul 2017 09:44:10 -0400 Message-ID: References: <8737a8j61r.fsf@rosalinde> <87wp7jnfpz.fsf@rosalinde> <87mv87gx4r.fsf@rosalinde> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1500039920 10285 195.159.176.226 (14 Jul 2017 13:45:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 14 Jul 2017 13:45:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stephen Berman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 14 15:45:11 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dW0tz-0001qD-Vi for ged-emacs-devel@m.gmane.org; Fri, 14 Jul 2017 15:45:04 +0200 Original-Received: from localhost ([::1]:38092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dW0u4-0004NY-1o for ged-emacs-devel@m.gmane.org; Fri, 14 Jul 2017 09:45:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dW0tN-0004NR-Jc for emacs-devel@gnu.org; Fri, 14 Jul 2017 09:44:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dW0tH-000656-Pl for emacs-devel@gnu.org; Fri, 14 Jul 2017 09:44:25 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:35432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dW0tH-00064g-IP for emacs-devel@gnu.org; Fri, 14 Jul 2017 09:44:19 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v6EDiAxw008492; Fri, 14 Jul 2017 09:44:11 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id B2A29660B0; Fri, 14 Jul 2017 09:44:10 -0400 (EDT) In-Reply-To: <87mv87gx4r.fsf@rosalinde> (Stephen Berman's message of "Fri, 14 Jul 2017 11:56:20 +0200") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6072=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6072> : inlines <5978> : streams <1754154> : uri <2462729> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:216650 Archived-At: > Well, as I noted, when pos-visible-in-window-p is called in > todo-toggle-view-done-items, the selected window is displaying the > current buffer and AFAICT that can't go wrong when using todo-mode as > intended (i.e., not invoking todo-toggle-view-done-items outside of > todo-mode). Then I suggest you add a (cl-assert (eq (current-buffer) (window-buffer))) and then declare that it's the caller's responsibility (e.g. the test environment) to make sure this is true. This said, another approach is to say that `recenter` is simply not needed in case the buffer is not displayed anywhere (which could presumably happen if you call this code from some ad-hoc Elisp function), so if (eq (current-buffer) (window-buffer)) is nil, just don't bother checking visibility nor recentering. Stefan