emacs-devel
[Top][All Lists]
Advanced

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

Undesired interactive call of major mode command


From: Stephen Berman
Subject: Undesired interactive call of major mode command
Date: Sat, 22 Nov 2014 15:23:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Bug#19112 reports an error resulting from typing `M-x todo-mode RET'.
The real issue (at least for me, as the maintainer of Todo mode) is not
the error but that todo-mode, although it is the "major mode command",
is not intended to be invoked interactively.  I'm not sure how best to
deal with this.  Three alternatives have occurred to me.  (i) Tell
users: "Don't do that."  (ii) Add to todo-mode the condition
(called-interactively-p 'any) and if it returns t either show a message
saying how to enter todo mode or simply call the intended (and
documented) Todo mode entry command (todo-show).  But this has the
problem that, as soon as todo-mode is invoked, the current buffer
changes to Todo mode; this is because todo-mode is defined with
define-derived-mode.  (iii) The only way I can see to avoid this is not
to use define-derived-mode.  Then I could also make todo-mode
noninteractive.  Of course, this goes against the convention that major
modes have a major mode command.  But there are precedents,
e.g. dired-mode.

Is there a best-practice recommendation for this situation, or is there
another alternative I've overlooked?  I'd be grateful for any advice.

Steve Berman




reply via email to

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