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
1 answer
36 views

Is it possible to save register values and restore them in another session?

I use registers (such as C-x r s 0) as a multi-valued clipboard that can save different contents (copy-to-register). Then I can "paste" the value using C-x r i 0. This is really convenient, ...
tinlyx's user avatar
  • 1,314
1 vote
1 answer
49 views

Making cleveref insertions globally available

I keep all my commonly used latex packages in one custom package, including the referencing package cleveref. However, reftex is configured to only provide insertion of cleveref referencing commands ...
Alexander Praehauser's user avatar
0 votes
1 answer
30 views

How to watch variables in gdb?

Is there any buffer in emacs' gdb that can print selected variables (e.g. print *display) on each change (step, next, finish etc.)? It would be useful as opposed to typing print variable each time.
Daniel Krajnik's user avatar
6 votes
1 answer
240 views

I'm unsure which option to use for setting a variable: setq, customize-set-variable, or setopt

I'm a bit uncertain about which method to use for setting a variable: setq, customize-set-variable, or setopt. I did some research online, and it seems that opinions on this matter are quite varied. ...
Zoli's user avatar
  • 421
0 votes
2 answers
39 views

cannot use buffer-local variables after defining them

I'm trying to define a buffer-local variable inside a function using setq-local in a function here is the function definition: (defun set-buffer-local-variable () (with-current-buffer (get-buffer-...
ntriisii's user avatar
0 votes
0 answers
75 views

How do I set package-vc-selected-packages to use a specific commit?

Emacs 29.1 introduced new functions to install packages directly from source. Configuring it to download from the latest commit works fine, but I can't find how to download from a specific commit ...
Balto's user avatar
  • 1
1 vote
1 answer
133 views

“assignment to free variable” warning after defvar

