help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to define a (derived) minor mode inaccessible to the user


From: Michael Heerdegen
Subject: Re: How to define a (derived) minor mode inaccessible to the user
Date: Sat, 23 Jan 2021 14:08:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

> Hello everyone,
>
> I'd like to define a special-purpose major mode, derived from
> `special-mode', in such a way that the user cannot set it using M-x.
> (It is to be called via another command.)

I wonder if that feature then does have to be defined as a regular mode
at all, or if something else would fit: if there could be some other
solution to what you want.

Second point: If it's really bad for the user to enable the mode, give
it a name like "*-helper-mode" or so, and I guess you could add
something like

(when (called-interactively-p 'any)
  (user-error "This mode is for internal use only"))

to the mode function's body.

Michael.



reply via email to

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