When using describe-variable
, often the value for a variable is listed as:
Its value is t
What does that mean and why specifically t
?
When using describe-variable
, often the value for a variable is listed as:
Its value is t
What does that mean and why specifically t
?
To quote the Emacs Lisp Manual,
t is the preferred way to represent the truth value true. When you need to choose a value that represents true, and there is no other basis for choosing, use t. The symbol t always has the value t.
t
stands for "True".
This is important because it is used for decision making. It is used in decisions such as "If this condition is true, do this. Otherwise, do that." The statement Its value is t
means that the variable you're describing holds the value t
. The consequence of the variable being t
depends on the variable.
For example,
(setq inhibit-startup-message t)
When the value of inhibit-startup-message
is t
, Emacs doesn't show the startup screen. To enable the startup screen, you would use a nil
value. nil
is the opposite of t
and means "False".
Generally speaking, the concepts of t
and nil
are part of what's called Boolean Algebra, a method of logic named after mathematician George Boole.
Boolean Algebra is a topic important to computer programming, and many, many other fields of study. It's also quite fun and interesting. Unfortunately, it's too broad to explain in detail here.
nil
is considered true for the purposes of boolean tests. Hence you will see the term "non-nil" used a great deal in elisp documentation, as nil
is false, and every non-nil
value is true. t
is a value which is true, and which has no other meaning.
– phils
Feb 15 at 4:36