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

From: Stephen Berman <[email-masked]>
Date: Fri, 23 May 2014 18:59:46 +0200

On Wed, 14 May 2014 21:57:04 +0200 Stephen Berman <[email-masked]> wrote:

> On Wed, 14 May 2014 13:46:33 -0400 Glenn Morris <[email-masked]> wrote:
>
>> Stefan Monnier wrote:
>>
>>> Maybe a quick way to "reach" the design goal is to wrap the body of
>>> todo-mode in a `with-demoted-errors'.
>>
>> It's better, but I think it's still not great if I visit blah.todo and
>> get "args-out-of-range" as a message rather than an error.
>
> I agree.  Moreover, if blah.todo is not empty but not a valid Todo file,
> visiting it will raise a different error from a different part of the
> code, so it would be necessary to have multiple uses of
> `with-demoted-errors'.  And there's still the issue of why *.todo files
> not in `todo-directory' should be in Todo mode.  And the only sensible
> answer is: they shouldn't be.  So I am convinced that todo-mode should
> not use auto-mode-alist: it's not needed and it only causes problems.  I
> somehow became blinded by the idea that it's nice to be able to visit a
> todo-mode file with `find-file' or from Dired and have it be in
> todo-mode and display properly, but this was just a mistake and now I've
> seen the light.  So unless there's a really good reason not to, I'll go
> ahead and excise the use of auto-mode-alist; I'll post a patch for
> review before committing.
>
> Steve Berman

On Wed, 14 May 2014 22:24:41 -0400 Stefan Monnier <[email-masked]> wrote:

>> Ok, I understand (that also answers a question I was tempted to ask you
>> about why SES files don't violate your design goals).  But I would
>> consider this to be a new feature (which I still have doubts about),
>> which could be considered for the trunk, but not for emacs-24.  In
>> contrast, the use of auto-mode-alist is a bug-inducing misfeature and
>> should be removed before the release.
>
> Sounds OK.

The required changes to remove the use of auto-mode-alist amount mainly
to calling the appropriate Todo mode function when visting a Todo file,
if it isn't already in that mode, so in view of Stefan's approval of the
plan not to use auto-mode-alist here, I've refrained from posting the
patch and simply committed it.

Glenn, if you want to test and (hopefully) confirm that this bug is
fixed, I'll wait for your response; otherwise, I'll take the liberty of
closing it in a day or two.

Besides fixing this bug, in the process of making and testing the
changes I found a handful of other bugs, which I've already fixed in a
separate changeset (bzr 117142 in emacs-24).

Steve Berman