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 sees the old macro instead of the new function.
As others have pointed out uninstalling org-mode restarting Emacs (without loading org-mode) and reinstalling will ...
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)
"Evaluate elisp code stored in a string."
(eval (car (read-from-string string))))
Now (my-eval-string "(+ 1 2)") evaluates to 3.
As pointed out by ...
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 you requested). It executes one command after another.
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:
(if (region-active-p) (eval-region region-beginning region-end)
(global-set-key (kbd "C-x C-e") 'my-...
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 example:
You can unload the system prolog mode first, this unbinds all its variables, so that the new defvar init-forms will take effect:
(when (version< prolog-mode-version "1.25")
Note that unload-feature is not a commonly used function, so it's possible you may hit some ...
(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 compilation time, then your code can't be compiled properly since the define-clojure-indent macro won't be known during compilation, leading to mis-compilation, ...
1) 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 each of the sublists contains a tag (the first element) and a property list (the rest of it). But property lists consist of key-value pairs (pairs in a more ...
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 prints is a Lisp representation of the value. If you instead use pp-eval-expression then you see `foo, which is the (same) value printed for humans. (This is ...
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 0)
(setq ret (cons (funcall (lambda (ret)
(setq next (cdr ...
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 use the whole package you can just take this function.
(defun crux-eval-and-replace ()
"Replace the preceding sexp with its value."
@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 its evaluation, using (eval-and-compile (require 'clojure-mode)).
The fact that require is evaluated by the byte-compiler when it is at top level is pointed out ...
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 type B (dired-do-byte-compile) to byte-compile all specified Elisp files.
In all buffers, you can run the command M-xbyte-compile-fileRET to byte-compile an ...
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 init file to declare additional options.
To run something before the init file, you can force a different load order:
# emacs --no-init-file --eval '(defvar ...
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 returning the bound value (a list object that has been created earlier). However, by that point the huge list has already been generated. Evaluating it over and ...
Use symbols instead of strings:
(defun random-theme ()
"Pick a random colour theme."
(funcall (seq-random-elt theme-selection)))
See also funcall and Sequence Functions.
PS. Note that if you compile your function, you will get warnings about undeclared ...
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-errors.
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 [RET] org-plus-contrib and reinstalling with M-x package-install [RET] org-plus-contrib DID fix it
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 (find-library-name "prolog"))
(re-search-forward "(defvar prolog-mode-version \"\\([^\"]+\\)")
(string-to-number (match-string ...
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 variable. Use comma (, to evaluate it. But then quote that evaluated result.
You need to use kbd, or else you are trying to bind the key sequence C-x SPC k.
You need ...
You can use select-frame-set-input-focus to give focus to a given frame:
emacsclient --eval '(progn
But, if you only want to open a file, don't use --eval:
emacsclient -c file.txt
vdiff processes the output of diff asynchronously which takes a nonzero amount of time. Instead of guessing when to run vdiff-refine-all-hunks just set vdiff-auto-refine to t to let vdiff run it at the right time.
If you're having a performance issue, first check how long diff takes on the command line, then see if refining all hunks is slow, and finally ...
It looks like you're comparing 'ctkb with '(quote ctkb) -- or (quote (quote ctkb)) if you prefer.
e.g. Evaluating '(quote ctkb) returns the value (quote ctkb), exactly like your plist-get return value.
(equal 'ctkb (quote ctkb)) is certainly true, but (equal 'ctkb '(quote ctkb)) isn't the same thing.
I presume that (equal 'ctkb (cadr (plist-get (gethash "...
Moving the setq into the eval-when-compile means that the variable will be assigned during byte-compilation but not when you load init.elc, so it's probably not what you want.
BTW, I'd recommend (dolist (x '(doom-one zenburn leuven)) (ring-insert ring x)) over using mapc, tho it's largely a question of taste.
Nowhere. See the docstring (C-h f eval-buffer):
(eval-buffer &optional BUFFER PRINTFLAG FILENAME UNIBYTE
Execute the accessible portion of current buffer as Lisp code.
PRINTFLAG controls printing of output by any output functions in the
evaluated code, such as ‘print’, ‘princ’, and ‘prin1’:
a value of nil ...
The Lisp interpreter always evaluates the arguments before it passes them to the function you're calling, so the answer is that yes, the entire list will be generated first, and then car will select the first element of it.
This may or may not be a performance problem. If the test you're doing on each file name is expensive, then you might want to go to ...
Evaluating(princ 1) with C-x C-e (eval-last-sexp) displays the following in the echo area
11 (#o1 #x1 ?\C-a)
because (princ 1) prints 1 and returns the integer 1. And (pp 1) is the same as (princ "1"), it prints 1 and returns the string "1".
Try executing them in M-x ielm, it produces cleaner output.
*** Welcome to IELM *** Type (describe-mode) for help....