all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Testing whether a mode is enabled
@ 2022-10-16 15:24 Heime via Users list for the GNU Emacs text editor
  2022-10-16 23:15 ` Michael Heerdegen
  0 siblings, 1 reply; 3+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2022-10-16 15:24 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Am using icomplete-mode but find things somewhat confusing.

To enable or disable the mode one uses (icomplete-mode 1) and (icomplete-mode -1)

I want to test whether the mode is enabled or disabled with "(if icomplete-mode" and
(if (not icomplete-mode)".

(not OBJECT) returns t if OBJECT is nil, and returns nil otherwise.

When I use conditional with "icomplete-mode" is it correct to say that if "icomplete-mode" is nil,
then the mode is disabled?

I am uncertain because of the numeric values used to enable and disable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Testing whether a mode is enabled
  2022-10-16 15:24 Testing whether a mode is enabled Heime via Users list for the GNU Emacs text editor
@ 2022-10-16 23:15 ` Michael Heerdegen
  2022-10-16 23:26   ` Heime
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2022-10-16 23:15 UTC (permalink / raw)
  To: help-gnu-emacs

Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:

> I am uncertain because of the numeric values used to enable and disable.

The variable has a docstring.  This is the crucial source for you.
Nearly all mode variables are interpreted as Bools in Emacs.

The argument of the mode functions is different because it is often also
the prefix arg, which is a number (not even only just that, actually).
But it can also be called from Elisp.  That's why its semantics are a
bit ugly.

Michael.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Testing whether a mode is enabled
  2022-10-16 23:15 ` Michael Heerdegen
@ 2022-10-16 23:26   ` Heime
  0 siblings, 0 replies; 3+ messages in thread
From: Heime @ 2022-10-16 23:26 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs






Sent with Proton Mail secure email.

------- Original Message -------
On Sunday, October 16th, 2022 at 11:15 PM, Michael Heerdegen <michael_heerdegen@web.de> wrote:


> Heime via Users list for the GNU Emacs text editor
> help-gnu-emacs@gnu.org writes:
> 
> > I am uncertain because of the numeric values used to enable and disable.
> 
> 
> The variable has a docstring. This is the crucial source for you.
> Nearly all mode variables are interpreted as Bools in Emacs.

I see.  Which is either t or nil in the docstring.
 
> The argument of the mode functions is different because it is often also
> the prefix arg, which is a number (not even only just that, actually).
> But it can also be called from Elisp. That's why its semantics are a
> bit ugly.
> 
> Michael.

Not trivial.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-16 23:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-16 15:24 Testing whether a mode is enabled Heime via Users list for the GNU Emacs text editor
2022-10-16 23:15 ` Michael Heerdegen
2022-10-16 23:26   ` Heime

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.