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/global-variables.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 devdocs/elisp/global-variables.html (limited to 'devdocs/elisp/global-variables.html') diff --git a/devdocs/elisp/global-variables.html b/devdocs/elisp/global-variables.html new file mode 100644 index 00000000..69a03e86 --- /dev/null +++ b/devdocs/elisp/global-variables.html @@ -0,0 +1,19 @@ +

Global Variables

The simplest way to use a variable is globally. This means that the variable has just one value at a time, and this value is in effect (at least for the moment) throughout the Lisp system. The value remains in effect until you specify a new one. When a new value replaces the old one, no trace of the old value remains in the variable.

You specify a value for a symbol with setq. For example,

(setq x '(a b))
+
+

gives the variable x the value (a b). Note that setq is a special form (see Special Forms); it does not evaluate its first argument, the name of the variable, but it does evaluate the second argument, the new value.

Once the variable has a value, you can refer to it by using the symbol itself as an expression. Thus,

x ⇒ (a b)
+
+

assuming the setq form shown above has already been executed.

If you do set the same variable again, the new value replaces the old one:

x
+     ⇒ (a b)
+
+
(setq x 4)
+     ⇒ 4
+
+
x
+     ⇒ 4
+
+
+

+ 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/Global-Variables.html +

+
-- cgit v1.2.3