GNU bug report logs - #2084
23.0.60; todo-insert-item-here bug + patch

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Tue, 27 Jan 2009 15:15:03 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

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 2084 in the body.
You can then email your comments to 2084 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2084; Package emacs. (Tue, 27 Jan 2009 15:15:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stephen Berman <stephen.berman <at> gmx.net>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 27 Jan 2009 15:15:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; todo-insert-item-here bug + patch
Date: Tue, 27 Jan 2009 16:08:45 +0100
[Message part 1 (text/plain, inline)]
The following bug, reported in
http://lists.gnu.org/archive/html/bug-gnu-emacs/2001-11/msg00234.html, still
exists in the CVS trunk:

From: Daniel Ortmann <dortmann <at> lsil.com>
Subject: todo-mode: pressing "I" when at the end of the line inserts the todo information at the END of the current line
To: bug-gnu-emacs <at> gnu.org
Date: 06 Nov 2001 12:36:08 -0600

> Pressing "I" when at the end of the line inserts the todo information at
> the END of the current line.  It should add the new information to the
> FRONT of the current line.

In http://lists.gnu.org/archive/html/bug-gnu-emacs/2001-11/msg00429.html
I pointed out that `I' (todo-insert-item-here) in fact inserts a new
Todo entry anywhere and that, while this behavior is strictly consistent
with the doc string, it is generally undesirable, and provided a patch
to restrict the entry point.  The patch was not committed to CVS, which
is just as well, since it was deficient.  Nevertheless, the existing
definition remains buggy -- it could result in making the new entry
inaccessible to Todo mode commands.  For example, let a Todo mode
category contain the following:

*/* 2009-01-27 15:30 steve: This is item1.

Place point between "is" and "item1", type `I' and at the prompt `This
is item2.'; now the category looks like this:

*/* 2009-01-27 15:30 steve: This is*/* 2009-01-27 15:30 steve: This is item2.
 item1.

The new entry is not recognized as such by Todo mode commands.  The
attached patch fixes this by consistently inserting the new entry
directly above the current entry (unless point is on an empty line, then
it inserts the new entry there).

2009-01-20  Stephen Berman  <stephen.berman <at> gmx.net>

	* calendar/todo-mode.el (todo-insert-item-here): Prevent insertion
	of a new entry inside of an existing entry.  Minor code cleanup.

[todo-insert-item-here.diff (text/x-patch, inline)]
*** emacs/lisp/calendar/todo-mode.el.~1.72.~	2009-01-09 11:48:58.000000000 +0100
--- emacs/lisp/calendar/todo-mode.el	2009-01-20 21:30:15.000000000 +0100
***************
*** 610,625 ****
  (defalias 'todo-cmd-inst 'todo-insert-item)
  
  (defun todo-insert-item-here ()
!   "Insert new TODO list entry under the cursor."
!   (interactive "")
!   (save-excursion
!     (if (not (derived-mode-p 'todo-mode)) (todo-show))
!     (let* ((new-item (concat todo-prefix " "
! 			     (read-from-minibuffer
! 			      "New TODO entry: "
! 			      (if todo-entry-prefix-function
! 				  (funcall todo-entry-prefix-function))))))
!       (insert (concat new-item "\n")))))
  
  (defun todo-more-important-p (line)
    "Ask whether entry is more important than the one at LINE."
--- 610,629 ----
  (defalias 'todo-cmd-inst 'todo-insert-item)
  
  (defun todo-insert-item-here ()
!   "Insert a new TODO list entry directly above the entry at point.
! If point is on an empty line, insert the entry there."
!   (interactive)
!   (if (not (derived-mode-p 'todo-mode)) (todo-show))
!   (let ((new-item (concat todo-prefix " "
! 			  (read-from-minibuffer
! 			   "New TODO entry: "
! 			   (if todo-entry-prefix-function
! 			       (funcall todo-entry-prefix-function))))))
!     (unless (and (bolp) (eolp)) (goto-char (todo-item-start)))
!     (insert (concat new-item "\n"))
!     (backward-char)
!     ;; put point at start of new entry
!     (goto-char (todo-item-start))))
  
  (defun todo-more-important-p (line)
    "Ask whether entry is more important than the one at LINE."

Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Wed, 28 Jan 2009 04:05:05 GMT) Full text and rfc822 format available.

Notification sent to Stephen Berman <stephen.berman <at> gmx.net>:
bug acknowledged by developer. (Wed, 28 Jan 2009 04:05:06 GMT) Full text and rfc822 format available.

Message #10 received at 2084-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 2084-done <at> debbugs.gnu.org
Subject: Re: 23.0.60; todo-insert-item-here bug + patch
Date: Tue, 27 Jan 2009 22:58:20 -0500
> The new entry is not recognized as such by Todo mode commands.  The
> attached patch fixes this by consistently inserting the new entry
> directly above the current entry (unless point is on an empty line,
> then it inserts the new entry there).

Applied, thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Wed, 25 Feb 2009 15:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 175 days ago.

Previous Next


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