2022 Developer Survey is open! Take survey.

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.

Filter by
Sorted by
Tagged with
0 votes
2 answers
24 views

Output the VAR name and its VALUE

I defined these variables/functions: (defvar FirstVar-p nil "DOCSTRING") (defun toggle-first-var () "DOCSTRING" (interactive) (setq FirstVar-p (not FirstVar-p))) (defvar ...
user avatar
0 votes
1 answer
47 views

Why is it that during debugging EDebug says local variable is not bound?

For example, I debug a function, I'm stepping in it, I want to check a local variable's value and C-h v says: variable is not bound I can eval the variable, by pressing e and tpying its name, only ...
user avatar
  • 1,058
1 vote
1 answer
54 views

How do I call a function within a lambda?

I would like to define a function that generates lambdas, as such: (defun my-func (FUNCTION) (lambda () (FUNCTION))) But when I evaluate the following (defun my-func1 () (message &...
user avatar
  • 288
0 votes
2 answers
55 views

Font issues using monokai on emacs 27.2 on WINDOWS 10

Hello guys i am experiencing some font issues using the theme monokai on windows 10 and emacs 27.2. Emacs seems to compile everything quite nice even there are not error and warnings. However, when i ...
user avatar
2 votes
1 answer
57 views

How to make defcustoms available before their file has been loaded?

I maintain an Elisp package that is split over many files, and each of the files has its own group of defcustoms in it, as a subgroup of the main package name. I am unsure of how to make these ...
user avatar
  • 308
0 votes
0 answers
43 views

set variable only if its name is already interned

Is there a built-in function/macro of Emacs that sets a variable only if it is already defined? I mean something like that: (cl-defmacro set-if-interned (symbol-name value &optional (use-obarray ...
user avatar
  • 29.8k
0 votes
0 answers
34 views

open file specified via environment variable

Environment variables that points to specific location are of common occurrence. $HOME, $XDG_CACHE_HOME, %LOCALAPPDATA% and many more. It is pretty convenient to open files (and directories) just by ...
user avatar
0 votes
0 answers
32 views

How to set Variables in config.el [duplicate]

I would like to use a color-palette in my theme-file... there it is: (deftheme TEST) (let ((col1 "red" ) (col2 "blue" )) (custom-theme-set-faces 'TEST '(cursor ((t (:...
user avatar
0 votes
0 answers
16 views

Proof general: Symbol’s value as variable is void: coq-prog-args

I'm trying to proof-assert-next-command-interactive, but get the following error in *Messages*: proof-activate-scripting: Symbol’s value as variable is void: coq-prog-args. I haven't found an ...
user avatar
1 vote
1 answer
55 views

What is meant by "variable expansion"?

I'm looking at the ob-core.el source and see docstrings like: Expand variables in PARAMS... The Emacs manual talks about macro expansion, which is when a macro is converted to executable source code ...
user avatar
  • 3,835
0 votes
0 answers
25 views

Setting variables for async org export

I have this function: (defun cpm/org-export--file-beamer-handout () "Export file content to PDF handout. Handout uses a distinctive quote style." (interactive) (let ((org-latex-default-...
user avatar
  • 1,415
1 vote
1 answer
135 views

Backup a variable and store it back

I have problems to get into Lisp. I assume I miss the correct terms to search for. So I try to "speak in Python". #!/usr/bin/env python3 foo = 7 backuped_foo = foo # temporary change the ...
user avatar
  • 499
1 vote
1 answer
59 views

Validating Arguments to a Function

I would like to validate the argument to a function before its action is executed. The main concern is the passing of a void variable. How can I trap this? (defun is-it-bound(item) (if (boundp 'item)...
user avatar
0 votes
1 answer
236 views

How to read the shell environment variables?

I have the following command in my .emacs (setq org-roam-directory (concat (getenv "BASEDIR") "/data/org-roam/")) The purpose is to the set the directory for org-roam (but ...
user avatar
  • 223
3 votes
1 answer
39 views

Use of defvar in straight.el's bootstrapping

The package straight.el requires the following bootstrapping code in your emacs config: (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/...
user avatar
0 votes
0 answers
27 views

I want to make an alias to `org-babel-execute:emacs lisp`. the problem is with the space on `emacs lisp`

I'm using org-beamer exporter, and I would like to do the following: (defalias 'org-babel-execute:emacs-lisp lisp 'org-babel-execute:emacs lisp) My problem is 'org-babel-execute:emacs lisp has a ...
user avatar
  • 257
2 votes
1 answer
21 views

Cannot get a symbol's value for the first time when using `setq-default`

I can use setq-default to set a symbol's default value, as follows: (with-temp-buffer (make-local-variable 'bar) (setq-default bar "xyz") (symbol-value 'bar)) When I first executed ...
user avatar
  • 439
1 vote
1 answer
49 views

Is there a way to check if a symbol is a built-in variable?

This is how you check if an object is a built-in function: (subrp (symbol-function 'assoc)) => t Is there an equivalent way to do this for variables as well?
user avatar
1 vote
0 answers
18 views

Passing string as arg to apply function [duplicate]

I want to call clone-indirect-buffer or clone-indirect-buffer-other-window within a function dependent on the prefix. To do this, I assign the appropriate clone function to a variable using let. ...
user avatar
  • 3,835
3 votes
1 answer
74 views

Function add-variable-watcher does not watch "last-command" variable

I have added a watcher function to watch the last-command variable. (defun my-watch (symbol newval op where) (message "Hello")) (add-variable-watcher 'last-command #'my-watch) The ...
user avatar
1 vote
0 answers
48 views

why doesn't use-package :defines stop this "variable is void" error?

Error (use-package): w3m/:config: Symbol’s value as variable is void: w3m-filter-configuration I have a use-package statement that was producing an error because apparently emacs-w3m doesn't configure ...
user avatar
7 votes
1 answer
204 views

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 () ...
user avatar
  • 4,211
1 vote
1 answer
34 views

How to use a delayed evaluation function where a string is expected?

I have a variable that expects a string, and I want to set it to a function that will return a string whenever the variable is used. Right now, I have (setq bibtex-autokey-prefix-string (format-time-...
user avatar
  • 97
3 votes
1 answer
100 views

Can font faces be dynamically assigned with font-lock-add-keywords?

In all the examples of font-lock-add-keywords I've seen, the font face is static. That is, there is a regex or a matcher function and a literal font face identifier. Is it possible to set the face ...
user avatar
  • 7,069
1 vote
1 answer
47 views

Storing some text from a buffer into a variable

What is the "standard" way to store some text obtained from a buffer into a variable? The only way I could think of was to use something along the lines of (let ((beg (point))) (end-of-line) ...
user avatar
  • 231
1 vote
1 answer
48 views

Activate a minor mode switching off the other ones in a set of minor modes

I'm developing a set of minor modes that I use in my LaTeX copy-editing work. I have, e.g.. a list of three minor modes stored in a variable: (defvar latex-editing-mode '(preamble-editing-mode ...
user avatar
1 vote
2 answers
105 views

How do I pass a variable definition as a parameter to a command in the minibuffer?

I am an emacs novice. I am familiarizing myself with making basic changes to the init.el file. Currently, when I want to load init.el, I first C-h v user-init-file RET, this opens a *Help* screen ...
user avatar
0 votes
0 answers
55 views

How to store a buffer in a variable so that the value of the variable isn't influenced by the fate of the buffer?

Say I'm in a buffer named init.el and I run (setq mybuffer (current-buffer)) If I evaluate mybuffer I get #<buffer init.el>. Now I kill this buffer and evaluate mybuffer again. Emacs returns #&...
user avatar
  • 1,392
1 vote
2 answers
86 views

How can I show a tabular list of variables and their values?

Is there a way to see the values of a list of variables? E.g., if I have var1, var2 and var3, is there a standard elisp function that shows me the values of these variables at the same time? I mean ...
user avatar
0 votes
1 answer
177 views

Dynamic name for org-capture template file [duplicate]

I am new to org-mode (and to Emacs in general) and am trying to set up org-capture. I would like to define a todo capture item whose template is located in the file ~/.emacs.d/org-templates/todo.tmpl....
user avatar
  • 103
0 votes
0 answers
26 views

savehist-mode: Lisp error: (void-variable pell-buffer)

I am using GNU Emacs 26.3 in macOS. For (savehist-mode 1) I keep getting following error: Debugger entered--Lisp error: (void-variable pell-buffer) signal(void-variable (pell-buffer)) savehist-...
user avatar
  • 1,102
0 votes
1 answer
44 views

How to use header-args variables to fill cell values of a table

I have an org-mode file as such: * Header level 1 :header-args: :var filename="somefile.csv" ** Header level 2 :header-args: :var foo="bar" #+begin_src emacs-lisp foo #+end_src #+...
user avatar
1 vote
1 answer
83 views

Is there a tagged union/sum type in elisp? If not, what to use instead?

In many programming languages, if one wants a variable that can take a discrete number of values, one has the capacity to define the permissible values in advance, using something like an enum. Does ...
user avatar
2 votes
1 answer
54 views

storing string in variable fails to work in `early-init.el`

Putting the following code in my early-init.el causes my emacs not to startup. (require 'cl-lib) (defvar void-initial-frame-font (cl-find-if (lambda (font) (find-font (font-spec :name font))) ...
user avatar
  • 1,283
0 votes
0 answers
82 views

How do you avoid pollution of Emacs namespace with "private" variables?

Probably it is misunderstanding of Elisp execution model by I think some variables are only pollute runtime. For example let's consider read-string argument HISTORY. Probably user don't need to know ...
user avatar
  • 3,132
2 votes
0 answers
71 views

How to find out the name of a variable Customize is customizing

I'd like to have a function that when run from within a Customize buffer will return the name of the variable that would be customized at point.
user avatar
  • 1,548
0 votes
0 answers
20 views

Why won't emacs permanently save my buffer-local var?

For many files I have file-local variables which asked me once if they were safe and I could add them permanently to my "trusted" list, never to be asked again. However, I get asked every ...
user avatar
1 vote
1 answer
93 views

How to add more default face highlight colors

Using (highlight-symbol-at-point) at some point the highlight start repeating colors. I find the variable that holds the default face highlight color values in Emacs is: hi-lock-face-defaults It ...
user avatar
1 vote
1 answer
74 views

Modify value of a variable by applying a function to it?

Suppose one of the customizable variables in a package is var, and its default value is a list, list. I understand I can change the value of var to mylist using (setq var mylist) in my init.el. ...
user avatar
  • 299
0 votes
1 answer
75 views

Can't save safe variables for further

When I start Emacs it asks me if I want to allow "unsafe" variables which I agree and press '!' to save them for the future. Despite that, it still keeps asking me about it on every launch. ...
user avatar
  • 592
0 votes
2 answers
408 views

Change $PATH once emacs is running

In my shell (Bash), I can switch among several LaTeX distros setting the $PATH variable. E.g.: export PATH=/usr/local/texlive/2016/bin/x86_64-linux:$PATH or export PATH=/usr/local/texlive/2018/bin/...
user avatar
0 votes
0 answers
32 views

It is safe to delete set free variables?

For example I have followins line of code (usually I get these code from answers). (projectile-global-mode) ; smerge-mode (setq smerge-command-prefix "\C-cv") (setq undo-tree-show-...
user avatar
  • 1,102
6 votes
1 answer
5k views

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 ...
user avatar
1 vote
2 answers
397 views

Is there a way to spread a list like in Typescript or Golang?

I have a variable with some common values between dap-mode debug templates and I want to use that variable along with other cons elements for :environment-variable in languages like Golang or ...
user avatar
  • 2,564
1 vote
3 answers
257 views

The global value of a variable I set with setq in my config differs from the local value. How can I get my value to be what I want in every buffer?

I want web-mode-script-padding to be set to 0 at all times. In my config, I have tried both (with-eval-after-load 'web-mode (setq web-mode-script-padding 0) ) As well as simply, (setq web-mode-...
user avatar
  • 147
1 vote
1 answer
104 views

How to change a variable value in the current buffer?

I spent a long time looking for this and kept getting reference to M-x customize. But, that didn't give me access to certain variables like comment-start. I couldn't access comment-start with M-x ...
user avatar
0 votes
1 answer
145 views

Add element to org-refile-targets

I am keeping a common init.el for work and private on separate machines. So dependent on my machine I have common settings and machine dependent settings. How do I get to add an element to the org-...
user avatar
0 votes
0 answers
55 views

Multiple cursors has undefined variables

I installed multiple cursors mode. My init.el has the following at the bottom: (require 'bytecomp) (require 'multiple-cursors) (multiple-cursors-mode 1) (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-...
user avatar
1 vote
1 answer
98 views

Wrong type argument: symbolp, 10

I would like create function that ask me how length I want the Pomodoro but it say wrong type argument. (defun changePomoLength () (interactive) (set-variable org-pomodoro-length (read-string "...
user avatar
2 votes
1 answer
29 views

Giving faces compliant names

The description of defface in (info "(elisp) Defining Faces") says that the name of a face should not end in -face. But most faces declared in font-lock.el do use the suffix -face. How does this fit ...
user avatar