emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some testing issues


From: Stefan Monnier
Subject: Re: Some testing issues
Date: Fri, 14 Jul 2017 09:44:10 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]