GNU bug report logs -
#70937
30.0.50; todo-mode item insertion bug
Previous Next
To reply to this bug, email your comments to 70937 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#70937
; Package
emacs
.
(Tue, 14 May 2024 13:19:02 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
bug-gnu-emacs <at> gnu.org
.
(Tue, 14 May 2024 13:19:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
0. emacs -Q (If you don't use todo-mode and don't want to change
~/.emacs.d by carrying out the following recipe, you can start Emacs
with e.g. `HOME=/tmp/user emacs -Q'.)
1. Type `M-x todo-show'. If you have not already created a todo file in
todo-mode, respond to the successive prompts to enter a todo file
name, a category, and an item, e.g. "todo RET test RET test RET".
If you do already have a todo file, by typing `M-x todo-show' you are
now visiting it in todo-mode.
2. Now in the current todo category type `i' to initiate an item
insertion command. This displays the following prompt in the echo
area:
Press a key (so far ‘i’): { i=>default p=>copy } { y=>diary k=>nonmarking } { c=>calendar d=>date n=>dayname } t=>time { h=>here r=>region }
You build an item insertion command by successively typing a key from
one or more of the groups in the prompt (details are in the Todo
manual). You can skip a group but you cannot enter a key out of the
given order. So e.g. `i y c t h' and `i k r' are valid item
insertion commands, but `i c y' and `i t k' are invalid.
3. If you do enter `i c y' you get the error message "y is undefined"
and the item insertion command construction is broken off. That's
fine, because `y' has been entered out of order for item insertion
and is otherwise not a key for a todo-mode command.
4. Now comes the bug: If you enter `i t k', after pressing `k' the item
at point is highlighted and the echo area displays the prompt
"Permanently delete this item? (y or no)". This is because `k' is
also bound in todo-mode to the command for deleting an item; it can
only be part of a item insertion command when it is entered before
any item insertion key from a later group (thus, `i k t k' is also
invalid and has the same effect as `i t k'). Likewise, typing `i t
p', `i t n' or `i t d' breaks off the item insertion command and
executes a non-insertion todo-mode command. And if you mistakenly
type a key that is not an item insertion key but is bound in
todo-mode, e.g. `m' in the sequence `i m', then the todo-mode command
it is bound to is executed. Such unintended command execution is at
least confusing, and in the worst case can result in data loss
(e.g. with `k' if the user is inattentive).
The attached patch prevents the unintended execution of a todo-mode
command due to mistaken or out-of-order item insertion key input. In
that case a message is displayed, e.g. "‘k’ is not a valid remaining
item insertion key" (the word "remaining" is meant to indicate that the
key is not valid at this point in the sequence), and the construction of
the item insertion command breaks off.
Instead of breaking off the key input, a more user-friendly fix might be
to continue prompting to enter the item insertion keys as long as an
invalid key is entered, but I haven't found a way to do that within the
current implemention, which uses set-transient-map, and changing the
implemention seems non-trivial and trying to do that just to slightly
increase the user-friendliness is probably more effort than it's worth.
But if someone sees a straightforward way to do that, I'm all ears.
Otherwise, if there are no objections within a few days I will install
the attached patch to master (the bug has existed since the use of
set-transient-map (then still called set-temporary-overlay-map) was
added to todo-mode.el in commit f3a66082).
[Message part 2 (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.41, cairo version 1.18.0) of 2024-05-08 built on strobelfs
Repository revision: e020f4e9ce5d98438033fea098d943c311b0fa3d
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: Linux From Scratch r12.1-53
Configured using:
'configure -C 'CFLAGS=-Og -g3' PKG_CONFIG_PATH=/opt/qt5/lib/pkgconfig'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
Reply sent
to
Stephen Berman <stephen.berman <at> gmx.net>
:
You have taken responsibility.
(Tue, 21 May 2024 09:11:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Stephen Berman <stephen.berman <at> gmx.net>
:
bug acknowledged by developer.
(Tue, 21 May 2024 09:11:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 70937-done <at> debbugs.gnu.org (full text, mbox):
On Tue, 14 May 2024 15:18:03 +0200 Stephen Berman <stephen.berman <at> gmx.net> wrote:
[...]
> The attached patch prevents the unintended execution of a todo-mode
> command due to mistaken or out-of-order item insertion key input. In
> that case a message is displayed, e.g. "‘k’ is not a valid remaining
> item insertion key" (the word "remaining" is meant to indicate that the
> key is not valid at this point in the sequence), and the construction of
> the item insertion command breaks off.
[...]
> [I]f there are no objections within a few days I will install
> the attached patch to master [...]
I've seen no objections, so I installed the patch as commit 7f80070232a
and am closing this bug.
Steve Berman
This bug report was last modified 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.