Skip to main content

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
31 views

Can cape be disabled on a mode basis?

I love using cape in text mode, but I cannot figure out how to stop it from activating in programming modes. Is it possible to either only enable it in certain modes or to disable it in specific modes?...
1 vote
1 answer
38 views

Better Static Analysis

What options are there for enhancing static analysis of emacs lisp code? Either via builtin flags or third party packages? I'm mainly referring to unused packages/modules and requires. I'm aware of ...
0 votes
0 answers
21 views

How can I load a specific language server for a particular file extension?

I'm using emacs29 on linux. At present, if I load a file with the extension '.tsx', and then do 'M-x lsp-mode' I get an error: 'Symbol’s value as variable is void: lsp-ada-project-file' I assume that ...
1 vote
1 answer
114 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?
3 votes
1 answer
107 views

Using make-symbol, boundp and symbol-value to reference a variable whose name is made from a string

When I run the following three lines with eval-region (defcustom custom-var "some-custom-value" "for testing only") (setq indirectRef (make-symbol "custom-var")) (message ...
3 votes
1 answer
37 views

After refactoring elisp code, is there some help in finding unused code, mostly functions and variables?

Dealing with a one-file elisp package, I wonder if there is a nice way to see unused functions and variables after some major refactoring. I can go through the code and do xref-find-references. But ...
0 votes
1 answer
205 views

How to install evil-snipe-enable-alternate-f-and-t-behaviors on Spacemacs?

I am trying to install "evil-snipe" with evil-snipe-enable-alternate-f-and-t-behaviors on Spacemacs. The instruction on https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Bvim/evil-snipe are ...
1 vote
3 answers
553 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-...
1 vote
1 answer
43 views

Format isearch-filter-predicate as describe-variable does

If I modify the isearch-filter-predicate variable with add-function and I do: (message "%s" isearch-filter-predicate) I get: "#[128 \304\300"\205\0\304\301"\207 [skip-...
0 votes
2 answers
208 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 ...
0 votes
1 answer
18 views

Why does my function not accept a keymap when called as a variable?

I have to remap a lot of keys in existing maps while still remembering the old value of the map. To do that, I wrote some functions that go through lists of keys and lists of keymaps: (defun Daselt/...
0 votes
1 answer
36 views

Precomposing all commands in a keymap with a function using a variable in another command

I'm working on a plugin that allows avy to act from a distance and immediately return to its starting position, which mostly works. However, there is a problem in that an action, such as the deletion ...
0 votes
2 answers
36 views

Ecukes step to set a variable

I have a package that changes its behavior based on several custom variables, and I want to set up scenarios based on those settings. Here is a step I wrote, but it doesn't seem to have any effect: (...
1 vote
2 answers
358 views

How to set variable values using code that evaluates to their symbol names?

I have to back up and restore a bunch of variables in Emacs and thought I'd be clever about it, put the variable names into a list, then create a function that defines for each item in the list a new ...
0 votes
2 answers
184 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 vote
0 answers
71 views

How to run a function when a variable is accessed/read in Emacs Lisp?

I'm trying to find a way to run a function whenever a specific variable is accessed or read in Emacs Lisp. I want to know which functions are using this variable, but I don't know them beforehand. I'm ...
0 votes
1 answer
405 views

Association list `Symbol's function definition is void` error

I am trying to achieve a slightly smart package management in my init.el file but can't achieve it because of ELisp ignorance. Here is the case. ;; package loader function (defun load-packages-...
0 votes
1 answer
92 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, ...
1 vote
1 answer
77 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 ...
0 votes
1 answer
102 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.
0 votes
1 answer
272 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-...
6 votes
1 answer
1k 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. ...
0 votes
2 answers
58 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-...
1 vote
0 answers
179 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 ...
1 vote
1 answer
179 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 (_) ...
4 votes
3 answers
811 views

Set an Elisp var on the command line and read it in the init file

I'm trying to set a variable at load-time: # emacs --eval '(defvar myvar t)' Now, in this session, if I C-h v myvar RET I get a nice t. But if I put (message "MYVAR: %s" myvar) in my init file, I ...
1 vote
1 answer
44 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?;)
0 votes
1 answer
100 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 ...
0 votes
0 answers
45 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 ...
0 votes
1 answer
34 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 ...
1 vote
1 answer
68 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 ...
1 vote
1 answer
59 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, ...
2 votes
2 answers
188 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 ...
0 votes
1 answer
83 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 ...
0 votes
0 answers
35 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 ...
2 votes
0 answers
161 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 ...
0 votes
2 answers
116 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 ...
0 votes
2 answers
106 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 ...
0 votes
1 answer
77 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 ...
1 vote
1 answer
37 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 ...
0 votes
4 answers
288 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/...
4 votes
0 answers
165 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 ...
0 votes
2 answers
163 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 ...
0 votes
3 answers
48 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. (...
1 vote
1 answer
106 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-...
0 votes
0 answers
39 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 ...
1 vote
1 answer
48 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-...
2 votes
2 answers
84 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 " ...
0 votes
1 answer
48 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 &...
1 vote
1 answer
164 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 ...

1
2 3 4 5