47
votes
Accepted
Org-mode 9: unable to eval code-blocks
I think this problem is caused by the change of org-babel-check-confirm-evaluate from a macro to a function. If you have org-mode (and thus the old macro) loaded when you compile the new code, it ...
38
votes
Org-mode 9: unable to eval code-blocks
To elaborate on @erikstokes:
rm ~/.emacs.d/elpa/ORGDIRNAME/*.elc
where ORGDIRNAME is the name of the core ogrmode directory. Restart emacs and you can now run org-babel code blocks.
29
votes
Accepted
How to evaluate Elisp code contained in a string?
Evaluating a string of elisp code is a two-stage process: you need to parse the string using read-from-string and then evaluate the resulting Lisp expression with eval.
(defun my-eval-string (string)
...
14
votes
Accepted
emacs --eval of multiple functions on command line
Simply use (progn ). This should address your question:
emacs --eval "(progn (toggle-frame-maximized) (sr-speedbar-toggle))"
Please note that this does not execute the commands simultaneously (as ...
11
votes
Accepted
How do you recompile an .el source file and make it active in my current session
How do you recompile an .el source file [...]
In Elisp file-visiting buffers, you can run the command M-xemacs-lisp-byte-compileRET to byte-compile the corresponding file.
In Dired buffers, you can ...
11
votes
Accepted
How to set a key binding conditional to evaluate a Lisp expression
First of all, a few stylistic recommendations. (Style is important in
programming :-D) In Lisps, we use dashes as separators, so your function is
better called my-eval, not my/eval:
(defun my-eval()
(...
9
votes
Accepted
Can I eval a value in quote?
You have two options:
1) Don't use quotes at all, as in:
(list some-var "some-string")
2) Use a backquote. They work like quotes, but part of an expression can be evaluated by using , and ,@. For ...
8
votes
When is the first element in the argument list regarded as a function symbol and when not?
the first element of a list is interpreted as a function symbol
That's the most common case, but it isn't an absolute rule.
First, you need to know that every symbol can have both a function meaning (...
7
votes
Deep eager macroexpansion
(require <foo>) is treated specially when it's at top-level (it causes the compiler to require the file also, rather than only do the require at run-time).
If the require is not performed at ...
7
votes
Accepted
How to re-load a package?
You can unload the system prolog mode first, this unbinds all its variables, so that the new defvar init-forms will take effect:
(require 'prolog)
(when (version< prolog-mode-version "1.25")
(...
6
votes
How to evaluate Elisp code contained in a string?
The answer of Constantine is okay.
Just to provide a slight modification:
(defun my-eval-string (str)
"Read and evaluate all forms in str.
Return the results of all forms as a list."
(let ((next ...
6
votes
Accepted
How to replace the expression with evaluation result using Elisp interpreter?
Two possibilities that I am aware of.
In the package crux https://github.com/bbatsov/crux there is a function crux-eval-and-replace which does exactly what you are asking for. If you don't want to ...
5
votes
Accepted
elisp - simplify a stranger data structure
It's not an association list, strictly speaking, even though the name seems to say it is. An alist is a list of (key . value) dotted pairs. org-publish-project-alist is just a list of lists, where ...
5
votes
Accepted
Is there any difference between \` and backquote?
The value returned by the sexp (read "`foo") is `foo.
You are confused by the form of the printing of the read value by the
command you are using (eval-expression, bound to M-: by default). What it ...
4
votes
Accepted
Deep eager macroexpansion
@Stefan explained why you see what you see: Your require statement is not at top level of the file.
A solution to the byte-compiler not evaluating your (non top-level) require statement is to force ...
4
votes
Accepted
How to handle end of file during parsing errors while reading a string?
If you want evaluation to return nil when it would normally raise an error, wrap the sexp to be evaluated in ignore-errors:
(ignore-errors (read-from-string contents pos))
See also with-demoted-...
4
votes
Org-mode 9: unable to eval code-blocks
for me uninstalling the org-plus-contrib package and reinstalling it solved it.
4
votes
Accepted
Set an Elisp var on the command line and read it in the init file
This doesn't work because command line options are processed after the init file. This allows the command line to refer to functions and variables defined or loaded in the init file, and allows the ...
4
votes
Accepted
Is there a way to evaluate from top of buffer to point?
The function you are looking for is ess-eval-buffer-from-beg-to-here (bound to C-c <C-up> by default).
I found this using M-x apropos "ess eval".
4
votes
Accepted
Does `car` on an non-lazy function generated list evals the whole list?
The question misses the point. Sure, suppose you do (car huge-list), the evaluator will eval huge-list by checking for its type, finding that it's a symbol, looking it up in the environment and ...
4
votes
When is the first element in the argument list regarded as a function symbol and when not?
Lisp code and some Lisp data structures (lists, symbols, strings, vectors, etc.) can be the same thing. Lisp code is a Lisp data structure that's ready to be evaluated, that is, "run".
Both ...
4
votes
“A mutable object stops being mutable if it is part of an expression that is evaluated.”
The key to understanding this sentence in the manual, is the next sentence in the manual, and its footnote:
If a program attempts to change objects that should not be changed, the resulting behavior ...
3
votes
elisp - print result not found after eval-buffer
Nowhere. See the docstring (C-h f eval-buffer):
(eval-buffer &optional BUFFER PRINTFLAG FILENAME UNIBYTE
DO-ALLOW-PRINT)
Execute the accessible portion of current buffer as Lisp code.
...
3
votes
emacs lisp execute random command
Use symbols instead of strings:
(require 'seq)
(defvar theme-selection
'(color-theme-dark
color-theme-light))
(defun random-theme ()
"Pick a random colour theme."
(interactive)
(funcall (...
3
votes
Org-mode 9: unable to eval code-blocks
On Emacs 25.2 (9.0) and using org-plus-contrib:
org-babel-execute-src-block gave me the same error as C-c C-c
deleting the .emacs.d/elpa folder and reinstalling did not fix it
but M-x package-delete [...
3
votes
How to re-load a package?
As an alternative to unload-feature, you could use this to check the version of the default package without actually loading the code:
(let ((version (with-temp-buffer
(insert-file (...
3
votes
Accepted
eval and quotes
There are several things wrong with the code:
You need #', (or just ',) in front of func. Inside a backquote expression, just func would result in the literal symbol func, not its value as a ...
3
votes
Accepted
Iterate only length times over a list
Welcome to SE Emacs. The nil you are seeing is not an extra iteration: it is simply the return value of the dolist or dotimes function.
3
votes
When is the first element in the argument list regarded as a function symbol and when not?
Specifically responding to
if I see the following code,
(hoge (foo bar))
how do I know whether (foo bar) is evaluated by passing argument bar to function foo or it is treated as a list of two ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
eval × 50backquote × 5
emacsclient × 4
variables × 4
elisp-macros × 4
quote × 4
eval-expression × 4
functions × 3
symbols × 3
print × 3
org-mode × 2
key-bindings × 2
buffers × 2
colors × 2
start-up × 2
list × 2
byte-compilation × 2
command-line-arguments × 2
load × 2
read × 2
init-file × 1
org-babel × 1
elisp × 1
microsoft-windows × 1
hooks × 1