From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: Re: master 941a2e7: todo-mode: don't assume an ordering of tests Date: Wed, 31 May 2017 16:18:52 +0200 Message-ID: <87d1ap2joz.fsf@rosalinde> References: <20170530005055.14646.47570@vcs0.savannah.gnu.org> <20170530005057.4720C20ACA@vcs0.savannah.gnu.org> <87vaoiafgf.fsf@rosalinde> <877f0y9l7g.fsf@rosalinde> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1496241156 14987 195.159.176.226 (31 May 2017 14:32:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 31 May 2017 14:32:36 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 31 16:32:32 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 1dG4fo-0003eB-Ap for ged-emacs-devel@m.gmane.org; Wed, 31 May 2017 16:32:32 +0200 Original-Received: from localhost ([::1]:59845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG4fr-0000s5-Tq for ged-emacs-devel@m.gmane.org; Wed, 31 May 2017 10:32:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dG4Si-0005az-Qm for emacs-devel@gnu.org; Wed, 31 May 2017 10:19:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dG4Sh-00041N-O9 for emacs-devel@gnu.org; Wed, 31 May 2017 10:19:00 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:55706) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dG4Sd-0003zx-Q8; Wed, 31 May 2017 10:18:56 -0400 Original-Received: from rosalinde ([83.135.14.77]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Md3li-1dX3Lb1Gvy-00IHCc; Wed, 31 May 2017 16:18:53 +0200 In-Reply-To: (Glenn Morris's message of "Tue, 30 May 2017 20:48:56 -0400") X-Provags-ID: V03:K0:9zGvJxunlI7LukP0pX3MaNpBlbV/lQc6b0WOXveH8ONEK31lqFR Do8vTOrm+35/VRdOcROn0WQT3cfmsMzicpuuaaRuro/FpPkA7sbP9Lk54LAuNvqQfjPzFFX geAmCakKs+4rNXOlYAy7vtFm8dokKtr3+FvnuP5MF6ITme7kl5v3crlvBFb8vm6hQwc8mGW SUyNO9Q/87z4H3zkAD92w== X-UI-Out-Filterresults: notjunk:1;V01:K0:YHqKb4NeBEU=:oi4Qh6zldYItc+25RapftC nJWL4bUBHBLLsx5biPONhjtPtKRNX2Q8s+zwQPEAZSOVzRbgI+HyLY9X0XaSo9xUE6PWy6xvP RHiGJqYlRU69/6vqzjqqNOrG/vzrqDBHjqhBh+WR5n9/U447pecHas0wXNM95iBHxgAFuyDnt r8i/TIT0wcTBinb1uJFQQeqxWk0P3ro27wrz80nLbyBYu/hF8z44BgghXlZpMjMS5xbpVryBP ZyOxDQsOXNn7ehFoy/IDQPydKTAT9WvoY92r3m74wjHu1wWLPfBMvUB7FTZeKOaxYGRDEt/UN tqbPvJVYasLz+ikEcSQGSx+LOAeNsONprBlQ8FM2YpC3lMpzvnYGGFCCZNJLd0XboBYWj2TaQ R5IMf3ccnUUonPurx+nTkBMaeUWIKm5zosNFhfz9zgVDSDXQaZnARgM9TLQKeZHZns5jpHzkb YCoN1rkhLmuB+H6PbBJ6fI0oN9w5cU0qVksX5vEQX+zvgFM//x13Bkj4AG3mpm3xEb3eSrADe N7nSui414sjtnsI68GiCANvIoPL2x169Vl2LRfWYChYgHOD3eNGa9H+lLGAeAhLOI6xIWblCQ XmWTGqFmFSaKfqUiW+Sbb02jfWuM2ZKyGc8MCTVByYcMIy76PhQxB4+0KG/+pJz93XBcPEYxN 7lzoCWlVMMWoq8/bNpSlfTDF9+bh9umZ2MITaYtawiEfGvzUS5YkJ4CA9g4fkKBg+eFSRTqEy hikM7qoRsEYVI/WpQ0JEQ3sXa3jbz53h0vPAHVXoaZ0MovGz9AxvRCvXckq9G6ofT3fqI84V X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.15.19 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:215371 Archived-At: On Tue, 30 May 2017 20:48:56 -0400 Glenn Morris wrote: > Stephen Berman wrote: > >> Do you have any idea why our results differ? > > I have no idea how todo-default-todo-file can get set to the right value > for you. (Maybe it's because you have files in ~/.emacs.d/todo, and I > don't?) Yes, you're right. That's what I overlooked :(. >> This backtrace means that the variables todo-current-todo-file, >> todo-global-current-todo-file, and todo-default-todo-file all evaluated >> to nil. I don't see how that could happen with the test file, and when >> I start Emacs with -Q, eval the test file, instrument todo-show, run ert >> on the test todo-test-item-highlighting, and step through todo-show and >> todo-check-file, I see that todo-default-todo-file gets assigned >> todo-test-1.todo from the todo-resources directory as its value. > > todo-default-todo-file is a variable defined in 'todo-mode.el' > Its value is nil > Original value was "todo-test-1" > > It is nil because the test file requires todo-mode before it sets > todo-directory. It mismatches its default because the default changes > when todo-directory does. (This seems to me like a not great way for a > defcustom to behave.) Yes, this is bad, though outside of a test environment, it seems unlikely that todo-directory will be changed, doesn't it? Or do you see a general way (i.e. not just for testing) around this problem? > So another solution that works for me is to not require todo-mode till > after you set todo-directory. As the FIXME comment in the test file > indicates, this setting of global variables isn't a good way to behave. Yes, that's an ugly workaround and putting it before the require seems even uglier. > BTW, the test will hang with a "Do you want to convert.." prompt if an > old todo file exists in ~/.emacs.d. Maybe make a macro that sets HOME to > a temporary directory with a copy of the input files, and use it in each > test. Thanks, that's a good idea. [...] >> could you tell me why you used that >> specific change to avoid the error? > > I looked at it very briefly, and thought: "nothing is telling > todo-test-item-highlighting which source file to use; > todo-test-get-archive is the only place in the file that seems to set a > source file; I'll stick that in; now it works.". It works, but it's rather rather opaque, since that test has nothing to do with todo archives. In lieu of a solution t theo todo-directory problem, which would make the first todo-show in the test work, I've replaced todo-test-get-archive with a function that displays a category in either todo-mode or todo-archive-mode. This, plus setting HOME, eliminates the prompts and the tests pass make check. Unless I can quickly come up with a better fix, I'll commit this as a reasonable stop-gap. Thanks for giving first-aid to the tests, and for your feedback. Steve Berman