We’re rewarding the question askers & reputations are being recalculated! Read more.

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

eval-expression on (setq helm-debug t) does not change describe-variable output

I'm running this version of Emacs: GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11) of 2019-09-23, modified by Debian Installed on Ubuntu 19.10 via apt, and not built from source. ...
0
votes
0answers
22 views

Error running timer ‘ac-update-greedy’: (void-variable org-link-types)

I very recently updated to Emacs 26.3 and Org 9.2.6, and am getting the above-mentioned error whenever I type "[[" in an org-mode buffer to type a hyperlink. Unsurprisingly, no error after turning off ...
2
votes
2answers
51 views

Treat all numbers as floats

Is there a way to get elisp to automatically treat all numeric variables as floating points without having to repeatedly use the float function? For example to a division function that outputs the "...
0
votes
1answer
38 views

Check whether buffer is in org-mode

I want to programmatically check whether the current buffer is in org mode. I know that major modes should usually define the variable <modename>-mode, i.e., org-mode should be a defined ...
0
votes
1answer
41 views

Is variable assignment an atomic operation in elisp?

I have a situation in a mode I'm writing that saves a portion of the output of a long-running asynchronous process to a variable at intermittent intervals. I need to access this data periodically. My ...
0
votes
0answers
15 views

Is it possible to reference a variable or constant in a table cell?

I am trying to set a variable or constant to be used within multiple cells in a table, but it is either not possible or I am doing it wrong. For example #CONSTANTS a=3 |----------|--------| | number ...
0
votes
2answers
75 views

