20 votes

Put the current file name in the minibuffer

What existing command gets the current file buffer's file name like this? Unfortunately there is no ready made command for this, but we can make one as follows: (defun name-of-the-file () "Gets ...
Emacs User's user avatar
  • 5,503
17 votes
Accepted

Spacemacs: paste into minibuffer

C-y does work, but you can also paste into the minibuffer from the default register using dotspacemacs-emacs-leader-key instead of dotspacemacs-leader-key, in which case you can use: leaderre" or ...
Braham Snyder's user avatar
14 votes
Accepted

Difference between the physical "RET" key and the command 'newline in the minibuffer

You are confusing a few things, here. First, RET is not a physical (keyboard) key. It is a logical key -- the Emacs way of writing what your physical Return or Enter key typically sends to Emacs: a ...
Drew's user avatar
  • 74.6k
14 votes

How to copy minibuffer contents?

As others have indicated, and as was explained in the page you link to, output messages to the echo area are logged in buffer *Messages*. Clicking in the echo area brings up *Messages*, where you can ...
Drew's user avatar
  • 74.6k
11 votes
Accepted

Call a function and insert text in minibuffer prompt

Use minibuffer-setup-hook: (defun foo () (insert "ABCDE")) (add-hook 'minibuffer-setup-hook 'foo) As @Basil mentions in a comment, depending on your use case you can alternatively use macro ...
Drew's user avatar
  • 74.6k
10 votes

How to call another function, if one function gives an error message

No need to read *Messages*. Here's how error handling works in Elisp: (defun bar () (error "asdf")) (defun foo () (condition-case e (bar) (error (message "Caught an error: %S" e)))...
abo-abo's user avatar
  • 13.9k
9 votes

How do I change the color of the prompt in the mini-buffer?

It's not obvious how to find out what face it is. The usual way is to put your cursor on some text and then use C-u C-x = but that's harder to do in the minibuffer. The other way I know of is to use M-...
amitp's user avatar
  • 2,431
9 votes

Using evil in the minibuffer

PR #1059 implemented this. Turn it on like this: (setq evil-want-minibuffer t) Watch out not to become too evil! :D
Alexander Shukaev's user avatar
9 votes
Accepted

Prevent Emacs from messaging when it writes recentf

