[Top][All Lists]

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

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

From: Stephen Berman
Subject: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 17:10:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.90 (gnu/linux)

On Tue, 13 May 2014 23:22:56 -0400 Stefan Monnier <address@hidden> wrote:

>> Are you saying todo-mode.el should keep using auto-mode-alist in the
>> standard way?
> Yes.
>> If so, then there are basically two cases to handle:
>> (i) Trying to create a file foo.todo within Emacs but outside of Todo
>> mode, e.g. with `M-x find-file foo.todo'.  It's no problem to make this
>> raise an error and tell the user to add a new file in Todo mode, as part
>> of my patch did; is that failing gracefully enough?
> Why do you need to signal an error?
> For me the driving design should be that code that doesn't use todo-mode
> commands should be able to find-file any file with a ".todo" extension,
> make changes to it via things like delete-region and insert and then
> save the file.  And all this without errors.
> As soon as the user actually uses a todo-mode command, you can signal
> any error you like, of course.

Unfortunately, I didn't pay heed to your design goals while implementing
todo-mode (I wasn't aware of them).  But there's a fairly easy way to
accommodate them, and as a side effect avoid the bug Glenn reported and
also accommodate his wish to do `M-x find-file foo.todo' without putting
the file in Todo mode: by simply foregoing use of auto-mode-alist.
Really, it was misguided of me to want to use it, because by design and
intent all Todo files reside in `todo-directory', so on the one hand
auto-mode-alist isn't necessary, and on the other hand any file foo.todo
located elsewhere but put in Todo mode can be problematic.

If I make this change, it will also require abandoning one of the
documented features of Todo mode: that visiting a todo file in any way
(or rather, any way listed by `todo-visit-files-commands') will
automatically display it correctly in Todo mode, i.e., read-only and
narrowed to the selected category, with internal formatting hidden.  But
that feature conflicts with your design goals, and anyway it's only a
minor convenience at best, and at worst leads to bugs, as Glenn's report

If you agree with my proposal, I'll start implementing it.  I don't
anticipate any major hurdles, but since a lot of the current code relies
on the effects of using auto-mode-alist, it may take some time for me to
test the changes and make sure everything still works as it should.  But
I think any attempt to retain use of auto-mode-alist and also comply
with your design goals will be much more difficult to work out.

Steve Berman

reply via email to

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