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
1 vote
0 answers
52 views

Can I somehow hook a variable? [duplicate]

So a function is called when the variable value is changed? add-hook seems to only accept functions.
  • 266
1 vote
0 answers
27 views

.bashrc environment variables not picked up by Spacemacs?

I've added a few environment variables to my .bashrc file, some of these are paths to customized bin/programs, such as: export MY_ENV_PATH_VAR=/home/user/path/to/bin I've refreshed spacemacs' ....
  • 113
0 votes
2 answers
42 views

Determining whether a mode was enabled

Is it possible to determine whether global-display-fill-column-indicator-mode or display-fill-column-indicator-mode was enabled? I am running Emacs 27.2.
  • 15
0 votes
0 answers
9 views

How to make the build and jack-in of a Clojure project faster and less manual while using CIDER (Emacs package for Clojure)?

Every time I am working on a Clojure project using Cider in Emacs I do the following: 1 - I execute cider-jack-in-cljs 2 - Then, the mini-buffer asks: Which command should be used (default lein): I ...
1 vote
2 answers
68 views

Why changing the value of this variable via add-to-list is not working?

Usually, I do the following to change a variable's value: 1 - I execute the command set-variable 2 - I pick cider-shadow-cljs-command 3 - I tweak the value changing it to be "shadow-cljs" It ...
0 votes
3 answers
30 views

How to make changes on variables' values be persistent over sessions?

The current question is related to a previous question which is still not fully solved. I have been doing the following: 1 - After executing describe-variable over exec-path, I get: ("/opt/...
-2 votes
2 answers
42 views

Passing variable to function and changing its value

The following function is intended to ensure that a variable defined in a defvar is constrained within a numeric range. I do not want to hardwire the modification of conshine-verbiage, so one can pass ...
  • 61
0 votes
1 answer
26 views

Redirect change made to a variable to another variable

I have variables foo and bar. I have a function that modifies foo and I can't change that function. How can I redirect the change made to foo so it applies to bar instead? EDIT : I want this ...
  • 3
1 vote
1 answer
33 views

How can I use `add-to-list` to add multiple elements to a list value of a variable?

Is this the way to use add-to-list with multiple entries? (add-to-list 'auto-mode-alist '(("\\.f\\'" . fortran-mode) ("\\.F\\'" . fortran-mode) ...
  • 383
0 votes
1 answer
16 views

Passing var or const to a function

I have a function called put-docstr that takes a string. I can set the string using defvar or defconst. Not sure if I should quote the symbol when using it. Thus like this (put-docstr #'typex-...
  • 383
0 votes
1 answer
38 views

How to include variables within #+INCLUDE:?

In my init file, all the paths that I use are stored at the beginning of the file with a series of lines like this: (setq personal-path "PATH") Then I can use them like this: (set-register ?...
0 votes
1 answer
14 views

Setting of face using funcall

I am using funcall to set a typeface by calling a function select-typeface. I would like to remove select-typeface, calling (face (funcall level-typeface depth match). Cannot simply do (let ( (face (...
  • 383
1 vote
1 answer
25 views

Warning: assignment to free variable ‘skeleton-pair’

Am using the following function, but getting the error In bracemk-balance: fencones.el:109:9:Warning: assignment to free variable ‘skeleton-pair’ What is wrong with this? (defun bracemk-balance ()...
  • 383
1 vote
1 answer
21 views

how to re-enable a variable after a package overwrites it? (in particular, mark-even-if-inactive and Hyperbole)

I have mark-even-if-inactive set to t in my init.el; I've found that I that so (interative "r") works as expected; if that variable is nil, I get "The mark is not active now" when ...
  • 349
0 votes
1 answer
50 views

How to enable a minor mode immediately after a buffer is open?

I have been using a pdf-tools fork with a image-roll.el support, this fork and file make it possible to scroll continuously from the end of a page to the beginning of the other without jumping from ...
0 votes
2 answers
26 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 ...
0 votes
1 answer
56 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 ...
  • 1,068
1 vote
1 answer
75 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 &...
  • 288
0 votes
2 answers
78 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 ...
2 votes
1 answer
76 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 ...
  • 358
0 votes
0 answers
44 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 ...
  • 30.7k
0 votes
0 answers
61 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 ...
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 (:...
0 votes
0 answers
22 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 ...
1 vote
1 answer
68 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 ...
  • 3,995
0 votes
0 answers
69 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-...
  • 1,445
1 vote
1 answer
165 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 ...
  • 589
1 vote
1 answer
91 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)...
0 votes
1 answer
322 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 ...
  • 223
3 votes
1 answer
41 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/...
0 votes
0 answers
30 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 ...
  • 257
2 votes
1 answer
22 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 ...
  • 439
1 vote
1 answer
63 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?
1 vote
0 answers
19 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. ...
  • 3,995
5 votes
1 answer
99 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 ...
1 vote
0 answers
63 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 ...
7 votes
1 answer
211 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 () ...
  • 4,286
1 vote
1 answer
35 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-...
  • 97
3 votes
1 answer
117 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 ...
  • 7,421
1 vote
1 answer
62 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) ...
  • 231
1 vote
1 answer
52 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 ...
1 vote
2 answers
119 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 ...
0 votes
0 answers
57 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 #&...
  • 1,414
1 vote
2 answers
99 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 ...
0 votes
1 answer
231 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....
  • 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-...
  • 1,072
0 votes
1 answer
48 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 #+...
1 vote
1 answer
108 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 ...
2 votes
1 answer
68 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))) ...
  • 1,293
0 votes
0 answers
98 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 ...
  • 3,180