A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [setq]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
45 views

init.el and trampling of custom-set-variables

My new init.el uses require to load various settings that I have organised into directories and files. This is an attempt to tame what was a very large and messy init.el and custom.el file. Also I ...
0
votes
1answer
12 views

How to set value vc-git-grep-template within function

I have a working sexp for configuration vc-git-grep: (setq vc-git-grep-template "git --no-pager grep -n -i -e <R> -- <F>") Then in dired-mode I evaluate M-x vc-git-grep and everething ...
0
votes
1answer
92 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
302 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) (...
0
votes
2answers
262 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 ; ...
3
votes
2answers
53 views

How to define a bundle of variable-and-function pairs?

I want to define a bundle of variable-and-function pairs, e.g.: vl/path-doc points to my often used path, and vl/open-path-doc is used for open it in dired-mode. I tried this piece of code: (setq ...
1
vote
1answer
361 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 ...
13
votes
1answer
4k views

What's the difference between setq and defvar

What is the difference between setq and defvar in Emacs lisp? I see common lisp version of the same question at https://stackoverflow.com/questions/3855862. Are they same in Elisp?
14
votes
1answer
503 views

Why do setq and set quote act differently on let-bound variables with lexical scope?

I had a bug in one of my extensions that eventually turned out to be caused by set not working as I expected: ;; -*- lexical-binding: t -*- (let ((a nil)) (setq a t) (print a)) (let ((a nil)) ...
12
votes
3answers
2k views

Assigning same value to multiple variables?

Sometimes I need to set same value to multiple variables. In Python, I could do f_loc1 = f_loc2 = "/foo/bar" But in elisp, I am writing (setq f_loc1 "/foo/bar" f_loc2 "/foo/bar") I am wondering ...