* define-minor-mode question
@ 2022-04-20 4:15 Tim Cross
2022-04-20 6:32 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Tim Cross @ 2022-04-20 4:15 UTC (permalink / raw)
To: Emacs developers
I'm working on a minor mode which I'm defining using the
define-minor-mode macro. All seems to be working fine except for one
small issue.
The basic mode definition is
(define-minor-mode corgi-stateline-mode
"Toggle corgi-stateline-mode."
:init-value nil
:global t
(if (default-value 'corgi-stateline-mode)
(corgi-stateline/turn-on)
(corgi-stateline/turn-off)))
When I do M-x corgi-stateline-mode, I see two messages in the echo area.
The first tells me the mode is being enabled/disabled. The second says
You can run the command 'corgi-stateline-mode' with M-x corg-m RET
This is the problematic message. First, I don't want that message, but
more importantly, it is wrong. You cannot run the command with M-x
corg-m.
Where is this message coming from and how do I disable it?
GNU Emacs 28.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30,
cairo version 1.16.0) of 2022-04-15
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: define-minor-mode question
2022-04-20 4:15 define-minor-mode question Tim Cross
@ 2022-04-20 6:32 ` Eli Zaretskii
2022-04-20 8:20 ` Tim Cross
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2022-04-20 6:32 UTC (permalink / raw)
To: Tim Cross; +Cc: emacs-devel
> From: Tim Cross <theophilusx@gmail.com>
> Date: Wed, 20 Apr 2022 14:15:39 +1000
>
>
> (define-minor-mode corgi-stateline-mode
> "Toggle corgi-stateline-mode."
> :init-value nil
> :global t
> (if (default-value 'corgi-stateline-mode)
> (corgi-stateline/turn-on)
> (corgi-stateline/turn-off)))
>
>
> When I do M-x corgi-stateline-mode, I see two messages in the echo area.
> The first tells me the mode is being enabled/disabled. The second says
>
> You can run the command 'corgi-stateline-mode' with M-x corg-m RET
>
> This is the problematic message. First, I don't want that message, but
> more importantly, it is wrong. You cannot run the command with M-x
> corg-m.
Why not? What happens if you try?
> Where is this message coming from and how do I disable it?
There's the user option extended-command-suggest-shorter, which you
can customize to nil to suppress these suggestions. It is a general
feature of M-x.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: define-minor-mode question
2022-04-20 6:32 ` Eli Zaretskii
@ 2022-04-20 8:20 ` Tim Cross
2022-04-20 9:04 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Tim Cross @ 2022-04-20 8:20 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Tim Cross <theophilusx@gmail.com>
>> Date: Wed, 20 Apr 2022 14:15:39 +1000
>>
>>
>> (define-minor-mode corgi-stateline-mode
>> "Toggle corgi-stateline-mode."
>> :init-value nil
>> :global t
>> (if (default-value 'corgi-stateline-mode)
>> (corgi-stateline/turn-on)
>> (corgi-stateline/turn-off)))
>>
>>
>> When I do M-x corgi-stateline-mode, I see two messages in the echo area.
>> The first tells me the mode is being enabled/disabled. The second says
>>
>> You can run the command 'corgi-stateline-mode' with M-x corg-m RET
>>
>> This is the problematic message. First, I don't want that message, but
>> more importantly, it is wrong. You cannot run the command with M-x
>> corg-m.
>
> Why not? What happens if you try?
>
When I tired it, it didn't work. The command was not found. I also tried
C-h f, which also failed.
After your reply, I dug a little deeper and now suspect this is an issue
with ivy. I don't normally use ivy, but the project I'm contributing to
does, so I was using their default setup. If I define the mode in a
clean (emacs -q) environment, the shorthand version works. I'm guesssing
that whatever Emacs uses to generate the shorthand name isn't being
picked up by ivy. I don't know if this is an ivy limitation or an ivy
configuration error at this point.
I initially thought the failure was due to something I had missed in
defining the minor mode.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: define-minor-mode question
2022-04-20 8:20 ` Tim Cross
@ 2022-04-20 9:04 ` Eli Zaretskii
2022-04-21 0:26 ` Tim Cross
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2022-04-20 9:04 UTC (permalink / raw)
To: Tim Cross; +Cc: emacs-devel
> From: Tim Cross <theophilusx@gmail.com>
> Cc: emacs-devel@gnu.org
> Date: Wed, 20 Apr 2022 18:20:57 +1000
>
> >> You can run the command 'corgi-stateline-mode' with M-x corg-m RET
> >>
> >> This is the problematic message. First, I don't want that message, but
> >> more importantly, it is wrong. You cannot run the command with M-x
> >> corg-m.
> >
> > Why not? What happens if you try?
> >
>
> When I tired it, it didn't work. The command was not found. I also tried
> C-h f, which also failed.
>
> After your reply, I dug a little deeper and now suspect this is an issue
> with ivy. I don't normally use ivy, but the project I'm contributing to
> does, so I was using their default setup. If I define the mode in a
> clean (emacs -q) environment, the shorthand version works. I'm guesssing
> that whatever Emacs uses to generate the shorthand name isn't being
> picked up by ivy. I don't know if this is an ivy limitation or an ivy
> configuration error at this point.
Sounds like a subtle misfeature in ivy? At the very least, ivy should
disable extended-command-suggest-shorter, to avoid misleading users.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: define-minor-mode question
2022-04-20 9:04 ` Eli Zaretskii
@ 2022-04-21 0:26 ` Tim Cross
0 siblings, 0 replies; 5+ messages in thread
From: Tim Cross @ 2022-04-21 0:26 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Tim Cross <theophilusx@gmail.com>
>> Cc: emacs-devel@gnu.org
>> Date: Wed, 20 Apr 2022 18:20:57 +1000
>>
>> >> You can run the command 'corgi-stateline-mode' with M-x corg-m RET
>> >>
>> >> This is the problematic message. First, I don't want that message, but
>> >> more importantly, it is wrong. You cannot run the command with M-x
>> >> corg-m.
>> >
>> > Why not? What happens if you try?
>> >
>>
>> When I tired it, it didn't work. The command was not found. I also tried
>> C-h f, which also failed.
>>
>> After your reply, I dug a little deeper and now suspect this is an issue
>> with ivy. I don't normally use ivy, but the project I'm contributing to
>> does, so I was using their default setup. If I define the mode in a
>> clean (emacs -q) environment, the shorthand version works. I'm guesssing
>> that whatever Emacs uses to generate the shorthand name isn't being
>> picked up by ivy. I don't know if this is an ivy limitation or an ivy
>> configuration error at this point.
>
> Sounds like a subtle misfeature in ivy? At the very least, ivy should
> disable extended-command-suggest-shorter, to avoid misleading users.
It looks like ivy was not configured correctly. I've gone through the
setup and made some changes and now, starting the mode from ivy does not
generate that message and it looks like ivy does disable
extended-command-suggest-shorter provided you configure it correctly.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-21 0:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-20 4:15 define-minor-mode question Tim Cross
2022-04-20 6:32 ` Eli Zaretskii
2022-04-20 8:20 ` Tim Cross
2022-04-20 9:04 ` Eli Zaretskii
2022-04-21 0:26 ` Tim Cross
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.