Unusual behavior when overriding `calculate-lisp-indent'

I've modified calculate-lisp-indent as a better solution to the indentation questions here, here and here. By "modified" I mean I overrode the function with advice. After doing this when I restarted ...
0
votes
1answer
24 views

How to check whether an optional param was input?

I have a command with an optional argument whose value is a number. I need: If no input argument then use default value (1000) else use input arg. (random t) (defun insert-random-number-at-point(&...
4
votes
3answers
306 views

How to modify a string without altering its text properties

If I propertize a string and save it to a variable, how can I change the string within that variable without altering its text properties? For example: (setq myvar (propertize "testing" ...
6
votes
1answer
122 views

Surprisingly persistent local variable

A local variable keeps coming back, and I know not whence. In a certain buffer, TeX-command-extra-options is "--synctex=1", even after I have removed this from my init.el and restarted Emacs. I tried ...
2
votes
2answers
52 views

Accessing the global value of a locally altered variable

Is it possible to access the global value of a variable that has been changed locally? (setq foo 2) (let ((foo 3)) ;; can I access the original value here? )
5
votes
1answer
49 views

Can a symbol have a function, variable, and class?

Q: can one symbol refer to a function, a variable, and a class? Elisp is a Lisp-2 in which a symbol can have separate function and variable values. So, for example, I can define the following ...
0
votes
1answer
75 views

Wrong type argument: symbolp, possible mismatched parenteses in .spacemacs

I am trying to apply a fix to make it easier to change todo status in org mode. The code is the following: '( (org :variables org-want-todo-bindings t) ) from https://github.com/syl20bnr/...
1
vote
1answer
21 views

How best to define nullable integer customizable variables?

I would like to define a variable using defcustom so that it can be customized by users of an emacs package. The variable is an integer (let's call it spam-override), and its function is to override ...
1
vote
1answer
102 views

Find variable definition and uses in emacs-lisp files?

Is it possible to find/jump/point to where an Emacs LISP variable is used/defined within the current file? I know about find-variable, describe-variable and find-symbol, but those all seem to work ...
0
votes
0answers
18 views

Definition and usage of colors [duplicate]

I'm trying to define a color set (from material color) in order to be able to easily change the set I want to use. I think I've managed to define them but then, I'm not able to use them properly. I ...
0
votes
1answer
120 views

defun removes function in spacemacs config

I re-defined the function org-archive-subtree to call another function as described in the function below. I did this in spacemacs/user-config, now I can't call org-archive-subtree and C-h v (describe ...
1
vote
1answer
271 views

Setq doesn't work [duplicate]

Glad that the title got your attention :D I have this little snippet that's driving me crazy: (defvar cache '(nil . nil)) (defun init-cache () (setq cache '(nil . nil))) (defun save (value) (...
1
vote
1answer
88 views

Why does :command argument of make-process not work when string passed as a variable? [duplicate]

This works fine: (make-process :name "my-proc2" :buffer " *my-proc2*" :command '("sh" "-c" "echo \"hi\"\nsleep 10\necho \"there\"") :connection-type 'pipe :...
0
votes
0answers
28 views

helm-comint-input-ring - get error: shell-mode-map

windows 10, emacs 26.1, helm 3.0 I use C-c C-l (comint-dynamic-list-input-ring) I get something like this: But I don't like this. I want to use helm-comint-input-ring. I want to get something like ...
0
votes
2answers
366 views

When I start Emacs: Symbol's value as variable is void: shell-mode-map [duplicate]

System: Windows 10, Emacs 26.1, Helm 3.0 In my init.el: ;; Shell commands history (define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring) When I start Emacs I get the following error: ...
6
votes
1answer
720 views

elisp: What does “setf” do?

I read the official documentation. Here's what not clear: Scope: If I do a setf in a function, is that visible in another function. Undo: How do I undo it. in ruby, you can do def myfunc a = "...
9
votes
2answers
2k views

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.
3
votes
1answer
186 views

How do you pass a variable in to a lambda?

How can I pass a stringvariable in to this function, so that instead of printing "This is a test", it prints "This is a value-of-variable" (async-start ;; What to do in the child process (...
4
votes
1answer
59 views

Per-host background colour

Having got a bunch of custom colors defined (thanks to Drew), I need to use them to customize the background color per host. I have named the colors after the hostname, eg (setq pentacle "#314159") (...
0
votes
2answers
237 views

Bind function to variable and evaluate each time variable is referenced

I want to set a variable to a function that is run every time the variable is used. Like Lazy set in a makefile (setq counter 0) (setq counter (+ 1 counter)) counter ; actual: 1 wanted: 1 counter ; ...
2
votes
1answer
152 views

Make a variable visible to some functions only

Consider the following metacode: ;;; -*- lexical-binding: t -*- (defvar var1 ...) (defvar var2 ...) (defun main () "Main entry point" ...) (defun func1 ...) (defun func2 ...) ... (defun funcn ...)...
4
votes
0answers
289 views

list of current variables in a buffer for Python code

I would like to find a way to reproduce the "Workspace" of Matlab or the equivalent "Variables" window of the awesome pudb debugger directly in emacs for python code: it is a window which details the ...
5
votes
3answers
425 views

init.el - setq or defvar

I want to define a trash directory in my user-init-file but I don't know which way to do this is best or most correct. I currently have something like this: (defvar my-trash-dir (expand-file-name "....
0
votes
0answers
52 views

Detect variable use in an elisp function at run time

I try to understand a piece of elisp source code, with many nested and conditional functions calls, and I would like to know if a particular variable is used (and, if so, where in the code) at run ...
3
votes
2answers
295 views

Where are these variables defined? - bytecomp Warnings

Lately I'm getting warnings when compiling the .emacs Warning (bytecomp): reference to free variable ‘url-http-extra-headers’ Warning (bytecomp): reference to free variable ‘oauth--token-data’ ...
0
votes
1answer
131 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-...
8
votes
2answers
445 views

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?
5
votes
0answers
524 views

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 ...
0
votes
1answer
91 views

Variable user-init-file not found (No Match) when trying to set it, but it's documented and has a value when examined

I'm new to emacs and looking to change my default init file as the current is set to be ~/.emacs and I want it to be ~/.emacs.d/init.el I can clearly C-h v user-init-file to see but but M-x set-...
0
votes
1answer
96 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 ...
2
votes
2answers
242 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 ...
0
votes
1answer
106 views

Installing Emacs from source: the command `C-h v` for accessing variables doesn't work

I have installed the latest development version of Emacs on my Mac from the source by cloning the Git repository here ('Emacs source repository' under 'Anonymous clone'), and then executing make in ...
1
vote
3answers
783 views

Insert the value of a variable into the buffer I'm editing

I asked How can I script emacs to install packages from list? and got this answer. (setq package-selected-packages '(async epl evil goto-chg helm helm-ag ...
1
vote
1answer
61 views

practical relevance of storing value and function into one symbol

With Emacs Lisp it is possible to store a value and a function within the same symbol. (setq foo 6) (defun foo () (message "blah %d" foo))) Then you can do: (symbol-function 'foo) which returns the ...
3
votes
1answer
489 views

Define a function alias within a let binding?

How can I define an alias within a script with let-binding? I tried (let (b-s) (defalias 'b-s 'buffer-string)) But it doesn't work. I figured out to let-bind the variable where aliases as stored ...
1
vote
2answers
536 views

customize creates custom-set-faces unintentionally

I just edited the variable org-M-RET-may-split-line with easy costumize, saved and applied. I checked my dotfile right afterwards and noticed that (custom-set-faces '(default ((t (:foreground "#...
4
votes
1answer
112 views

Why isn't this variable being set although it is set in my .emacs?

In my init.el file I have the following line (setq js2-basic-offset 2) The last line in my .init.el file is (add-hook 'after-init-hook (lambda () (message "Welcome home %s" (user-...
0
votes
1answer
143 views

Save and restore variable

I am working on Spacemacs which gives you the ability toggle between Emacs "holy-mode" and Vim "evil-mode". However the evil-escape minor mode is still enabled. I am trying to find some way to disable ...
5
votes
2answers
413 views

Set buffer-local variable in buffer other than the current one?

I'm in buffer A and I want to set a buffer-local variable in buffer B. I'm currently doing: (with-current-buffer B (setq-local some-var 'some-val)) but is there a way to do this without changing ...
1
vote
1answer
283 views

“require ('org-journal')” creates “Symbol's value as variable is void: require”

I added require ('org-journal) to my .emacs. Now I get the error message: 'Symbol's value as variable is void: require', when emacs is started. Without require ('org-journal) there is no error message....
0
votes
1answer
25 views

Why “mobile-inbox.org” filename cannot be changed?

I have (setq org-mobile-inbox-for-pull "~/org/m-Inbox.org") in my .emacs (also set the var manually to the same effect), and still when doing (org-mobile-pull) emacs stores new entries in the file ...
1
vote
1answer
345 views

Should “custom” variables defined without defcustom be set via custom-set-variables or setq?

Should I use custom-set-variables (as opposed to setq) when setting a variable that returns non-nil for custom-variable-p but was not defined by defcustom? For example, echo-keystrokes is defined in ...
1
vote
2answers
590 views

org mode - babel params variable is void

After upgrade org mode version to 9, the babel variable params is void. Below example works fine in org 8 version: #+BEGIN_SRC emacs-lisp :results output (print params) #+END_SRC #+RESULTS: : : ((:...
1
vote
1answer
178 views

Fixing “reference/assignment to free variable” warning during compilation if variable is dynamically bounded

For: (defun my-ag/font-lock-extend-region () (save-excursion (goto-char font-lock-beg) (forward-line 2) (setq font-lock-beg (point)))) I've got: Warning: reference to free variable '...