21 votes
Accepted

How to change default minibuffer message?

display-startup-echo-area-message triggers this little advertisement unless you're using customize and have set it there or have it set in your user-init-file (because it actually goes ahead and scans ...
user avatar
  • 21.1k
19 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 ...
user avatar
  • 5,375
15 votes
Accepted

Display the beginning of a scope when it is out of screen

If you are writing C/C++/Java/Emacs Lisp/Python, then semantic-sticky-func-mode will do what you want. NOTE: This seems to be working with CEDET from Git, not stock CEDET currently in Emacs 24.4. To ...
user avatar
  • 6,672
15 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 ...
user avatar
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 ...
user avatar
  • 69.7k
13 votes
Accepted

How to cancel the minibuffer from the main buffer

C-] (command abort-recursive-edit) does what you want.
user avatar
  • 69.7k
13 votes
Accepted

Access minibuffer history without using arrow keys

From the manual, M-p moves to the previous item, and M-n moves to the next.
user avatar
  • 3,799
13 votes
Accepted

How do I disable key-chord-mode in the minibuffer?

Just add this code in your init file: (defun disable-key-chord-mode () (set (make-local-variable 'input-method-function) nil)) (add-hook 'minibuffer-setup-hook #'disable-key-chord-mode)
user avatar
12 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 ...
user avatar
  • 69.7k
10 votes
Accepted

How to display the content of minibuffer in the middle of the emacs frame?

Popup Minibuffer at the Center Here’s a way to do exactly what you asked: display the minibuffer at the center of the screen. Have a separate frame for the minibuffer Position it at the center Raise ...
user avatar
  • 22.4k
10 votes
Accepted

Transiently adjust text size in mode line and minibuffer?

Text scaling zooms the text of a particular buffer, everywhere that the buffer is displayed. What you want to do is zoom a particular frame and not just scale the text of a particular buffer. ...
user avatar
  • 69.7k
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)))...
user avatar
  • 13.6k
9 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 ...
user avatar
  • 69.7k
8 votes
Accepted

How can I read a single character from the minibuffer?

Rather than read-char I recommend read-key. The difference is that read-key obeys all the usual remappings such as input-decode-map and function-key-map, so it will work properly in a tty.
user avatar
  • 25.3k
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 ...
user avatar
  • 7,298
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 ((...
user avatar
  • 43.5k
8 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-...
user avatar
  • 6,834
7 votes
Accepted

Use thing-at-point for isearch and minibuffer commands

If you use library Icicles then you can use M-. at any time from the minibuffer to insert a thing-at-point from the buffer. You can repeat M-. to either (a) append subsequent such things from the ...
user avatar
  • 69.7k
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-...
user avatar
  • 8,952
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 ...
user avatar
  • 3,319
7 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 ...
user avatar
  • 13.6k
7 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-...
user avatar
  • 2,221
7 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 ...
user avatar
  • 69.7k
6 votes

How to display the content of minibuffer in the middle of the emacs frame?

Minibuffer at the top Displaying the minibuffer at the middle of the screen is complicated. A reasonable alternative (which you may or may not find more readable) is to move it to the top. You can ...
user avatar
  • 22.4k
6 votes
Accepted

How can I remap keys in the minibuffer?

Try this: (add-hook 'minibuffer-setup-hook (lambda () (local-set-key (kbd "TAB") nil)))
user avatar
  • 13.6k
6 votes

Display the beginning of a scope when it is out of screen

You can turn on which-function-mode by doing M-x which-function-mode RET To make the setting permanent, add (which-function-mode 1) to your init-file. From the documentation: Toggle mode line ...
user avatar
  • 14.2k
6 votes
Accepted

Can I change the background color of the inactive minibuffer?

minibuffer-setup-hook is used only when the minibuffer is set up, i.e., activated, not when it is deactivated. minibuffer-exit-hook takes effect when the minibuffer is exited. There is also ...
user avatar
  • 69.7k
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, ...
user avatar
  • 5,474
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 ...
user avatar
  • 12.1k
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" '...
user avatar
  • 69.7k

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