Subject: bug#17482: args-out-of-range when visiting foo.todo

From: Stephen Berman <[email-masked]>
Date: Tue, 13 May 2014 18:26:03 +0200

On Tue, 13 May 2014 12:02:51 -0400 Glenn Morris <[email-masked]> wrote:

> Stephen Berman wrote:
>
>> Perhaps it was presumptuous of me to appropriate the .todo extension for
>> Todo mode.  I'm not aware of any policy about this, and I do see that a
>> number of modes add an extension to auto-mode-alist unconditionally,
>> while others merely suggest doing that in the user's init file.
>> However, I've come up with the following fix, which keeps automatic
>> recognition of Todo mode files located in `todo-directory', which is
>> where all Todo mode files are stored, but allows you to create and visit
>> foo.todo in the default major mode anywhere else.  If this works for you
>> and it's not an unacceptable abuse of auto-mode-alist, I'll commit it to
>> emacs-24.  Thanks for the report.
>
> Thanks. I'm not sure you need to go to that trouble.
> As I said, I don't feel strongly about it.
> It's something I'd be happy to just change in my .emacs.
> Maybe wait and see if anyone else has a strong opinion, otherwise
> leave as-is.
>
> The args-out-of-range thing was what I actually wanted to report! :)

Well, that error arose precisely because you tried to visit a file in
Todo mode (because of auto-mode-alist) that was not in todo-directory,
which lead to certain variables not getting set that should have been,
resulting in the error.  This was a situation I did not foresee (that
someone would want to have a *.todo file but not use Todo mode --
cheeky!).  I actually think this is the least invasive fix that would
avoid this problem.  If I untie the extensions from auto-mode-alist, I
think it will require quite a bit more alteration of todo-mode.el.  So,
if there are no serious objections, I'd just as soon apply this patch.

Steve Berman