Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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
33 views

Precomposing all commands in a keymap with a function using a variable in another command

I'm working on a plugin that allows avy to act from a distance and immediately return to its starting position, which mostly works. However, there is a problem in that an action, such as the deletion ...
Alexander Praehauser's user avatar
0 votes
1 answer
35 views

Calling the command associated to a keybind in another command

I'd like to use avy by writing a command that does the following: first, it should ask for a key combination. Then it should call interactively, say, avy-goto-line to select a position, where it sets ...
Alexander Praehauser's user avatar
0 votes
1 answer
41 views

Difference between sequences of commands in another command and when entered by hand

I've started to use eww and really like it but I would like the ability to open a search in a new tab with one command. Eww has eww-open-in-new-buffer, which works when I want to open links in a new ...
Alexander Praehauser's user avatar
0 votes
1 answer
52 views

Define command that executes several functions

I apologize for this question, for which I know an elementary answer exists that I can't find for the life of me. I would simply like to define a command that executes several functions sequentially. ...
Alexander Praehauser's user avatar
2 votes
2 answers
70 views

Make "M-x repeat" Ignore Movement Commands

Is there a standard way to make M-x repeat ignore movement commands or does it require custom elisp? I read a [Mastering Emacs blog post about repeating commands][1] and immediately started using &...
nslamberth's user avatar
2 votes
1 answer
64 views

When does Emacs enter command loop?

I'm reading (info "(elisp) Command Overview"): Variable: post-command-hook : ... ... : This hook is also run when Emacs first enters the command loop (at which point this-command and last-...
shynur's user avatar
  • 5,318
0 votes
1 answer
84 views

Command that does absolutely nothing

Is there an Emacs command that does absolutely nothing ?
Dilna's user avatar
  • 1
1 vote
1 answer
60 views

`completion` In Declare Form Not Working

Why is this function: (defun shyn/func () (declare (completion (lambda (symbol current-buffer) nil))) (interactive)) still listed by pressing M-x TAB in buffer *scratch*? ...
shynur's user avatar
  • 5,318
1 vote
0 answers
64 views

Effect of `modes` In Declare Form [duplicate]

13.14 The declare Form: (modes MODES) Specify that this command is meant to be applicable for MODES only. What is the practical effect of (modes ...) in declare form? I find that I can still call ...
shynur's user avatar
  • 5,318
0 votes
1 answer
197 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
  • 103
3 votes
2 answers
84 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
  • 441
0 votes
1 answer
73 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
1 vote
1 answer
42 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
127 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
105 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,822
1 vote
4 answers
96 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
1 vote
1 answer
44 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
  • 583
1 vote
2 answers
73 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 ...
Dilna's user avatar
  • 1
1 vote
1 answer
26 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.
Dilna's user avatar
  • 1
0 votes
1 answer
240 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
1 vote
0 answers
110 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
  • 11
1 vote
1 answer
90 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
  • 47
2 votes
1 answer
205 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
65 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,845
1 vote
1 answer
99 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 ...
mcp's user avatar
  • 556
1 vote
1 answer
53 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
  • 135
0 votes
1 answer
54 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,667
2 votes
1 answer
694 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,390
0 votes
1 answer
402 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
312 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
  • 297
3 votes
1 answer
146 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
172 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
  • 77.9k
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
  • 775
1 vote
1 answer
112 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
  • 175
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 (...
mcp's user avatar
  • 556
0 votes
1 answer
147 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
2k 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
214 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,216
1 vote
2 answers
88 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
107 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
717 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
242 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
731 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
621 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
  • 587
1 vote
1 answer
433 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
7 votes
1 answer
666 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,499
0 votes
1 answer
384 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
118 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