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
1
vote
0answers
14 views

Passing string as arg to apply function [duplicate]

I want to call clone-indirect-buffer or clone-indirect-buffer-other-window within a function dependent on the prefix. To do this, I assign the appropriate clone function to a variable using let. ...
3
votes
1answer
34 views

Function add-variable-watcher does not watch “last-command” variable

I have added a watcher function to watch the last-command variable. (defun my-watch (symbol newval op where) (message "Hello")) (add-variable-watcher 'last-command #'my-watch) The ...
1
vote
0answers
36 views

why doesn't use-package :defines stop this “variable is void” error?

Error (use-package): w3m/:config: Symbol’s value as variable is void: w3m-filter-configuration I have a use-package statement that was producing an error because apparently emacs-w3m doesn't configure ...
7
votes
1answer
152 views

What type of variable binding is setq creating?

What type of variable binding or variable or symbol is setq creating, when the variable hasn't been declared prior setq? Given following source code: ;; -*- lexical-binding: t; -*- (defun setq-x () ...
1
vote
1answer
24 views

How to use a delayed evaluation function where a string is expected?

I have a variable that expects a string, and I want to set it to a function that will return a string whenever the variable is used. Right now, I have (setq bibtex-autokey-prefix-string (format-time-...
3
votes
1answer
42 views

Can font faces be dynamically assigned with font-lock-add-keywords?

In all the examples of font-lock-add-keywords I've seen, the font face is static. That is, there is a regex or a matcher function and a literal font face identifier. Is it possible to set the face ...
1
vote
1answer
25 views

Storing some text from a buffer into a variable

What is the "standard" way to store some text obtained from a buffer into a variable? The only way I could think of was to use something along the lines of (let ((beg (point))) (end-of-line) ...
1
vote
1answer
39 views

Activate a minor mode switching off the other ones in a set of minor modes

I'm developing a set of minor modes that I use in my LaTeX copy-editing work. I have, e.g.. a list of three minor modes stored in a variable: (defvar latex-editing-mode '(preamble-editing-mode ...
1
vote
2answers
67 views

How do I pass a variable definition as a parameter to a command in the minibuffer?

I am an emacs novice. I am familiarizing myself with making basic changes to the init.el file. Currently, when I want to load init.el, I first C-h v user-init-file RET, this opens a *Help* screen ...
0
votes
0answers
52 views

How to store a buffer in a variable so that the value of the variable isn't influenced by the fate of the buffer?

Say I'm in a buffer named init.el and I run (setq mybuffer (current-buffer)) If I evaluate mybuffer I get #<buffer init.el>. Now I kill this buffer and evaluate mybuffer again. Emacs returns #&...
1
vote
2answers
67 views

How can I show a tabular list of variables and their values?

Is there a way to see the values of a list of variables? E.g., if I have var1, var2 and var3, is there a standard elisp function that shows me the values of these variables at the same time? I mean ...
0
votes
1answer
50 views

Dynamic name for org-capture template file [duplicate]

I am new to org-mode (and to Emacs in general) and am trying to set up org-capture. I would like to define a todo capture item whose template is located in the file ~/.emacs.d/org-templates/todo.tmpl....
0
votes
0answers
16 views

savehist-mode: Lisp error: (void-variable pell-buffer)

I am using GNU Emacs 26.3 in macOS. For (savehist-mode 1) I keep getting following error: Debugger entered--Lisp error: (void-variable pell-buffer) signal(void-variable (pell-buffer)) savehist-...
0
votes
1answer
37 views

How to use header-args variables to fill cell values of a table

I have an org-mode file as such: * Header level 1 :header-args: :var filename="somefile.csv" ** Header level 2 :header-args: :var foo="bar" #+begin_src emacs-lisp foo #+end_src #+...
1
vote
1answer
30 views

Is there a tagged union/sum type in elisp? If not, what to use instead?

In many programming languages, if one wants a variable that can take a discrete number of values, one has the capacity to define the permissible values in advance, using something like an enum. Does ...
0
votes
0answers
17 views

Symbol's value as variable is void: org-format-latex-options [duplicate]

I am trying to set :scale 2.0 in org-format-latex-options with the follows line in my .emacs file: (plist-put org-format-latex-options :scale 2.0) However I get the error: Symbol's value as variable ...
2
votes
1answer
36 views

storing string in variable fails to work in `early-init.el`

Putting the following code in my early-init.el causes my emacs not to startup. (require 'cl-lib) (defvar void-initial-frame-font (cl-find-if (lambda (font) (find-font (font-spec :name font))) ...
0
votes
0answers
49 views

How do you avoid pollution of Emacs namespace with “private” variables?

Probably it is misunderstanding of Elisp execution model by I think some variables are only pollute runtime. For example let's consider read-string argument HISTORY. Probably user don't need to know ...
2
votes
0answers
45 views

How to find out the name of a variable Customize is customizing

I'd like to have a function that when run from within a Customize buffer will return the name of the variable that would be customized at point.
0
votes
0answers
16 views

Why won't emacs permanently save my buffer-local var?

For many files I have file-local variables which asked me once if they were safe and I could add them permanently to my "trusted" list, never to be asked again. However, I get asked every ...
1
vote
1answer
52 views

How to add more default face highlight colors

Using (highlight-symbol-at-point) at some point the highlight start repeating colors. I find the variable that holds the default face highlight color values in Emacs is: hi-lock-face-defaults It ...
1
vote
1answer
51 views

Modify value of a variable by applying a function to it?

Suppose one of the customizable variables in a package is var, and its default value is a list, list. I understand I can change the value of var to mylist using (setq var mylist) in my init.el. ...
0
votes
1answer
42 views

Can't save safe variables for further

When I start Emacs it asks me if I want to allow "unsafe" variables which I agree and press '!' to save them for the future. Despite that, it still keeps asking me about it on every launch. ...
0
votes
2answers
122 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
103 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
26 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-...
3
votes
1answer
2k 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
365 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 ...
1
vote
3answers
149 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
39 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
41 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
39 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
60 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
26 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 ...
0
votes
1answer
34 views

What does translation-table-for-input in function zap-to-char

I am reading the 8.1.2 The Body of zap-to-char of Elisp Introduction The body of zap-to-char (if (char-table-p translation-table-for-input) (setq char (or (aref translation-table-for-input char) ...
2
votes
1answer
163 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
64 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
46 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: (...
6
votes
1answer
175 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
80 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
130 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
34 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
47 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
111 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
43 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
110 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
136 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 "...
1
vote
1answer
281 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
53 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
2answers
113 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 ...