Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
66 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
10 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
42 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
123 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 = "...
6
votes
2answers
294 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
107 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
50 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
87 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
139 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
120 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
270 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
33 views

Importing Org Mode variables from other buffers

I'm working on a project that uses org-mode code blocks to combine both bash and elisp code. Here is a tiny example: #+NAME: bill-bo #+BEGIN_SRC emacs-lisp "hello" #+END_SRC #+BEGIN_SRC sh :var B=...
0
votes
0answers
41 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
136 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
31 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-...
7
votes
2answers
251 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?
2
votes
0answers
226 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
55 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
0answers
36 views

edit `time-stamp-pattern` safely

I'm not sure how I missed this before, but I just learned about the time-stamp feature. I would like to edit the time-stamp-pattern variable to start with "Last revised: " and to just have YYYY-MM-DD ...
0
votes
1answer
52 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
2answers
77 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
76 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
441 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
37 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
230 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
266 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 "#...
5
votes
1answer
83 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
77 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 ...
4
votes
2answers
126 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 ...
0
votes
0answers
114 views

Globally disable scrollbar at startup

I execute EmacsClient with the following bash command: $ emacsclient -a "" -c In order to disable the scrollbar, I added the following line to the configuration file located at ~/.emacs: (scroll-...
1
vote
1answer
109 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
21 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
200 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
399 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
50 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 '...
3
votes
1answer
115 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
66 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" ...
5
votes
1answer
264 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
283 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
68 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
177 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
81 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
619 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) (...
2
votes
2answers
503 views

How do I insert code block header :var in exported code block in org-mode

GNU Emacs 26.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-10-06 Org-mode version 8.3.5 (release_8.3.5-1131-g7eecb2 @ ~/.emacs.d/el-get/org-mode/lisp/) I have come to share my projects as ...
4
votes
3answers
323 views

How can I create mode-local variables?

I'm looking to create a command which stores a kind of "history" for the current major-mode. I need the variable to be independent for each major mode, but consistent across all buffers in any ...
10
votes
4answers
185 views

Can I reload a library and have defvar re-assign values?

I am developing a library and would like to reload it after editing without exiting Emacs (assume that it is on load-path): (load-library "myname") When I do this, Emacs doesn't pick up changes to ...
0
votes
1answer
432 views

Symbol's function definition is void on built-in variables?

For some reason I am getting errors for built-in variables that are available in the documentation. For instance, evaluating in the scratch buffer the following all return: Symbol's function ...
1
vote
1answer
62 views

How to fix Warning: assignment to free (local) variable in lambda function

The byte compiler just gave me this message 1103:24:Warning: assignment to free variable `orig-win-config on this bit of code: ;; create window config store and restore functions ;; credit to @...
2
votes
1answer
181 views

change value of a defvar after loading package

I load a package that defines a list of radio stations with defvar (defvar default-list '((station1) (station2))) I want to redefine this list after loading the package (I am using require) because ...
5
votes
1answer
120 views

Update variable value without eval again

Let's say, If I have a directory variable named a-directory with its value. Also I have another variable named b-directory which gets its value from the previous variable. (setq a-directory "C:/...