Questions tagged [variables]

for variables in Emacs Lisp, which are symbols with values. The symbol’s name is also called the variable name. Most variable names, by convention, consist of lowercase, ordinary words separated by hyphens.

Useful links:

204 questions
41
votes
2 answers

How to evaluate the variables before adding them to a list?

The below obviously doesn't work and hence this question. How do I correct the below code so that the value of somelist becomes '(("abc" . 123)) ? (setq x "abc") (setq y 123) (setq somelist nil) (add-to-list 'somelist '(x . y))
Kaushal Modi
  • 25,203
  • 3
  • 74
  • 179
31
votes
3 answers

Reset custom variable to default value programmatically

Q: Using Elisp, how can I reset a variable to its default value without knowing what that value is? I tried to figure out how to do this by bringing up the Customize interface for a variable I set to a non-default value in my init-file and pressing…
itsjeyd
  • 14,586
  • 3
  • 58
  • 87
30
votes
2 answers

what does "let*" ( let asterisk) mean in elisp

I've used let before, but never used let* what does let* ( let asterisk) mean in elisp? fyi this one was hard to google because of the asterisk.
american-ninja-warrior
  • 3,773
  • 2
  • 21
  • 40
14
votes
3 answers

Assigning same value to multiple variables?

Sometimes I need to set same value to multiple variables. In Python, I could do f_loc1 = f_loc2 = "/foo/bar" But in elisp, I am writing (setq f_loc1 "/foo/bar" f_loc2 "/foo/bar") I am wondering if there a way to achieve this using "/foo/bar" only…
Chillar Anand
  • 4,042
  • 1
  • 23
  • 52
12
votes
2 answers

Elisp: How to exclude sensitive information from an init file? (ie login credentials)

I want to define a log in function in my init script, but I don't want to hardcode my login credentials. I think a good workaround is to have my init script read in my login credentials from a local file and save these values as variables. That way,…
modulitos
  • 2,432
  • 1
  • 18
  • 36
11
votes
2 answers

Search through the values of all variables in Emacs

I'd like to find which variables contain a certain value. Is there a way to do a regex search through the values of every variable in Emacs?
izkon
  • 1,798
  • 10
  • 23
11
votes
1 answer

Color declared variables

I'm looking for a simple way to make emacs remember of declared variable in a single function in C/C++. By "simple", I mean without any external package, just with some elisp lines in configuration files. My default Emacs configuration colors…
Aracthor
  • 173
  • 7
10
votes
2 answers

How to include other .org files programmatically (ie not from main .org file)?

Including other .org files is quite easy. For example, for configuration, #+setupfile: /path/to/config.org or #INCLUDE: /path/to/config.org Those lines need to be in the .org file in order to be processed. How could one have a given #+setupfile…
gsl
  • 1,742
  • 17
  • 34
10
votes
4 answers

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 defvar-bound variables. I don't want to call…
gavenkoa
  • 3,352
  • 19
  • 36
9
votes
1 answer

Symbol’s function definition is void

I am trying to make an interactive toggle in emacs 27.0.90 When I eval-region no warnings or errors are shown. However, when I do (helm/toggle-frame) in ielm it throws Symbol’s function definition is void: helm-in-frame-p Here is the code, (let…
546756ryd
  • 93
  • 1
  • 1
  • 3
9
votes
0 answers

Display all local variables within a edebug session

When using edebug one can get a local variable by command describe-variable (C-h v), but are there any ways to display all local variables? For example in Python you can call locals() in a pdb session, which returns all the local vars in dictionary.…
atevm
  • 928
  • 7
  • 16
9
votes
3 answers

Quick way to toggle a variable

It would be nice to have a quick way to toggle a variable. Here's something that I have in mind. Call a "toggle var" function. The completing-read should list only variables that have single values (not lists or alists). I don't know if that can be…
Kaushal Modi
  • 25,203
  • 3
  • 74
  • 179
8
votes
3 answers

interactively edit emacs variable in buffer

I was looking at this on StackOverflow and was wondering if there was a nice way built-in to edit strings of text stored in variables as if they were buffers? M-x set-variable doesn't really cut it when you have a long string of LaTeX options inside…
wdkrnls
  • 3,657
  • 2
  • 27
  • 46
8
votes
1 answer

Autoloads and variables

I understand what autoload does for functions (register file to load when such function is called or its documentation string is retrieved). However, it's not clear how to use autoload facility in conjunction with variables and macros. I have two…
Mark Karpov
  • 4,893
  • 1
  • 24
  • 53
7
votes
1 answer

What type of variable binding is setq creating?

What type of variable binding or variable or symbol is setq creating, when the variable hasn't been declared prior setq? Given following source code: ;; -*- lexical-binding: t; -*- (defun setq-x () (setq x 10)) (defvar y 20) (setq-x) (message…
jue
  • 4,476
  • 8
  • 20
1
2 3
13 14