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
3
votes
3answers
263 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
107 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
44 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
48 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
32 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
59 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
92 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
190 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
83 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
19 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
188 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
467 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
153 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
58 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
170 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 ; ...
1
vote
1answer
149 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
224 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
394 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
47 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 ...
4
votes
2answers
260 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
81 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
405 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
441 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
78 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
75 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
185 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
94 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
694 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
51 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
386 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 ...
0
votes
2answers
451 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
105 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
131 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
322 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
254 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
24 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
304 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
536 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
119 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 '...
2
votes
1answer
187 views

Controling what an org-link points to with variables

Let's say I have the following: #+NAME: output-directory /path/to/output/directory Results can be found [[file+emacs:/path/to/output/directory][here]]. Is there a way for me to have an org link to ...
0
votes
1answer
69 views

elisp - simplify a stranger data structure [duplicate]

I wish to define a variable to replace the hardcode string below: (setq org-publish-project-alist '( ("blog" :components ("org-blog-docs" "org-blog-static")) ("org-blog-docs" ...
7
votes
2answers
377 views

The default value of buffer-local variable not set until first `setq`

Say I define a buffer-local variable foo, and its default value is "a": (defvar foo "a") (make-variable-buffer-local 'foo) (default-value 'foo) ;; => "a" Immediately after this I run the ...
1
vote
1answer
389 views

Passing a symbol as an argument to a function

I'm trying to understand why this doesn't work, and how to make it work: (defvar test/var-1 nil) (defvar test/var-2 nil) (defun make-setter (var-to-set) (lambda (val-to-set) (setq var-to-set ...
2
votes
1answer
92 views

Why isn't face-remapping-alist permanent-local by default?

text-scale-mode uses a buffer-local face-remapping-alist to scale the buffer's text, adding values like (:height 1.2). It stores a "cookie" with the scaling it has applied in another local variable, ...
1
vote
0answers
262 views

load environment variables of virtual environment in emacs

What is the best way to load in emacs the environment variables of a virtualenv? I seem to have got virtualenvwrapper.el working. For example, after using venv-workon my_venv, then M-! printenv ...
0
votes
2answers
100 views

Warning assigning variables

I'm rebuilding my emacs configuration, and trying to compile without warnings. I'm using also cask. I have this case: (require 'magit) ;; Enable a right limit of 70 chars for git logs (add-hook '...
2
votes
1answer
931 views

Error void-variable in mapcar

What is the difference between the two functions func1 and func2? (defun func1 (arg) (if (listp arg) (mapcar (lambda (x) (func1 x)) arg) arg)) (func1 (list 1 2 3)) (defun func2 (arg) (...