One solution for that narrow case is to dynamically set save-silently for that invocation specific invocation. Try: (run-at-time nil (* 5 60) (lambda () (let ((save-...
ebpa's user avatar
  • 7,229
8 votes
Accepted

I-search prompt font

This is because isearch does not use the minibuffer to read input from the user, rather it simply updates the echo area with the characters entered during isearch. Please note that the minibuffer and ...
Iqbal Ansari's user avatar
  • 7,438
8 votes

Exit minibuffer and execute a command afterwards?

I wrote about this once. The code: (defmacro ivy-quit-and-run (&rest body) "Quit the minibuffer and run BODY afterwards." `(progn (put 'quit 'error-message "") (run-at-time nil nil ...
abo-abo's user avatar
  • 13.9k
8 votes
Accepted

Tab completion in minibuffer: case insensitive

Sure. Set variable completion-ignore-case to t. Put this in your init file: (setq completion-ignore-case t) C-h v completion-ignore-case: completion-ignore-case is a variable defined in C source ...
Drew's user avatar
  • 74.6k
8 votes
Accepted

Call function interactively and set initial content

find-file uses the buffer-local default-directory value as the default filename (see also find-file-read-args), so all you need to do is bind that value for the scope of the call to find-file: (let ((...
phils's user avatar
  • 47.3k
7 votes

Suppress message in minibuffer when a buffer is saved?

As was pointed out by @phils the "Wrote file" comes from write-region. If you don't use the inhibit-message variable introduced in Emacs 25, you could replace the original write-region with a function ...
mutbuerger's user avatar
  • 3,419
7 votes
Accepted

How do you disable the buffer end/beginning warnings in the minibuffer?

This is very similar to the question Is there a way to disable the “buffer is read-only” warning?, so a very similar answer seems appropriate. You can disable these messages by setting command-error-...
Constantine's user avatar
  • 9,042
7 votes
Accepted

Quick access to the previous search terms after calling isearch-forward without switching to the minibuffer

With C-s C-s you search the previous word. Then M-p (and M-n) for history.
djangoliv's user avatar
  • 3,159
7 votes

Can't get out of minibuffer completion

Is it possible there is an active recursive edit in the completion minibuffer? C-] by default is abort-recursive-edit. Alternatively keyboard-escape-quit or ESC ESC ESC might help?
dgtized's user avatar
  • 4,159
6 votes
Accepted

How to get back to minibuffer during an interactive search?

You can hit M-e to edit the current search term. This runs the command isearch-edit-string. You can then type C-s to resume the search. To get a list of all key bindings available during isearch, ...
nanny's user avatar
  • 5,644
6 votes

Key binding with an argument

As you seem to have already noticed, a function need the interactive form before it can be bound to a key. interactive doesn't just tell Emacs the function is a command, it is also tells Emacs where ...
erikstokes's user avatar
  • 12.6k
6 votes
Accepted

Define colors for single use in minibuffer

Just use a string with faces. (message (propertize "foo bar" 'face 'highlight)) Or use a different face, which has a red foreground. Or use a face property list: (message (propertize "foo bar" '...
Drew's user avatar
  • 74.6k
6 votes

gpg password entry in minibuffer, not popup

Have you tried installing gpg version greater than 2.1, and then (setq epa-pinentry-mode 'loopback)? This should prompt for the password in the minibuffer. Edit: epa-pinentry-mode has been marked ...
InHarmsWay's user avatar
  • 1,309
5 votes

How can I read a single character from the minibuffer?

The question was answered long ago, but this additional answer may provide some assistance to other searchers. read-char-choice allows you to specify a list of choices. The fn will not return until ...
Cheeso's user avatar
  • 235
5 votes
Accepted

subword-mode in minibuffer?

You can enable the subword mode in the minibuffer by adding the below to your emacs init. (add-hook 'minibuffer-setup-hook #'subword-mode) The same applies for any hook and minor mode. Emacs ...
Kaushal Modi's user avatar
5 votes
Accepted

How to call another function, if one function gives an error message

The error in question is thrown with user-error, not simply echoed with message. In your particular case testing the return value of evil-get-marker should work also: (if (evil-get-marker ?8) (...
Tom Regner's user avatar
5 votes
Accepted

How to copy minibuffer contents?

You can select and copy the text of the prompt in the minibuffer (normally), if you move the point using any moving commands just one position after the prompt, and then C-b to move the point over the ...
wvxvw's user avatar
  • 11.1k
5 votes
Accepted

Exit minibuffer and execute a command afterwards?

I don't know of a way to do what you request. As you say in your question, and as @abo-abo shows, a workaround is to use a timer to execute the code you want run after the minibuffer is exited. The ...
Drew's user avatar
  • 74.6k
5 votes

How copy content of minibuffer to kill-ring?

Just like ordinary buffers, C-x h (mark-whole-buffer) then M-w (kill-ring-save).
xuchunyang's user avatar
  • 14.2k
5 votes
Accepted

How can I disable the vertical scroll bar on just the minibuffer?

fledermaus solved the puzzle: Add this to init.el: (set-window-scroll-bars (minibuffer-window) nil nil)
daveloyall's user avatar
  • 1,280
5 votes
Accepted

What is the variable for having multiple minibuffers?

The feature is called (emacs) Recursive Edit, it's disabled by default, you can enable it via (setq enable-recursive-minibuffers t) With Recursive Edit enabled, you might also want to enable ...
xuchunyang's user avatar
  • 14.2k
5 votes
Accepted

How can I resume swiper-isearch with the next line selected?

I found a solution to what I was trying to do: (defun my-swiper-isearch-again () "Start swiper-isearch with the last thing searched for." (interactive) (swiper-isearch (car swiper-history))) (...
bfad's user avatar
  • 171

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