Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [defvar]

The tag has no usage guidance.

1
vote
0answers
34 views

Storing and Loading Non-Static/Multiple Configs

I'm writing an emacs wrapper to a set of scripts that require a lot of config settings to run. These can be variously environment variables, command line parameters and so forth. They should be user ...
10
votes
3answers
142 views

Why does defvar scoping work differently without an initvalue?

Suppose I have a file named elisp-defvar-test.el containing: ;;; elisp-defvar-test.el --- -*- lexical-binding: t -*- (defvar my-dynamic-var) (defun f1 (x) "Should return X." (let ((my-dynamic-...
1
vote
1answer
73 views

How to use defvar with the symbol name in another variable?

I am trying to create a global variable which name is contained in another variable, using defvar: (let ((var-name "my-test-var")) ;;(defvar (intern var-name) "some value") (defvar (make-symbol ...
0
votes
1answer
42 views

Converting an expression to a string

I would like to add an alternative answer to the thread How do I force re-evaluation of a defvar? Before doing so, however, I would like to learn how to eliminate the single-quote to prevent ...
4
votes
1answer
65 views

Test whether variable is defined, but not initialized

Q: How can I test (programmatically) whether a variable has been defined, but not initialized? (defvar foo) EXAMPLE: (if (my-test foo) (message "%s has been defined, but not initialized." foo) ...
10
votes
1answer
3k views

What's the difference between setq and defvar

What is the difference between setq and defvar in Emacs lisp? I see common lisp version of the same question at https://stackoverflow.com/questions/3855862. Are they same in Elisp?
0
votes
2answers
99 views

Warning assigning variables

I'm rebuilding my emacs configuration, and trying to compile without warnings. I'm using also cask. I have this case: (require 'magit) ;; Enable a right limit of 70 chars for git logs (add-hook '...
10
votes
4answers
236 views

Can I reload a library and have defvar re-assign values?

I am developing a library and would like to reload it after editing without exiting Emacs (assume that it is on load-path): (load-library "myname") When I do this, Emacs doesn't pick up changes to ...
14
votes
1answer
2k views

What does `setq-local` do, and when should I use it?

I'm not quite clear on all the variations of buffer-local variables, even after reading all the doc and a bunch of postings here on SX. Here's a summary of my understandings: (defvar foo ..) ...
2
votes
1answer
349 views

change value of a defvar after loading package

I load a package that defines a list of radio stations with defvar (defvar default-list '((station1) (station2))) I want to redefine this list after loading the package (I am using require) because ...
0
votes
1answer
30 views

Unexpected behavior when defining variable [duplicate]

I am trying to get the string value of a variable defined in a Python file and assign it to an elisp variable. The value is held in the variable org_file in a file config.py in the same directory as ...