Questions tagged [eval-expression]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer

Reusing a code block to define a sub-menu with easy-menu-define [duplicate]

I'm trying to reuse a code block to define a sub-menu to be used in different parts (minor mode menus) of my code. I've attempted to define a variable to hold the sub-menu code block and then use it ...
Gabriele Nicolardi's user avatar
2 votes
1 answer

Macro breaks only in `eval-expression` (`M-:`)

I have a macro which unpacks a list into variables, as if by setq: (unpack (a b c) '(1 2 3)) is roughly comparable to (setq a 1) (setq b 2) (setq c 3) The way I did that initially was by having the ...
mtraceur's user avatar
  • 346
2 votes
1 answer

"C-x C-e" skips some characters

(message "Shynur: Hi!") \N{BOX DRAWINGS LIGHT HORIZONTAL}■ ;; cursor RIGHT HERE ^ ;; then type "C-x C-e" "C-x C-e" skips those characters that ...
shynur's user avatar
  • 5,174
1 vote
1 answer

How does `eval-last-sexp` determine the expression for evaluation?

Context: Emacs 29.0.60 The ▬ and the empty lines after the script text below are point positions at which the interactively executed function eval-last-sexp echoes in the minibuffer and the *Messages* ...
Claudio's user avatar
  • 440
1 vote
1 answer

Why does C-x C-e work in foo.txt but C-M-x does not?

Create a new file foo.txt and type this code in it: (+ 1 2) Move the cursor to the end of the line (right after the close-paren) and press C-x C-e. The expression is evaluated. Move the cursor to ...
Lone Learner's user avatar
0 votes
2 answers

goto-char support for hexadecimal input

I recently realized something weird regarding usability of goto-char using GNU Emacs: M-x goto-char Go to char: 0x1000 Please enter a number (OP note: didn't work) M-x goto-char Go to char: (* 4 ...
Robert's user avatar
  • 103
2 votes
1 answer

Copy the result of C-x C-e instead of inserting it into buffer

Is there a builtin mechanism that copies the result of C-x C-e rather than inserting it into the buffer with the non-negative prefix. I think this would have been more useful by default.
Arktik's user avatar
  • 972
0 votes
1 answer

Orgmode, Export HTML in One Shell Command

When using Orgmode, we can generate/export HTML file or TXT file from ORG file, using C-c C-e(or M-x org-export), as described in I wonder if ...
absuu's user avatar
  • 149
0 votes
1 answer

How to get the value of an evaluated function and nothing else?

In emacs, when I evaluate an elisp function, I get the value plus other stuff. For example, if I evaluate (+ 2 2), I get this: 4 (#04, #x4, ?\C-d) How can I setup emacs to just return 4?
Vinn's user avatar
  • 293
1 vote
1 answer

Why does let binding sometimes seem to fail to override a value?

In this example, the message isn't shown, but it's still logged (message-log-max is ignored). (let ((inhibit-message t) (message-log-max nil)) (hs-minor-mode)) The text Showing all blocks ... ...
ideasman42's user avatar
  • 8,736
2 votes
1 answer

How to enable a major + a minor mode on loading a file?

Clojure files should open in Clojure-mode. I also have Clojure files that contain color info and are used to generate my styles; they live under a /styles path. For these files, I want them to have ...
Webdev Tory's user avatar
5 votes
1 answer

Showing returned values in the same buffer

When I evaluate an expression with C-x C-e, I see the result returned by that expression in the minibuffer, for a while. Can I have that returned value written in the same buffer where the evalued ...
user1632812's user avatar
0 votes
1 answer

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. ...
bgoodr's user avatar
  • 339
5 votes
3 answers

How to replace the expression with evaluation result using Elisp interpreter?

When I do bulk calculations in a scratch buffer, it is annoying to have to delete the actual expressions after they are evaluated (I want them to be deleted on evaluation). Example: (+ 2 2) ...
A_P's user avatar
  • 672
7 votes
2 answers

Quickly Evaluate Infix Math Expression?

Is there a way to highlight and quickly evaluate a simple math expression without using elisp notation? For example, we can already evaluate the elisp expression (+ 1 1) in the following text snippet ...
George's user avatar
  • 919
20 votes
5 answers

Result of arithmetic evaluation in buffer, not echo area

Windows 10, Emacs 25.1 I want to do some arithmetic operation I do this: The result is in the echo area, but I want the result to be in cursor place in the buffer. Something like this: How do I do ...
user8542613's user avatar
3 votes
1 answer

How to direct `M-:`'s value to the current buffer?

According to the Emacs manual, M-: evaluates an Emacs Lisp expression and prints the value in the echo area. How can I direct the value to the current buffer instead?
Evan Aad's user avatar
  • 1,521
5 votes
2 answers

Insert a string from eval-expression without the quotes

I want to use C-u M-:, then (format-time-string "%m/%d/%Y") to insert a customized date string. But it is inserted into the current buffer with double quotes. Any trick to remove these quotes?
David S.'s user avatar
  • 395
1 vote
1 answer

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

Suppose I already opened a emacs but its in the background. So, is there an emacsclient eval option that I can type in the shell like: emacsclient --eval "(bring-existing-emacs-window-to-front)" To ...
phonycollectibles's user avatar
9 votes
1 answer

emacs --eval of multiple functions on command line

How do I evaluate multiple functions simultaneously using emacs --eval on command line? For example I want to combine the followings in a single command: emacs --eval "(toggle-frame-maximized)" emacs ...
phonycollectibles's user avatar
1 vote
1 answer

Weird (point) and (point-max) values in IELM

When I open IELM and type in (point) or (point-max) in the interpreter, it always returns 710 (#o1306, #x2c6, ?ˆ) and 64292 (#o175444, #xfb24, ?ﬤ) respectively. If I eval these functions via eval-...
Mirzhan Irkegulov's user avatar
4 votes
1 answer

From an external script, open file and run some simple expression whether emacs already running or not

Context / initial need (works fine) I wrote and use a script that generates a file and uses emacsclient to edit it in an existing or new instance of emacs, in a new window. Similar to Set up Emacs ...
Stéphane Gourichon's user avatar
2 votes
4 answers

How do I eval a multiple line elisp expression inside the current buffer?

I am trying to delete all HTML style comments from my current buffer. I found a solution in "Function to delete all comments from a buffer, without moving them to kill ring", but since it is more ...
Zolomon's user avatar
  • 131
5 votes
0 answers

Stopping pdf-tools from resetting to the beginning of an open PDF when I eval-buffer my config file

I'm using pdf-tools to read PDFs in Emacs, and am pretty happy so far. However, I've found when I modify, and then eval-buffer my configuration file, the PDFs I opened earlier with pdf-tools get put ...
Koz Ross's user avatar
  • 425
5 votes
1 answer

What does "(#o4, #x4, ?\C-d)" mean here?

I use m-x eval-expression to evaluate a very simple lisp code: ( + 1 3) And I got my result like this What does the symbols (#o4, #x4, ?\C-d) mean in this context?
Anthony Kong's user avatar
1 vote
1 answer

How to make icicle-pp-eval-expression use eldoc like eval-expression?

In recent Emacs versions, eval-expression makes use of global-eldoc-mode in a quite intelligent way, using the modeline to display hints. However, icicle-pp-eval-expression, which is Icicles' variant ...
mbork's user avatar
  • 1,657
1 vote
1 answer

both keywordp and macrop then eval from a functionp

'Hope it won't bother my using defmacros named in the style of keywords (colon-prefixed, e.g., :set-this or :get-that): it apparently tricks ELisp from otherwise requiring quoted symbols (') or ...
sjb's user avatar
  • 101
8 votes
2 answers

Saving open file list and buffer command history in between sessions

I've discovered desktop-save-mode which allows Emacs to be closed and when it reopens, it appears with the same files that were open before. I want to take this a bit further and I was wondering if I ...
Galder Zamarreño's user avatar
2 votes
1 answer

Input-methods in the insert eval expressions

I can activate the input method french-azerty by M-x set-input-method RET french-azerty. Then by a qwerty keyboard I can type like an azerty one. Thus typying q in the buffer gives a. But when I do M-:...
Name's user avatar
  • 7,809
6 votes
2 answers

Is there a variable to toggle Emacs 24.4 elisp return "noise"?

In Emacs 24.4, every time I evaluate a form in ielm or using C-x C-e it prints a lot of extraneous output that while useful, sometimes gets in the way. As an example, (+ 1 1) ;=> 2 (#o2, #x2, ?\C-...
wdkrnls's user avatar
  • 3,707