GNU bug report logs - #17482
args-out-of-range when visiting foo.todo

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Tue, 13 May 2014 06:23:02 UTC

Severity: important

Found in version 24.3.91

Done: Stephen Berman <stephen.berman <at> gmx.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17482 in the body.
You can then email your comments to 17482 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Tue, 13 May 2014 06:23:02 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: args-out-of-range when visiting foo.todo
Date: Tue, 13 May 2014 02:22:35 -0400
Package: emacs
Version: 24.3.91
Severity: important

emacs -Q
C-x C-f /tmp/foo.todo
  -> args-out-of-range error

(.todo is a pretty generic extension for me. I don't want it to open a
specialized Emacs mode. I don't feel strongly about it though.
Perhaps the NEWS file should say that .todo files now open in todo-mode.
They didn't before.)

Debugger entered--Lisp error: (args-out-of-range 1 2)
  narrow-to-region(2 1)
  (let ((name (todo-current-category)) cat-begin cat-end done-start done-sep-start done-end) (widen) (goto-char (point-min)) (re-search-forward (concat "^" (regexp-quote (concat todo-category-beg name)) "$") nil t) (setq cat-begin (1+ (line-end-position))) (setq cat-end (if (re-search-forward (concat "^" (regexp-quote todo-category-beg)) nil t) (match-beginning 0) (point-max))) (setq mode-line-buffer-identification (funcall todo-mode-line-function name)) (narrow-to-region cat-begin cat-end) (todo-prefix-overlays) (goto-char (point-min)) (if (re-search-forward (concat "\n\\(" (regexp-quote todo-category-done) "\\)") nil t) (progn (setq done-start (match-beginning 0)) (setq done-sep-start (match-beginning 1)) (setq done-end (match-end 0))) (error "Category %s is missing todo-category-done string" name)) (if todo-show-done-only (narrow-to-region (1+ done-end) (point-max)) (if (and todo-show-with-done (re-search-forward todo-done-string-start nil t)) (progn (setq done-start cat-end) (let* ((done-sep todo-done-separator) (ov (progn ... ...))) (if ov nil (setq ov (make-overlay done-sep-start done-end)) (overlay-put ov (quote todo) (quote separator)) (overlay-put ov (quote display) done-sep))))) (narrow-to-region (point-min) done-start) (if todo-highlight-item (progn (require (quote hl-line)) (hl-line-mode 1)))))
  todo-category-select()
  (and (member this-command todo-visit-files-commands) (= (- (point-max) (point-min)) (buffer-size)) (member major-mode (quote (todo-mode todo-archive-mode))) (todo-category-select))
  todo-display-as-todo-file()
  run-hooks(find-file-hook)
  after-find-file(t t)
  find-file-noselect-1(#<buffer foo.todo> "/tmp/foo.todo" nil nil "/tmp/foo.todo" nil)
  find-file-noselect("/tmp/foo.todo" nil nil t)
  find-file("/tmp/foo.todo" t)
  call-interactively(find-file nil nil)
  command-execute(find-file)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Tue, 13 May 2014 15:58:02 GMT) Full text and rfc822 format available.

Message #6 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Tue, 13 May 2014 17:57:04 +0200
On Tue, 13 May 2014 02:22:35 -0400 Glenn Morris <rgm <at> gnu.org> wrote:

> Package: emacs
> Version: 24.3.91
> Severity: important
>
> emacs -Q
> C-x C-f /tmp/foo.todo
>   -> args-out-of-range error
>
> (.todo is a pretty generic extension for me. I don't want it to open a
> specialized Emacs mode. I don't feel strongly about it though.
> Perhaps the NEWS file should say that .todo files now open in todo-mode.
> They didn't before.)

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.

Steve Berman

=== modified file 'lisp/calendar/todo-mode.el'
*** lisp/calendar/todo-mode.el	2014-05-09 07:50:42 +0000
--- lisp/calendar/todo-mode.el	2014-05-13 15:37:39 +0000
***************
*** 6401,6411 ****
  
  (defun todo-display-as-todo-file ()
    "Show todo files correctly when visited from outside of Todo mode.
! Added to `find-file-hook' in Todo mode and Todo Archive mode."
!   (and (member this-command todo-visit-files-commands)
!        (= (- (point-max) (point-min)) (buffer-size))
!        (member major-mode '(todo-mode todo-archive-mode))
!        (todo-category-select)))
  
  (defun todo-add-to-buffer-list ()
    "Add name of just visited todo file to `todo-file-buffers'.
--- 6401,6425 ----
  
  (defun todo-display-as-todo-file ()
    "Show todo files correctly when visited from outside of Todo mode.
! Added to `find-file-hook' in Todo mode, Todo Archive mode and
! Todo Filtered Items mode.
! 
! This is intended only for visiting an existing todo, archive, or
! filtered items file, and signals an error if you try to create a
! new one using, e.g., `find-file'."
!   (if (equal (file-truename todo-directory)
! 	     (file-name-directory (file-truename (buffer-file-name))))
!       (when (member this-command todo-visit-files-commands)
! 	(if (> (buffer-size) 0)
! 	    (and (= (- (point-max) (point-min)) (buffer-size))
! 		 (memq major-mode '(todo-mode todo-archive-mode))
! 		 (todo-category-select))
! 	  (kill-buffer)
! 	  (user-error "To add a new todo file, type %s in Todo mode"
! 		      (substitute-command-keys "\\[todo-add-file]"))))
!     (kill-all-local-variables)
!     (setq buffer-read-only nil)
!     (set-buffer-major-mode (current-buffer))))
  
  (defun todo-add-to-buffer-list ()
    "Add name of just visited todo file to `todo-file-buffers'.
***************
*** 6454,6459 ****
--- 6468,6474 ----
    "Make some settings that apply to multiple Todo modes."
    (add-to-invisibility-spec 'todo)
    (setq buffer-read-only t)
+   (add-hook 'find-file-hook 'todo-display-as-todo-file nil t)
    (when (and (boundp 'desktop-save-mode) desktop-save-mode)
      (setq-local desktop-save-buffer 'todo-desktop-save-buffer))
    (when (boundp 'hl-line-range-function)
***************
*** 6466,6473 ****
  (defun todo-modes-set-3 ()
    "Make some settings that apply to multiple Todo modes."
    (setq-local todo-categories (todo-set-categories))
!   (setq-local todo-category-number 1)
!   (add-hook 'find-file-hook 'todo-display-as-todo-file nil t))
  
  (put 'todo-mode 'mode-class 'special)
  
--- 6481,6487 ----
  (defun todo-modes-set-3 ()
    "Make some settings that apply to multiple Todo modes."
    (setq-local todo-categories (todo-set-categories))
!   (setq-local todo-category-number 1))
  
  (put 'todo-mode 'mode-class 'special)
  
***************
*** 6555,6566 ****
    (todo-modes-set-1)
    (todo-modes-set-2))
  
  ;;;###autoload
! (add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-mode))
  ;;;###autoload
! (add-to-list 'auto-mode-alist '("\\.toda\\'" . todo-archive-mode))
  ;;;###autoload
! (add-to-list 'auto-mode-alist '("\\.tod[tyr]\\'" . todo-filtered-items-mode))
  
  ;; -----------------------------------------------------------------------------
  (provide 'todo-mode)
--- 6569,6607 ----
    (todo-modes-set-1)
    (todo-modes-set-2))
  
+ ;; All Todo mode files reside in `todo-directory', but maybe the user
+ ;; wants to be able to have files with these extensions in other modes
+ ;; elsewhere (bug#17482).  So we conditionalize automatic major mode
+ ;; selection on the file's location.
+ 
+ ;;;###autoload
+ (defun todo-maybe-todo-mode ()
+   (if (equal (file-truename todo-directory)
+ 	     (file-name-directory (file-truename (buffer-file-name))))
+       (todo-mode)
+     (set-buffer-major-mode (current-buffer))))
+ 
+ ;;;###autoload
+ (defun todo-maybe-todo-archive-mode ()
+   (if (equal (file-truename todo-directory)
+ 	     (file-name-directory (file-truename (buffer-file-name))))
+       (todo-archive-mode)
+     (set-buffer-major-mode (current-buffer))))
+ 
+ ;;;###autoload
+ (defun todo-maybe-todo-filtered-items-mode ()
+   (if (equal (file-truename todo-directory)
+ 	     (file-name-directory (file-truename (buffer-file-name))))
+       (todo-filtered-items-mode)
+     (set-buffer-major-mode (current-buffer))))
+ 
  ;;;###autoload
! (add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-maybe-todo-mode))
  ;;;###autoload
! (add-to-list 'auto-mode-alist '("\\.toda\\'" . todo-maybe-todo-archive-mode))
  ;;;###autoload
! (add-to-list 'auto-mode-alist
! 	     '("\\.tod[tyr]\\'" . todo-maybe-todo-filtered-items-mode))
  
  ;; -----------------------------------------------------------------------------
  (provide 'todo-mode)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Tue, 13 May 2014 16:03:02 GMT) Full text and rfc822 format available.

Message #9 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Tue, 13 May 2014 12:02:51 -0400
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! :)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Tue, 13 May 2014 16:27:01 GMT) Full text and rfc822 format available.

Message #12 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Tue, 13 May 2014 18:26:03 +0200
On Tue, 13 May 2014 12:02:51 -0400 Glenn Morris <rgm <at> gnu.org> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Tue, 13 May 2014 19:41:02 GMT) Full text and rfc822 format available.

Message #15 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: Glenn Morris <rgm <at> gnu.org>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Tue, 13 May 2014 15:40:46 -0400
> -(add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-mode))
> +(add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-maybe-todo-mode))

I don't think it's really an improvement.

The better solution is to change todo-mode so that it doesn't burp when
used in a file that doesn't follow the expected conventions of
todo-mode.  Make it fail more gracefully.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Tue, 13 May 2014 22:35:02 GMT) Full text and rfc822 format available.

Message #18 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Glenn Morris <rgm <at> gnu.org>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 00:33:51 +0200
On Tue, 13 May 2014 15:40:46 -0400 Stefan Monnier <monnier <at> IRO.UMontreal.CA> wrote:

>> -(add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-mode))
>> +(add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-maybe-todo-mode))
>
> I don't think it's really an improvement.
>
> The better solution is to change todo-mode so that it doesn't burp when
> used in a file that doesn't follow the expected conventions of
> todo-mode.  Make it fail more gracefully.

Are you saying todo-mode.el should keep using auto-mode-alist in the
standard way?  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?

(ii) Trying to visit a file foo.todo that was created outside of Emacs.
There are several subcases to consider here:

(a) The file resides in `todo-directory', was created before loading
todo-mode and happens to be a valid Todo file: then I think there is no
problem.

(b) The file happens to be a valid Todo file but was either created
after loading todo-mode or resides outside of `todo-directory': then
using todo-mode commands confined to that file or accessing other todo
files in `todo-directory' should work all right, but that file cannot be
accessed or referenced from other todo files, which will likely result
in disrupting workflow at least, and possibly raising errors.

(c) The file format is not valid: this could (depending on the nature of
the ill-formedness) raise the todo-mode error "Invalid or missing
todo-categories sexp" and any further attempt to use Todo mode commands
may be no-ops or raise args-out-of-range or other errors.  Certain kinds
of ill-formedness can be repaired (there already is the command
todo-repair-categories-sexp), but since such a file could contain
anything, I don't see a way to add a reliable general repair mechanism,
so the only recourse is to repair the file by hand or delete it.

I don't see any way to make todo-mode always fail gracefully in cases
(iib) and (iic), but at least my patch avoids the need for such failure
when the file is outside of `todo-directory'.  (I don't have a good
suggestion for when the file resides in `todo-directory' and is invalid
or valid but created after loading todo-mode, other than to say "Don't
do that", which I think is not unreasonable advice.)

Moreover, with hindsight I think Glenn's desire to visit a file foo.todo
without putting it in Todo mode is quite reasonable, and I don't see how
to allow this if todo-mode uses auto-mode-alist in the standard way; do
you?

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Wed, 14 May 2014 03:24:02 GMT) Full text and rfc822 format available.

Message #21 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: Glenn Morris <rgm <at> gnu.org>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Tue, 13 May 2014 23:22:56 -0400
> 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.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Wed, 14 May 2014 15:11:01 GMT) Full text and rfc822 format available.

Message #24 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Glenn Morris <rgm <at> gnu.org>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 17:10:12 +0200
On Tue, 13 May 2014 23:22:56 -0400 Stefan Monnier <monnier <at> IRO.UMontreal.CA> 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
shows.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Wed, 14 May 2014 16:56:02 GMT) Full text and rfc822 format available.

Message #27 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: Glenn Morris <rgm <at> gnu.org>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 12:55:22 -0400
> 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.

Maybe a quick way to "reach" the design goal is to wrap the body of
todo-mode in a `with-demoted-errors'.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Wed, 14 May 2014 17:47:01 GMT) Full text and rfc822 format available.

Message #30 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Stephen Berman <stephen.berman <at> gmx.net>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 13:46:33 -0400
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Wed, 14 May 2014 19:58:02 GMT) Full text and rfc822 format available.

Message #33 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 21:57:04 +0200
On Wed, 14 May 2014 13:46:33 -0400 Glenn Morris <rgm <at> gnu.org> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Wed, 14 May 2014 20:02:01 GMT) Full text and rfc822 format available.

Message #36 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 16:01:43 -0400
Stephen Berman wrote:

> [...] 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

You could use a file-local variable mode: cookie for that
(I speak without having looked at the code at all).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Wed, 14 May 2014 20:36:01 GMT) Full text and rfc822 format available.

Message #39 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 22:34:36 +0200
On Wed, 14 May 2014 16:01:43 -0400 Glenn Morris <rgm <at> gnu.org> wrote:

> Stephen Berman wrote:
>
>> [...] 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
>
> You could use a file-local variable mode: cookie for that
> (I speak without having looked at the code at all).

Yes, that's in fact what the original todo-mode.el does, but I never
really liked it and dropped from my version it long ago, though it is a
convenient way to get that effect.  But it also counteracts Stefan's
"design goal" of being able to use standard Emacs commands on Todo
files.  Although I didn't follow this goal while reimplementing
todo-mode.el, I now think it's justified: Todo mode has its own entry
points and editing commands and there's no real need to give it a
stranglehold on Todo files.  It's conceptually similar to Gnus: you can
visit and edit a mail file as a normal text file, but in Gnus it's in a
special mode with special commands.  And the risk assessment is the
same: you can corrupt a mail file outside of Gnus if you're not careful.

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Wed, 14 May 2014 21:45:02 GMT) Full text and rfc822 format available.

Message #42 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: Glenn Morris <rgm <at> gnu.org>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 17:44:36 -0400
> convenient way to get that effect.  But it also counteracts Stefan's
> "design goal" of being able to use standard Emacs commands on Todo
> files.

No, that's OK: for files which we know positively to be Todo files, we
can use special processing.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Wed, 14 May 2014 22:00:03 GMT) Full text and rfc822 format available.

Message #45 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Glenn Morris <rgm <at> gnu.org>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 23:58:37 +0200
On Wed, 14 May 2014 17:44:36 -0400 Stefan Monnier <monnier <at> IRO.UMontreal.CA> wrote:

>> convenient way to get that effect.  But it also counteracts Stefan's
>> "design goal" of being able to use standard Emacs commands on Todo
>> files.
>
> No, that's OK: for files which we know positively to be Todo files, we
> can use special processing.

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.

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Thu, 15 May 2014 02:25:02 GMT) Full text and rfc822 format available.

Message #48 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: Glenn Morris <rgm <at> gnu.org>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Wed, 14 May 2014 22:24:41 -0400
> 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.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Fri, 23 May 2014 17:01:02 GMT) Full text and rfc822 format available.

Message #51 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Fri, 23 May 2014 18:59:46 +0200
On Wed, 14 May 2014 21:57:04 +0200 Stephen Berman <stephen.berman <at> gmx.net> wrote:

> On Wed, 14 May 2014 13:46:33 -0400 Glenn Morris <rgm <at> gnu.org> 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 <monnier <at> IRO.UMontreal.CA> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17482; Package emacs. (Fri, 23 May 2014 17:33:02 GMT) Full text and rfc822 format available.

Message #54 received at 17482 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 17482 <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Fri, 23 May 2014 13:32:48 -0400
Well, I visited foo.todo and no longer saw an error, so works for me,
thanks.




Reply sent to Stephen Berman <stephen.berman <at> gmx.net>:
You have taken responsibility. (Fri, 23 May 2014 19:14:02 GMT) Full text and rfc822 format available.

Notification sent to Glenn Morris <rgm <at> gnu.org>:
bug acknowledged by developer. (Fri, 23 May 2014 19:14:03 GMT) Full text and rfc822 format available.

Message #59 received at 17482-done <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Stefan Monnier <monnier <at> IRO.UMontreal.CA>, 17482-done <at> debbugs.gnu.org
Subject: Re: bug#17482: args-out-of-range when visiting foo.todo
Date: Fri, 23 May 2014 21:12:58 +0200
On Fri, 23 May 2014 13:32:48 -0400 Glenn Morris <rgm <at> gnu.org> wrote:

> Well, I visited foo.todo and no longer saw an error, so works for me,
> thanks.

Thanks for confirming; closing.

Steve Berman




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 21 Jun 2014 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 305 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.