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
2answers
62 views

Change $PATH once emacs is running

In my shell (Bash), I can switch among several LaTeX distros setting the $PATH variable. E.g.: export PATH=/usr/local/texlive/2016/bin/x86_64-linux:$PATH or export PATH=/usr/local/texlive/2018/bin/...
0
votes
0answers
42 views

org-capture-template “:created” property

Studying the variable org-capture-template I found several configurations where a certain :created t property is used. One example is here In my help buffer (help:org-capture-templates) I could not ...
0
votes
0answers
24 views

It is safe to delete set free variables?

For example I have followins line of code (usually I get these code from answers). (projectile-global-mode) ; smerge-mode (setq smerge-command-prefix "\C-cv") (setq undo-tree-show-...
1
vote
1answer
149 views

Symbol’s function definition is void

I am trying to make an interactive toggle in emacs 27.0.90 When I eval-region no warnings or errors are shown. However, when I do (helm/toggle-frame) in ielm it throws Symbol’s function definition is ...
1
vote
2answers
308 views

Is there a way to spread a list like in Typescript or Golang?

I have a variable with some common values between dap-mode debug templates and I want to use that variable along with other cons elements for :environment-variable in languages like Golang or ...
0
votes
3answers
29 views

The global value of a variable I set with setq in my config differs from the local value. How can I get my value to be what I want in every buffer?

I want web-mode-script-padding to be set to 0 at all times. In my config, I have tried both (with-eval-after-load 'web-mode (setq web-mode-script-padding 0) ) As well as simply, (setq web-mode-...
1
vote
1answer
19 views

How to change a variable value in the current buffer?

I spent a long time looking for this and kept getting reference to M-x customize. But, that didn't give me access to certain variables like comment-start. I couldn't access comment-start with M-x ...
0
votes
1answer
22 views

Add element to org-refile-targets

I am keeping a common init.el for work and private on separate machines. So dependent on my machine I have common settings and machine dependent settings. How do I get to add an element to the org-...
0
votes
0answers
31 views

Multiple cursors has undefined variables

I installed multiple cursors mode. My init.el has the following at the bottom: (require 'bytecomp) (require 'multiple-cursors) (multiple-cursors-mode 1) (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-...
1
vote
1answer
21 views

Wrong type argument: symbolp, 10

I would like create function that ask me how length I want the Pomodoro but it say wrong type argument. (defun changePomoLength () (interactive) (set-variable org-pomodoro-length (read-string "...
2
votes
1answer
21 views

Giving faces compliant names

The description of defface in (info "(elisp) Defining Faces") says that the name of a face should not end in -face. But most faces declared in font-lock.el do use the suffix -face. How does this fit ...
1
vote
1answer
91 views

How can I get the effect of buffer-local symbol plist property values?

Does Emacs have a way to set buffer-local properties on symbols? It's well-known that there are buffer-local variables. But a property belongs to a symbol, not to a variable. Hence, if I have ...
0
votes
1answer
44 views

How to set a variable that matches different type of strings?

I have these strings: First Type: arXiv:1234.56789 arXiv:1234.56789v1 Second type: hep-th/123456789 hep-th.AB/12345689 hep-th/123456789v1 hep-th.AB/12345689 Belong to the second type even strings ...
0
votes
2answers
36 views

Make/unmake a variable globally buffer-local depending on another variable

I have a package with the variable my-package--my-var that needs to be buffer-local when my-package-buffer-only is t but global if my-package-buffer-only is nil. This is what I have so far: (...
5
votes
1answer
123 views

What's really behind an assignment in Emacs lisp?

[Warning : these are noob questions.] I'm a beginner in Emacs Lisp and I would like to be sure that I understand well what I'm really doing when I set a value to a variable with setq or let. Here is ...
1
vote
1answer
37 views

Get value of a variable from another session in org-mode

How to share variables' values in org-mode between different sessions? Simple example: in session one I create _gpg_tmpdir #+name: make_temporary_directories #+begin_src bash :session *one* ...
1
vote
1answer
68 views

Keep ivy-initial-inputs-alist nil after counsel loaded

I want to keep the alist ivy-initial-inputs-alist nil after ivy and counsel are loaded. Therefore, I have the following configuration: (use-package ivy :ensure t :config ;; some keybindings ...
1
vote
1answer
31 views

Evaluate allows for combinations whose operators are compound expressions

I find the amazing power of scheme in sicp Exercise 1.4. Observe that our model of evaluation allows for combinations whose operators are compound expressions. Use this observation to describe ...
0
votes
0answers
41 views

How to extract symbols from an elisp buffer?

While I could parse the elisp myself, is there a way to extract symbols from an elisp buffer? That is, variable names, macros & functions - not part of strings.
0
votes
1answer
64 views

Regular expression gives different results as variable and as literal

In the Emacs *scratch* buffer, I get different results when I use the same regular expression as a variable compared to a literal: (setq splitter-string "9:20") "9:20" (string-match "[0-9]?[0-9]:[0-...
0
votes
1answer
29 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
77 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
81 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
130 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
49 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
20 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
91 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
56 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
408 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
137 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
111 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
60 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
151 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
27 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 ...
2
votes
1answer
265 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
151 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
390 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
110 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
39 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
579 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
1k 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 = "...
13
votes
2answers
4k 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.
4
votes
1answer
298 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
60 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
360 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
165 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
363 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
531 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
64 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 ...