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
0 votes
1 answer
77 views

Which GNU Emacs command resizes visible windows to equal sizes?

tmux has ctrl b, shift e, to equalize pane sizes. Does GNU emacs have similar to equalize window sizes?
digit's user avatar
  • 101
3 votes
2 answers
59 views

How can I toggle between two functions in Elisp?

I would like to use the F9 key to toggle between the modus-themes-select and ef-themes-select functions. When I call the ef-themes-select, a minibuffer pops up to select an Ef theme: Now when I press ...
Zoli's user avatar
  • 307
0 votes
1 answer
31 views

How can I get the Msys2 CLI to recognise the emacs ctrl + h key chord?

OK, I hope this is in the right department because I think although this is a problem with using emacs it may be the console window settings causing the problem. In emacs in most console or GUI ...
Georgina Davenport's user avatar
0 votes
1 answer
27 views

When a merge-conflict happens and two options are shown, what is the magit command that allows the user to easily pick one of them?

Suppose a merge conflict happens. There are two options shown the upper (in red) and the lower (in green): I would like to avoid complex ediff-mode stuff to pick one. I have seen some tutorial where ...
Pedro Delfino's user avatar
1 vote
2 answers
102 views

How to find Emacs Lisp Org Mode functions

How can I find Org Mode emacs lisp functions like org-current-level which is used in the answer for Org subtree from yasnippet? I looked for the command in the Org Mode Manual but didn't find it there....
Ben Bkhdt's user avatar
2 votes
2 answers
73 views

How to prevent `M-<digit>` from invoking `digit-argument`?

In Windows, it is possible to type the Alt key together with some number to obtain the character associated to that number. This is useful when your keyboard is not properly mapped or is missing that ...
antonio's user avatar
  • 1,752
1 vote
4 answers
74 views

how to define keyboard macro from text

I am using shell inside Emacs. Often I need to execute a series of shell commands around ~40 chars, as of now I copy all the commands together and paste it from documentation. Is there any way to ...
GOPS's user avatar
  • 11
0 votes
0 answers
18 views

How to avoid pressing enter when switching from Latex on Aquamacs to PDF editor Skim?

I am on OSX 12.2, Aquamacs 3.6 GNU Emacs 25.3.50.1. I edit a Latex file with Emacs, and visualize its pdf output with Skim. When I do Command + Shift + mouse left click on Emacs to jump from the ...
Pascal's user avatar
  • 1
1 vote
1 answer
42 views

Creating shortcut key for repetitive work

I create short text files in a folder c:/Dropbox/daily/ and insert them in various documents using shortcut C-x i. I would like to define a shortcut so that I don't have to type the path of folder ...
Vaibhav's user avatar
  • 573
1 vote
2 answers
62 views

Simple and fast way to show interactive functions associated with a package

I am using M-x protoc to show me the interactive functions provided by the package protoc. Is it possible to have a shortcut for displaying protoc related functions without having to write protoc TAB ...
Ephram's user avatar
  • 455
1 vote
1 answer
23 views

How to pass the prefix argument using a list in the `interactive` clause of a command definition?

How can I use prefix argument with list in the interactive clause? It is the more general way instead of Code Characters.
Ephram's user avatar
  • 455
0 votes
1 answer
145 views

To remove characters in the beginnings of lines

To add // in the beginnings of multiple lines I can use either string-insert-rectangle or string-rectangle (C-x r t). But how is it possible to remove these characters instead? This question is not ...
john c. j.'s user avatar
0 votes
0 answers
60 views

How can I temporarily disable all (other) key bindings?

How can I write a command, and bind it to a key, so that when invoked it disables all key bindings other than the current key, until that same key binding is pressed again? The goal is to facilitate ...
Dan's user avatar
  • 1
1 vote
1 answer
59 views

What makes an elisp function available with M-x [duplicate]

Why some functions in simple.el are invokable with M-x and some others aren't? For example I can do M-x what-line but I can't do M-x line-number-at-pos.
element's user avatar
  • 27
2 votes
1 answer
127 views

Why is ivy-switch-buffer not found in counsel-M-x, but works when called by C-x b (or from the scratch buffer)

According to helpful-key, C-x b is bound to ivy switch buffer: According to the code, that is an interactive function. However, when I look for it in the Counsel-M-x menu, it's not found: I figured ...
Dargscisyhp's user avatar
1 vote
1 answer
42 views

Hide a command from user

Is there a way to hide a command from user? Or, in other words, is there a way to undo an interactive spec? Background: I have a derived mode, which is used in a special buffer as the buffer's mode. ...
theldoria's user avatar
  • 1,825
1 vote
1 answer
65 views

How to write a Lisp representation of a keyboard macro and bind it to a command name?

