summaryrefslogtreecommitdiff
path: root/devdocs/elisp/repeated-loading.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
committerCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
commit82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch)
tree158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/elisp/repeated-loading.html
parent9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff)
downloaddotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz
dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/elisp/repeated-loading.html')
-rw-r--r--devdocs/elisp/repeated-loading.html16
1 files changed, 0 insertions, 16 deletions
diff --git a/devdocs/elisp/repeated-loading.html b/devdocs/elisp/repeated-loading.html
deleted file mode 100644
index 058db545..00000000
--- a/devdocs/elisp/repeated-loading.html
+++ /dev/null
@@ -1,16 +0,0 @@
- <h3 class="section">Repeated Loading</h3> <p>You can load a given file more than once in an Emacs session. For example, after you have rewritten and reinstalled a function definition by editing it in a buffer, you may wish to return to the original version; you can do this by reloading the file it came from. </p> <p>When you load or reload files, bear in mind that the <code>load</code> and <code>load-library</code> functions automatically load a byte-compiled file rather than a non-compiled file of similar name. If you rewrite a file that you intend to save and reinstall, you need to byte-compile the new version; otherwise Emacs will load the older, byte-compiled file instead of your newer, non-compiled file! If that happens, the message displayed when loading the file includes, ‘<samp>(compiled; note, source is newer)</samp>’, to remind you to recompile it. </p> <p>When writing the forms in a Lisp library file, keep in mind that the file might be loaded more than once. For example, think about whether each variable should be reinitialized when you reload the library; <code>defvar</code> does not change the value if the variable is already initialized. (See <a href="defining-variables">Defining Variables</a>.) </p> <p>The simplest way to add an element to an alist is like this: </p> <div class="example"> <pre class="example">(push '(leif-mode " Leif") minor-mode-alist)
-</pre>
-</div> <p>But this would add multiple elements if the library is reloaded. To avoid the problem, use <code>add-to-list</code> (see <a href="list-variables">List Variables</a>): </p> <div class="example"> <pre class="example">(add-to-list 'minor-mode-alist '(leif-mode " Leif"))
-</pre>
-</div> <p>Occasionally you will want to test explicitly whether a library has already been loaded. If the library uses <code>provide</code> to provide a named feature, you can use <code>featurep</code> earlier in the file to test whether the <code>provide</code> call has been executed before (see <a href="named-features">Named Features</a>). Alternatively, you could use something like this: </p> <div class="example"> <pre class="example">(defvar foo-was-loaded nil)
-
-(unless foo-was-loaded
- <var>execute-first-time-only</var>
- (setq foo-was-loaded t))
-</pre>
-</div><div class="_attribution">
- <p class="_attribution-p">
- Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
- <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Repeated-Loading.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Repeated-Loading.html</a>
- </p>
-</div>