Skip to main content
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 ...
erikstokes's user avatar
  • 12.9k
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.
בנימן הגלילי's user avatar
15 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 ...
dmg's user avatar
  • 659
14 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 ...
Basil's user avatar
  • 12.5k
10 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 ...
Lindydancer's user avatar
  • 6,170
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 (...
Gilles 'SO- stop being evil''s user avatar
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 ...
Stefan's user avatar
  • 26.5k
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") (...
npostavs's user avatar
  • 9,213
7 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 ...
andrej's user avatar
  • 1,003
5 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 ...
xuchunyang's user avatar
  • 14.6k
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 ...
NickD's user avatar
  • 31k
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 ...
Drew's user avatar
  • 78k
5 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 ...
zwol's user avatar
  • 272
4 votes

Org-mode 9: unable to eval code-blocks

for me uninstalling the org-plus-contrib package and reinstalling it solved it.
zeltak's user avatar
  • 1,745
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 ...
Drew's user avatar
  • 78k
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-...
Drew's user avatar
  • 78k
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".
ebpa's user avatar
  • 7,519
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 ...
wasamasa's user avatar
  • 22.2k
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 ...
Drew's user avatar
  • 78k
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 (...
sds's user avatar
  • 6,124
3 votes

Set an Elisp var on the command line and read it in the init file

I found a hackish way: I start Emacs like this: # emacs -alt Then in my init file: (if (member "-alt" command-line-args) (let ((default-directory "~/src/elisp-test/")) (normal-top-level-...
yPhil's user avatar
  • 983
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. ...
JeanPierre's user avatar
  • 7,475
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 [...
rdcdr's user avatar
  • 63
3 votes
Accepted

emacsclient --eval command to bring a background emacs window to front

You can use select-frame-set-input-focus to give focus to a given frame: emacsclient --eval '(progn (find-file "file.txt") (select-frame-set-input-focus (...
choroba's user avatar
  • 2,075
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 (...
Tyler's user avatar
  • 22.4k
3 votes

evaluating fn in dir-locals.el

Bearing in mind that .dir-locals.el contains data, and forms are not evaluated unless you explicitly say to do so... ((nil . ((company-clang-arguments . (eval (company-clang-header-paths "/path/to/...
phils's user avatar
  • 51.7k
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 ...
Drew's user avatar
  • 78k
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.
Fran Burstall's user avatar
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 ...
zwol's user avatar
  • 272

Only top scored, non community-wiki answers of a minimum length are eligible