Questions tagged [setq]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
10 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
57 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
224 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
203 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
323 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 ...
3
votes
2answers
52 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 ...
12
votes
1answer
3k 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
477 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
1k 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 ...