I'm using spacemacs with vim-bindings, but I only mention it so you don't scratch your head too long at the keystrokes of the macro. A regular emacs solution will work just the same. I've read through ...
young_souvlaki's user avatar
1 vote
1 answer
46 views

Why does `C-h b` show `??` as the command name for my key binding?

I've just added a nice custom key binding: ;; Open files in dired mode using 'open' (eval-after-load "dired" '(progn (define-key dired-mode-map (kbd "z") (lambda () (...
Ryo's user avatar
  • 125
0 votes
1 answer
41 views

How to define a command to switch to the current candidate buffer in Ido?

I'm trying to write a command that I would call while using ido-switch-buffer or ido-kill-buffer to open the current candidate in another window. Ideally it would be able to open virtual buffers as ...
Arch Stanton's user avatar
  • 1,515
1 vote
1 answer
323 views

How can I apply ansi-color to complete buffer?

I am using following code to apply colorize text in emacs, such as for ^[ characters to apply color. In order to use this code I have to select text to apply it reference: https://unix.stackexchange....
alper's user avatar
  • 1,140
0 votes
1 answer
229 views

Error /bin/bash: line 1: nil: command not found

I have the following code to auto format python code using autopep8: (defcustom python-autopep8-path (executable-find "autopep8") "autopep8 executable path." :group 'python :...
Schach21's user avatar
2 votes
1 answer
167 views

How to move from one source block to another, in Org-mode?

Is there a key-binding, command, or even evil extension for Emacs, so that I can move from one source block to another? For example,org-forward-heading-same-level, which is bound in my system to C-j, ...
BuddhiLW's user avatar
  • 257
3 votes
1 answer
136 views

Keymap that is dependent on the buffer

I want to create a "toggle shell" shortcut with F1 such that it will run shell when I'm in any other buffer, but will call mode-line-other-buffer when I'm in the shell buffer. What is an ...
Berken Tekin's user avatar
0 votes
1 answer
126 views

How to know (in Elisp) what buffer was current when a command is invoked?

I want to give an arbitrary command some buffer-local behavior without advising it. (I can do it by advising, but I want to also be able to do it without advising.) E.g., just looking at some ...
Drew's user avatar
  • 74.6k
0 votes
0 answers
13 views

How to create commands to search specific kinds of files using `helm-projectile`?

I want to be able to search python, typescript, and markdown files separely with helm-projectile. Is there a way to create distinct keybindings to search the contents of files with each extension. ...
Att Righ's user avatar
  • 661
1 vote
1 answer
87 views

How to check if point moved or is on a different line in a buffer since the last user command?

I would like to make a snippet of code that only executes if the point is on a different line in a particular buffer since the last user command. The only way I could think to do it was using the post-...
shankar2k's user avatar
  • 163
0 votes
1 answer
48 views

How to append some behavior to a command?

How do I string together functions and actions in a key binding. Say I want to make a binding that does comment-dwim and then appends "TODO: " to achieve /* TODO: */ in C. (global-set-key (...
young_souvlaki's user avatar
0 votes
1 answer
107 views

How to modify interactive function `occur` to a non-interactive function

occur is an interactive compiled Lisp function in ‘replace.el’. The definition is as follows: (defun occur (regexp &optional nlines region) (interactive (nconc (occur-read-primary-args) ...
Youjun Hu's user avatar
  • 121
1 vote
3 answers
821 views

(load-theme) at the bottom of .emacs, or manually renders a different screen

Adding this line at the very end of the .emacs file, that loads a default theme coming with the Emacs package, (load-theme 'tsdh-dark) the (main) screen looks like Note the black-on-dark text, the ...
Déjà vu's user avatar
  • 143
1 vote
0 answers
13 views

How to write an interactive function which repeats when the last key in the keybinding is repeatedly pressed? [duplicate]

I want to repeat a function when the last key in the key binding is repeatedly pressed. For example, say the keybinding is C-n for next-line, what I want to happen is that next-line is repeated when I ...
cammil's user avatar
  • 509
0 votes
0 answers
21 views

how to insert leaders with periods around dot?

(This is not about org-mode.) Assume point is between "left" and "right" below left right Is there a command that will change that to, for example, left . . . right ...
MarkSenn's user avatar
1 vote
1 answer
171 views

Why ivy-immediate-done is not shown in counsel-M-x

I realize that ivy-immediate-done is not shown in counsel-M-x. Since it's an interactive command, I'm assuming counsel-M-x somehow filters it from its result. But a quick search of the function name ...
TerryTsao's user avatar
  • 1,176
1 vote
2 answers
80 views

Are commands not equivalent to functions in Emacs? [duplicate]

The documentation for M-x says: M-x runs the command execute-extended-command (found in global-map), which is an interactive compiled Lisp function in ‘simple.el’. It is bound to <execute>, <...
herophant's user avatar
  • 223
1 vote
1 answer
81 views

How to script a bookmark-jump call

I am trying to write a function which will perform a bookmark-jump but then reset the the bookmark line to the top of the screen. So far I have: (defun foo () (interactive) (bookmark-jump) ...
user2567544's user avatar
0 votes
0 answers
474 views

A command to get buffer content centered in the window

I'm looking for the built-in command, probably a minor mode, that got my text unstuck from the left border of the window and showed more or less horizontally centered. The command doesn't modify the ...
lithuak's user avatar
  • 101
4 votes
2 answers
196 views

Display summary information on command when running Meta-x

Since I'm new to GNU Emacs (version 26.1 running on Debian Stable) I'd like to get some information when invoking a command using Meta-x. Currently I'm only able to see a list of possible completions ...
n0542344's user avatar
  • 185
0 votes
1 answer
547 views

View a history of commands

While in web-mode, when I type {{ emacs will add }} to the end, and when I press SPC it will then add another }} to the end with a space either side and one extra space to the right, so it looks like ...
Matthew Ewan-Laws's user avatar
1 vote
2 answers
379 views

Efficiently calling multiple variants of the grep command

The context I commonly execute the following variants of the grep command grep --color -RHIn '' (search in the current working directory) grep --color -RHIn --include='*.org' '' ~/repos/dotfiles/...
doltes's user avatar
  • 557
1 vote
1 answer
368 views

Break key as a shortcut -- what am I doing wrong?

I would like to define a keyboard shortcut in my .emacs file so that the Break (a.k.a. Pause) key does a C-x C-s C-x C-c. As a warmup, I thought I would try something simpler, so as a test I did this, ...
user avatar
6 votes
1 answer
565 views

How to change the default transient level temporarily? ("Show hidden magit commands")

Many commands that are rarely used in magit are hidden by default. Magit uses the transient.el library for popups and the visibility of infix and suffix commands are controlled by transient-default-...
ebpa's user avatar
  • 7,229
0 votes
1 answer
272 views

Switch to *scratch* buffer (global-set-key)

I am reading the Intro to Lisp Programing and got to the chapter where switch-to-buffer is introduced. I tried to bind (switch-to-buffer "*scratch*") via global-set-key But this does not ...
breathe_in_breathe_out's user avatar
0 votes
1 answer
87 views

Asterisk in interactive specification

Just when is it appropriate to put the asterisk * into the interactive spec of a command function? The elisp manual says the effect is to cause an error if the command is attempted in a read only ...
q.undertow's user avatar
4 votes
2 answers
305 views

Display keybindings typed in a buffer

On this video stream, the window on right displays the keybindings typed with its corresponding command bound. Is there any package that does that, or a way to achieve it?
nephewtom's user avatar
  • 2,179
0 votes
2 answers
168 views

Interactive function to convert Windows path to POSIX path

Here at 'dayjob I'm often sent paths from developers using Windows in Windows format: D:\Some\Path These paths can uniformly be converted to paths valid on at least some Linux machines at 'dayjob ...
Rovanion's user avatar
  • 975
2 votes
1 answer
501 views

How to quickly jump to a directory in emacs?

Say I have a project directory called "project". In the directory there are two directories "mini1" and "mini2". Suppose my active buffer is deep within a subdirectory in "mini1". Is there a way to ...
Prikshet Sharma's user avatar
0 votes
2 answers
1k views

How to save and execute a python file?

I do not prefer python-mode. I would like a generic way so that I can understand emacs. I wish the file be saved and python file command then be run as if in a shell.
Mini kute's user avatar
0 votes
2 answers
408 views

How do I define a function to execute as a command with M-x? [duplicate]

I wish to M-x my-func and let my code run. This seems basic but where can I get more documentation about this, if possible inside emacs itself?
Mini kute's user avatar
0 votes
1 answer
100 views

Retrieve past command from Emacs history using first letter of command

In Vim I could retrieve past commands by typing :<first-letter-of-command>↑ . If my Vim command history is:- colorscheme + source % shell set spell colorscheme? bp term Typing :s↑ directly ...
aks's user avatar
  • 135
0 votes
1 answer
54 views

What is the command to transpose line from point till end of line?

Is there a emacs command to tranpose the line from the point till end of the line. For example: quick brown fox jumps over **<point>** the lazy dog meaning After transpose it should be the ...
Talespin_Kit's user avatar
2 votes
1 answer
610 views

Insert space but don't move point

Search didn't yield any success. Perhaps I'm using the wrong search terms... I'd like to insert a single space (just like when you hit SPC) but without changing point. I come up with an example (let |...
rudolfo.christ's user avatar