Questions tagged [commands]

Commands are functions that can be invoked interactively either through `M-x` or by a key binding.

Filter by
Sorted by
Tagged with
1
vote
0answers
189 views

Error in using "helm-projectile-find-file"

This is my config in init.el: (require 'helm-projectile) (projectile-global-mode) (setq projectile-completion-system 'helm) (helm-projectile-on) (setq projectile-indexing-method 'alien) (setq ...
1
vote
1answer
314 views

Adding eldoc support to js2-mode

Since js2-mode does not have eldoc-mode support, I was wondering if I could get some similar functionality to js2-mode with the help of tern-mode. tern-mode has a command tern-get-type which will ...
0
votes
1answer
70 views

Programatically get available movements evil emacs

Is there a way to programatically get the available movement commands for evil emacs? Preferably also with the key they are currently bound to. (There are a lot of commands for movement, but I do ...
3
votes
2answers
624 views

Move to the beginning of a heading smartly in Org-mode

I just started with Org-mode today and noticed whenever I press C-a on a heading, the cursor is moved all the way to the beginning of the line instead of the first character in the heading. Like so :-...
5
votes
2answers
890 views

How to make emacs automatically kill buffer after invoking delete-file command?

Whenever I delete a file that I no longer need in emacs using delete-file command, the buffer associated with the file is still open in emacs. Is there a way I can change this behaviour so that ...
4
votes
1answer
3k views

How to quickly create a new directory without using dired-mode?

Whenever I've to create a new directory in emacs, I enter dired mode, press "+" and enter the new directory name which creates the new directory. Is there a way I can avoid using dired-mode and ...
1
vote
1answer
97 views

How to retain selection after command run (indent-code-rigidly)?

I found a neat code snippet for ~/.emacs configuration: (global-set-key (kbd "C->") (lambda (b e &optional n) (interactive "r") (...
4
votes
2answers
260 views

How to disable query to turn on disabled command?

I have this in my .emacs file to disable mouse right clicks: (put 'mouse-save-then-kill 'disabled "mouse-save-then-kill disabled\n") How can I now disable the query generated by emacs to turn this ...
1
vote
2answers
942 views

How to reuse last input in command with a prompt?

Some existing functions have ability to remember last input, which you can use in the next command call - for example, replace-string will suggest the last replacement by default, while isearch will ...
5
votes
2answers
228 views

How to repeat a command immediately after calling it?

I've just called an interactive function (i.e., a command). I want to call it again, with the same arguments. I know that I can call a keyboard macro again by using e right after running it the ...
5
votes
1answer
2k views

Getting the full list of colors available in Emacs

When I run list-colors-display I get the following: which I think is a very small subset of colors that my Emacs supports, isn't it? For example, I know Emacs supports other colors (gray20, blue15, ...
3
votes
2answers
478 views

Delete file (if it exists) before saving

My problem is that I can create, but not overwrite existing files. This is probably due to a bug in MegaFuse. Because of this, when I finish editing a file I must first save it under a different ...
1
vote
2answers
802 views

How can I set a key binding to run two other key bindings?

Specifically, I want the binding 'C-x C-a' to do 'C-x C-s' then 'C-c C-a'. (Context: I'd like to save my TeX document, then have AUCTeX render it.) How can I do this? I don't want to map 'C-x C-a' to ...
6
votes
2answers
2k views

Run shell commands in emacs by something similar to M-x ...?

I have a program which can run as a command in bash. Can I run the program in emacs, in some way similar to run emacs' command (i.e.M-x , e.g. M-x occur), instead of first explicitly running a shell ...
7
votes
2answers
481 views

Exit minibuffer and execute a command afterwards?

I am trying to bind a key in minibuffer-local-map to a command which uses abort-recursive-edit or exit-minibuffer and then proceeds executing more elisp code. So I want to exit the minibuffer and then ...
1
vote
1answer
85 views

eshell backtrace when trying to use character command

I have written a custom interactive command that takes a character as an argument. When I happen to use the key binding for that command while in a eshell buffer where a long-running command is ...
2
votes
0answers
248 views

Trace Evil-mode commands

At the moment, I only know one way to determine which Emacs functions are called by any given Evil command (e.g. a sequence of key bindings in the Normal state): read the Evil source code. Is there a ...
6
votes
1answer
2k views

How can I change which shell script mode I'm in?

Occasionally, emacs opens a file in shell-script[fish] when I want it to open in shell-script[bash]. How can I manually change the subtype of shell-script mode that I'm in?
8
votes
2answers
1k views

How to see which functions are executed

When I do something inside Emacs, with the buffer *Messages* you get some idea what happened. But it's only if that function is echoing a message for the minibuffer. Then *Messages* keeps a record of ...
0
votes
1answer
70 views

man -K from emacs

There is M-x manual-entry that show concrete man page, but what if I don't know which manual page exactly I need, from shell I can run man -K apropos and see result, is equivalent functional in emacs, ...
8
votes
1answer
78 views

Is there a column equivalent of `C-l`?

The command C-l scrolls the current line to center, top, bottom. Is there an analogous command that scrolls the current column to center, left, and right?
2
votes
1answer
345 views

Can helm-apropos display the key bindings for commands the way helm-M-x does?

I'm a recent convert to helm. helm-M-x displays commands and includes key-bindings in parens after the command name. helm-apropos displays commands and other things. I'd like it to display the key ...
4
votes
2answers
116 views

Can a command determine the event sequence that invoked it?

I have a command that I would like to bind to multiple key sequences differing only in the final decimal digit (e.g. C-. 0, C-. 1, ..., C-. 9). The command needs to determine that final digit. I ...
1
vote
2answers
116 views

How to push this command in to history?

I have this function in config (defun launch-separate-emacs-under-x () (interactive) (call-process "sh" nil nil nil "-c" "emacs &")) (defun restart-emacs () (interactive) (add-hook 'kill-...
14
votes
1answer
158 views

Turning active M-! into M-& (a'ka emacs equiv to bash Ctrl-Z)

From time to time I happen to M-! some_command just to find that the command runs longer than I expected and keeps my emacs frozen for long seconds. So I glaze at my frozen emacs and kick myself for ...
3
votes
1answer
379 views

How can I speed up individual commands?

When I call commands such as helm-apropos and custom Org agendas there is often a noticeable delay between the key sequence and the results presented. How can I speed up these commands to respond ...
6
votes
4answers
2k views

Repeating a command n times

For posting code to stackexchange I repeatedly have to do indentation in emacs. I mark a piece of text and then do M-X indent-rigidly four times. Is there an elegant way to do this indentation of text ...
3
votes
3answers
157 views

Reading info files without knowing their path

If I'm in a terminal, I can just type info glibc and get info about glibc. Since emacs reads info files, it's silly to use M-x term to read info files from within emacs. I know you can use C-u C-h i ...
2
votes
1answer
495 views

Repeat regexp from isearc-forward-regexp on a subsequent replace-regexp?

I use C-M-s to search for a regexp. Then I use M-x replace-regexp to replace the same regexp with some string. Can I save typing the regexp for the second time? Generally, when typing an argument ...
0
votes
1answer
108 views

How to get the default input value in minibuffer and edit it?

For example, I am using M-x occur, and want to edit the default regexp (which is shown in the prompt), and then enter your edited regexp. can we edit the default value ^ *[[:digit:]]\.[[:digit:]]\.[[:...
2
votes
1answer
772 views

how to give optional arguments to commands

Looking at the documentation for shell-command (M-!) I see there are two optional arguments, OUTPUT-BUFFER, and ERROR-BUFFER. But when I type M-! it only asks me for the shell command. How do I ...
2
votes
3answers
204 views

M-x command completions to all occurrences of a substring

If I do M-x insert TAB Emacs shows a list of possible completions like below Possible completions are: insert-abbrevs insert-anniversary-diary-entry insert-block-diary-entry insert-...
7
votes
1answer
219 views

Getting the key binding for the current command

this-command-keys and this-command-keys-vector return the entire key sequence that fired the current command. However, such sequence will contain any prefix argument, too. Is there a function or ...
5
votes
2answers
435 views

Define an emacs function to take arguments in the same way as something like M-x goto-line

I want to write an emacs function for debug purposes in c++ code. Basically I'm fed up typing the following: std::cout << "variable is: " << variable << std::endl; Instead I want ...
3
votes
1answer
229 views

Bind C-e C-j and C-a C-o TAB to single key, aka insert and jump to newline

C-e C-j will insert a newline below and jump to it indented. C-a C-o TAB will insert a newline above and jump to it indented. Is there a single bind to these or where/how should I bind these commands?...
2
votes
1answer
268 views

Is it possible to alias an internal command?

Since I discovered multi-term, I use it exclusively over term or eshell. But, I'm lazy and would prefer to be able to simply type term to activate multi-term. Is this possible?
16
votes
2answers
815 views

How can I test and use a Perl regular expression interactively?

Say I have a buffer with text. I would like to test a regular expression (ideally Perl type) against my buffer and have Emacs highlight the matches on it. For example, the following regexp (taken ...

1 2
3