From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/constant-variables.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 devdocs/elisp/constant-variables.html (limited to 'devdocs/elisp/constant-variables.html') diff --git a/devdocs/elisp/constant-variables.html b/devdocs/elisp/constant-variables.html new file mode 100644 index 00000000..fd0538ba --- /dev/null +++ b/devdocs/elisp/constant-variables.html @@ -0,0 +1,14 @@ +

Variables that Never Change

In Emacs Lisp, certain symbols normally evaluate to themselves. These include nil and t, as well as any symbol whose name starts with ‘:’ (these are called keywords). These symbols cannot be rebound, nor can their values be changed. Any attempt to set or bind nil or t signals a setting-constant error. The same is true for a keyword (a symbol whose name starts with ‘:’), if it is interned in the standard obarray, except that setting such a symbol to itself is not an error.

nil ≡ 'nil
+     ⇒ nil
+
+
(setq nil 500)
+error→ Attempt to set constant symbol: nil
+
+
Function: keywordp object +

function returns t if object is a symbol whose name starts with ‘:’, interned in the standard obarray, and returns nil otherwise.

+

These constants are fundamentally different from the constants defined using the defconst special form (see Defining Variables). A defconst form serves to inform human readers that you do not intend to change the value of a variable, but Emacs does not raise an error if you actually change it.

A small number of additional symbols are made read-only for various practical reasons. These include enable-multibyte-characters, most-positive-fixnum, most-negative-fixnum, and a few others. Any attempt to set or bind these also signals a setting-constant error.

+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Constant-Variables.html +

+
-- cgit v1.2.3