The compiler will issue a warning message Warning: assignment to free variable -/var if you evaluate the following forms: ;;; -*- lexical-binding: t; -*- (defvar -/var) (byte-compile (let (_) ...
shynur's user avatar
  • 4,563
1 vote
1 answer
30 views

How can I view the history of what variable I've looked up before with describe-variable?

Whenever I call (describe-variable) , there is no history of what variables I've recently viewed. Is there a way to enable it to have some kind of history?;)
Jason Hunter's user avatar
0 votes
1 answer
61 views

Why is 'eval-after-load' required here?

(eval-after-load "dired" '(progn (define-key dired-mode-map "c" 'dired-create-empty-file) (define-key dired-mode-map "r" 'dired-do-compress-to))) Why is the ...
user129393192's user avatar
0 votes
0 answers
30 views

(wrong-type-argument stringp custom-variable-set) Error when setting variable

I'm having an issue setting custom Emacs variables. When I try to set the variable pressing STATE I run into this error: (wrong-type-argument stringp custom-variable-set) This is the full debugger ...
Enrico Pirani's user avatar
0 votes
1 answer
29 views

How can I let-bind a variable to input read with `completing-read`?

How can I store the selected value in a let variable when using completing-read ? (let ( (selc '("Lower-Skeleton" "Upper-Skeleton")) ) (completing-read "Vista: " selc ...
Dilna's user avatar
  • 1
0 votes
0 answers
37 views

Emacs Mode for Reddit, (void-variable hierarchy--make)

Trying to add md4rd, using this: (use-package md4rd :ensure t :config (add-hook 'md4rd-mode-hook 'md4rd-indent-all-the-lines) (setq md4rd-subs-active '(emacs lisp+Common_Lisp prolog clojure)) ...
Jason Hunter's user avatar
1 vote
1 answer
55 views

Is there a reason for having beginning-of-defun-function/end-of-defun-function global?

I was working on a mode, setq'ed them with my functions and... emacs broke (really) For some reason these variable are global. I made them buffer-local, but is there a good reason for having them ...
Lorenzo Marcantonio's user avatar
1 vote
1 answer
43 views

Some functions/commands appear to be missing

I cannot call emacs-lisp-docstring-fill-column mentioned here or url-link mentioned here. Neither using M-x nor in code. I use Emacs 28.2. Are these commands provided by a package ? As far as I read, ...
Tristan Riehs's user avatar
2 votes
2 answers
163 views

Marking as safe all possible lists of strings

Following this answer, I put the following lines in a .dir-locals.el file: ((latex-mode (TeX-engine . default) (mode . latex ) (TeX-master . "main") (ispell-buffer-session-localwords ...
tigerjack's user avatar
  • 163
0 votes
1 answer
49 views

"Symbol's value as variable is void: file-name" when using let

I want to create an Emacs lisp function which composes a path of a diary file which has the format <some directory>/t<timestamp>.org and determines whether or not such file exists. I ...
Franz Drollig's user avatar
0 votes
0 answers
30 views

Random warning popping up occasionally when using eshell

I occasionally get this warning while running eshell: Warning (comp): tramp-loaddefs.el.gz:745:2478: Warning: reference to free variable ‘tramp-remote-path’ and was wondering how to fix it. According ...
user129393192's user avatar
2 votes
0 answers
133 views

Why does (setopt ...) not give "assignment to free variable" warning, unlike setq and customize-set-variable?

I'm using Emacs 29.0.60 If I open emacs -q, open a Emacs Lisp buffer with FlyMake enabled and type this: ;;; init.el --- summary ;;; Commentary: ;;; Code: (setq var1 2) (customize-set-variable var2 ...
cidra's user avatar
  • 135
0 votes
2 answers
84 views

Any way to access a lexical let variable outside of the let?

I need to retrieve a local, lexical, runtime variable from a function, but I'm unable to modify the function to return it because it is from an external library. The variable I'm unable to reach is ...
sextrism's user avatar
0 votes
2 answers
72 views

How to set a local variable when a certain file is visited

EDIT: Changed "load" to "visit" I want to set a variable when a specific file is visited, for example "package.json". Note I don't want to set a variable when any json ...
Daniel Pérez's user avatar
0 votes
1 answer
41 views

expand org variable value in situ

Is there a way to link to an orgmode variable's value? Or at least export it? I can get a link to jump to the variable definition, but not display its value or export. for example the text in ...
stayfrostypeople's user avatar
1 vote
1 answer
30 views

gnu-calc: How to declare variables in R (Real)?

I'm figuring out complex algebraic calculation in gnu-calc. Suppose: after many long calculation I got following algebraic expression: -8 * a - 2 * b + 2 * b * i - 40 * i - 8 and I want the imaginary ...
Garid's user avatar
  • 589
3 votes
0 answers
114 views

Using a `defconst' or `defvar' While the Variable Has a Local Binding Sets the Global Binding?

The GNU Emacs Lisp Reference Manual, 12.5 Defining Global Variables: If you use a defconst or defvar special form while the variable has a local binding (made with let, or a function argument), it ...
shynur's user avatar
  • 4,563
0 votes
3 answers
47 views

Is the capture template bound to a variable?

I have the following defvar that declares a variable and gives it a string value. Notice, I used the word "gives" but I was wondering if "bind" would be the proper one to use. (...
Zoli's user avatar
  • 421
0 votes
2 answers
113 views

How to set a variable name with a variable?

I want to do this. (let ((myvar "my/variable") (myval "Some Value")) (setq myvar myval)) The manual method is: (setq "my/variable" "Some Value") Here ...
ritchie's user avatar
  • 151
1 vote
1 answer
89 views

What does defvar do in this code?

I know this may sound silly but what does defvar do in the code below? Does it define a variable that hold a capture template? or we say that the template is bound to the variable capture-template-...
Zoli's user avatar
  • 421
0 votes
0 answers
38 views

org-agenda files variable: I'm not sure that the value is set just on init.el

Pressing C-h v I can see the value of this variable. In my init.el I've commented out this variable assignment: ;;(setq org-agenda-files '( "~/org/*.org")), and restarted Emacs. But if I ...
RenatoP's user avatar
  • 121
1 vote
1 answer
38 views

How to stop set-auto-mode from removing local variable binding? [duplicate]

Why does (set-auto-mode) remove the local variable binding and how I can keep the local binding around? (defvar-local test-var nil) (setq test-var t) (message "%s" test-var) ;; t (set-auto-...
breatheoutbreathein's user avatar
2 votes
2 answers
59 views

How do you use a variable in the "replacement" part of query-replace-regexp?

I want to do simple replacements in a LaTeX source using something like that: ;; test-1 (query-replace-regexp (regexp-quote FOO) (concat "Foo " ...
Onner Irotsab's user avatar
0 votes
1 answer
30 views

Why doesn't stringp evaluate the expression in this case?

I'm relatively new to Elisp and I'm trying to figure out a bug in my code, but I have no idea what to search or read in order to get an idea about it. The bug is in this code: (defvar some-variable &...
user5954246's user avatar
1 vote
1 answer
125 views

Can't access a global variable inside a function in elisp?

I am trying to make a simple function that toggles "lsp-ui-doc-show" and "lsp-ui-doc-hide", by calling the same function every time. Thought it was simple enough to use a global ...
Sergiu Elmi's user avatar
1 vote
1 answer
73 views

GNU emacs lisp: string match (how to pass emacs-version correctly)

I'm newbie with Emacs and I'm experimenting with Lisp on GNU Emacs-26.1. Can't understand why the following simple piece of Elisp code does not work: (string-match "^GNU Emacs" emacs-...
Mark's user avatar
  • 165
0 votes
1 answer
174 views

How do I update xref-backend-functions?

I'm not sure what kind of variable xref-backend-functions and how to update it. After I open a .c file, I do M-: and do (add-hook 'xref-backend-functions #'gxref-xref-backend) and it shows me (gxref-...
ackerleytng's user avatar
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.
xeruf's user avatar
  • 334
1 vote
0 answers
92 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' ....
stigma's user avatar
  • 113
0 votes
2 answers
165 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.
Dilna's user avatar
  • 1
1 vote
2 answers
89 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 ...
Pedro Delfino's user avatar
0 votes
4 answers
197 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/...
Pedro Delfino's user avatar
-2 votes
2 answers
51 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 ...
Dilna's user avatar
  • 1
0 votes
1 answer
44 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 ...
Virgil's user avatar
  • 3
1 vote
1 answer
229 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) ...
Dilna's user avatar
  • 1
0 votes
1 answer
40 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-...
Dilna's user avatar
  • 1
0 votes
1 answer
44 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 ?...
crocefisso's user avatar
  • 1,220
0 votes
1 answer
19 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 (...
Dilna's user avatar
  • 1
1 vote
1 answer
91 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 ()...
Dilna's user avatar
  • 1
1 vote
1 answer
36 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 ...
Dan Drake's user avatar
  • 573
0 votes
1 answer
214 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 ...
user38135's user avatar
0 votes
2 answers
208 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 ...
Gabriele Nicolardi's user avatar
0 votes
1 answer
121 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 ...
Tom's user avatar
  • 1,190
1 vote
1 answer
187 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 &...
Tian's user avatar
  • 288

1
2 3 4 5