all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Glenn Morris <rgm@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: master 941a2e7: todo-mode: don't assume an ordering of tests
Date: Wed, 31 May 2017 16:18:52 +0200	[thread overview]
Message-ID: <87d1ap2joz.fsf@rosalinde> (raw)
In-Reply-To: <s41sr5etqf.fsf@fencepost.gnu.org> (Glenn Morris's message of "Tue, 30 May 2017 20:48:56 -0400")

On Tue, 30 May 2017 20:48:56 -0400 Glenn Morris <rgm@gnu.org> 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



      reply	other threads:[~2017-05-31 14:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170530005055.14646.47570@vcs0.savannah.gnu.org>
     [not found] ` <20170530005057.4720C20ACA@vcs0.savannah.gnu.org>
2017-05-30  8:58   ` master 941a2e7: todo-mode: don't assume an ordering of tests Stephen Berman
2017-05-30 15:35     ` Glenn Morris
2017-05-30 19:52       ` Stephen Berman
2017-05-31  0:48         ` Glenn Morris
2017-05-31 14:18           ` Stephen Berman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d1ap2joz.fsf@rosalinde \
    --to=stephen.berman@gmx.net \
    --cc=emacs-devel@gnu.org \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.