Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [keyboard-macros]

A "keyboard macro" is a command defined by an Emacs user which represents a sequence of keys. Calling a keyboard macro is equivalent to typing that key sequence.

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

Simple regexp inside emacs keyboard macro

Newbie question: I'm trying to record a keyboard macro with a simple regexp inside (search-backward-regexp ^[0-9]). This works well when recording the macro, but as soon as I try to execute it, the ...
0
votes
0answers
26 views

Record a keyboard macro in Evil Mode to a register with another keyboard macro inside it

In vim, one can type qw to start recording a macro to register w, then record the macro, then finish recording to w by pressing q again. It is then possible to record another macro by typing qe, ...
2
votes
1answer
43 views

alphabetic keyboard macro “counter”?

I very much {like, use} the kmacro-*-counter family of commands. However I sometimes find myself needing to generate alphabetic sequences (e.g., A, B, C, ...) instead of integer sequences (e.g., 1, 2, ...
0
votes
1answer
43 views

keyboard macro for opening a file

How can I create a keyboard macro where a file myfile is opened by executing M-x openmyfile. The main part should look like (fset 'openmyfile [?\C-x ?\C-f <dir of myfile> return]) but I don'...
3
votes
1answer
45 views

Octal character representation in keyboard macros

I generated a macro as a help for generating indices for words I have marked before. Now this macro looks as follows (fset 'index "\367\\index{\C-y") What does \367stand for and where can I look ...
0
votes
1answer
48 views

How can I apply a keyboard macro to every line that starts with rectangle mark region

Lets suppose I would like to edit my text and to add comments to the column in the text. This is my text: something-text1 foobar1 something-text1 something-text2 foobar2 something-text2 --- ...
1
vote
0answers
27 views

execute-kbd-macro apparently not working according to its doc?

The doc of execute-kbd-macro says: (execute-kbd-macro MACRO &optional COUNT LOOPFUNC) ... If MACRO is a symbol, its function definition is used. I tried M-: (execute-kbd-macro 'ignore). ...
0
votes
0answers
11 views

iy-go-to-char breaking macros

I was trying to create a macro when I realized that the iy-go-to-char function has a strange problem. ;; Keyboard Macro Editor. Press C-c C-c to finish; press C-x k RET to cancel. ;; Original keys: ...
0
votes
1answer
18 views

Creating a macro to change dictionary and run ispell

I would like to create a simple key binding (e.g. C-c s e) to spell check the (mu4e) email message I am composing using English (and use other bindings for other languages). I thought I'd simply ...
0
votes
1answer
27 views

macro execution with i-search fails under Linux and succeeds under windows?

Imagine you've got file with FirstName|LastName| like this : John|toto| Hanz|titi| and want to put the first names at the end of the lines (just an stupid exemple). You may use Macro Recordind for ...
1
vote
0answers
28 views

After 0 kbd macro iterations: read-kbd-macro: Variable binding depth exceeds max-specpdl-size

Here my kbd macros in mycustom.el (fset 'keep-tv-channels-names (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([134217848 107 101 return 69 88 84 ...
0
votes
1answer
53 views

how to generate dynamic json data with emacs (macros)?

I was in a meeting yesterday where I was presenting a program that referenced a certain json file with data like this: [ { id: 1, text: '...', ... }, { id: 2, text: '...', ... } ] In ...
0
votes
0answers
9 views

Macro changes cursor position when it triggers scrolling

I have text consisting of several similar blocks as follows: aaaa bbbb aaaa #last line visible (A) bbbb #last line visible (B) aaaa bbbb ... The screen is 5 lines high. The cursor is at the very ...
3
votes
1answer
74 views

Binding a key sequence to a key sequence instead of a command

In my .emacs, I tried to use (global-set-key (kbd "M-r") (kbd "C-x r j") so I can use M-r to jump to a register. However, doing this and using the command gives After 0 kbd macro iterations: Args ...
4
votes
2answers
225 views

Inserting the plus minus unicode symbol ± as a keyboard macro

I insert the plus minus symbol ± frequently enough that I want to bind it to a key. From emacs -Q, I've tried this: (global-set-key (kbd "C-c m") "±") However, when I enter C-c m, the minibuffer ...
0
votes
1answer
39 views

What is wrong with this keyboard macro ?

I would like to accomplish following Set mark Advance to end of sentence Copy selection -> macro start here Open journal using ^c c Paste copied item Save using C-x C-s Exit using C-c C-c ...
1
vote
1answer
137 views

What is the difference between `C-i` and `<C-i>`?

I've just set (define-key input-decode-map "\C-i" [\C-i]) (define-key input-decode-map "\C-m" [\C-m]) (define-key input-decode-map "\C-[" [\C-\[]) in my config, but I noticed that C-i is now ...
0
votes
0answers
34 views

Apply vim macro to files in helm-ag result?

I am using spacemacs (using evil mode) and want to apply a vim macro (keyboard defined or otherwise) to the files resulting from a search in helm-ag. I'm thinking the easiest way would be to apply a ...
0
votes
2answers
132 views

How to deal with particular key-binding conflict (F3 key on Mac)

I would like to make a very basic macro on my Mac, to have a command that writes a list of slashes in the current file : //////////////////// The "Basic emacs macros" section of the manual says : ‘&...
0
votes
1answer
88 views

Hydra that executes interactive search

What I want is an easy-to-use hydra for macro execution. Typically I execute a keyboard macro a few times (e), and then might want to repeat infinitely until the end of a buffer (u). Sometimes I ...
3
votes
3answers
126 views

Keyboard macros or command for quick refiling using dired or similar

I scan all the mail (not email, but good ol' mail) I receive and have these saved as PDF files into a directory, which we think of as an inbox. I would like to find a workflow to quickly refile these ...
4
votes
4answers
277 views

Write `var0, var1, var2, …, var10` in a buffer

Most of the times there is no need to write manually many variables with the same name and a different index, like var0, var1, var2, var3, ..., var9 because one can use arrays, vectors or whatever ...
1
vote
1answer
38 views

Visualise keyboard macros (converting them to human readable key names)

I often find useful/nifty kmacros on the web, like (kmacro-exec-ring-item (quote ([return 3 16 14 5 return 21 3 46 return 24 98 return] 0 "%d")) arg). Being a curious guy I am, I usually want to know ...
1
vote
2answers
65 views

Writing a small elisp function

Could someone here write a small Elisp function for me? What I would like Emacs to do is the following: I have a region like this: [0.04579] [0.06569] [0.09507] [0.12696] [0.27929] [0....
0
votes
1answer
39 views

Wrap one line of text into a multiple line block

I have a very long line of text (8000 characters). I would like to format this nicely so it splits across multiple lines in a block. Where the line breaks occurs does not matter for this purpose. ...
0
votes
1answer
51 views

Keyboard macro get data from one buffer and put to another buffer

I use keyboard macros in one buffer like this: 'C-x (’ or <f3>– start defining a keyboard macro `C-x )’ or <f4>– stop defining the keyboard macro Nice. It's work fine. But I use macro in ...
1
vote
1answer
87 views

How can I stop keyboard-quit from ending macro definition?

When I am defining keyboard macro with kmacro-start-macro and I press C-g (for example to deactivate mark or I press it accidentally), macro definition is aborted and I have to start over. Is there ...
3
votes
1answer
163 views

Cua-mode and keyboard macros

I have just started using emacs, so I decided to use cua-mode. I got this weird problem when I'm using macros and copy/cut (C-c/ C-x). let's assume this simple macro for example: <F3> C-S-right ...
0
votes
1answer
131 views

How to insert/dump all keyboard macros at once?

Is there a way to show all keyboard macros (similar to insert-kbd-macro) without having to first name each macro? Using macros with evil-mode in case this makes a difference.
0
votes
1answer
136 views

Get Org Link Description From Table Column of Links

I have an org table and I want to take an existing column of org links of the form: [[http://blah.com/blah/blah/foo][foo]] And create an adjacent column containing only the description - i.e. foo. ...
0
votes
1answer
104 views

Run keyboard macro after open file?

Is it possible to run a keyboard macro in Emacs right after opening a file? For example, when I open a text file I want to get information in buffer Hello world.
2
votes
0answers
28 views

Keyboard macro with occur

In a keyboard macro, there is an occur command. While recording the macro, I switched to the occur window, did some editing, closed occur buffer reverted back to original buffer to continue editing. ...
5
votes
1answer
159 views

Editing a stored keyboard macro and storing the edited version

In my ~/.emacs, there are several keyboard macros stored. They appear as (fset 'dhteu-macro-name ... entries. BTW, dhteu is just a random alphabet combination prefixed to avoid collision with any ...
0
votes
2answers
78 views

Unable to supply macro name to edit-kbd-macro when M-x is bound to smex

When I M-x edit-kbd-macro, it prompts saying: Keyboard macro to edit (C-x e, M-x, C-h l, or keys): Here, I would hit M-x. It will then allow me to enter the name of the macro. I have several named ...
2
votes
1answer
55 views

Keyboard macro produces a series of numbers

I did some editing. Then went to C-x C-k l edited the stuff to suit my needs. Saved it with C-c C-c. Gave it a name with C-x C-k b. Finally, went to ~/.emacs and did M-x insert-kbd-macro To my ...
0
votes
0answers
21 views

Recording a keyboard macro with actual character strings

I could not better word the question. So, I have finalized a few M-x commands I want to execute on a buffer. I have also tried and tested a few regexps using C-M-% for search and replace. Now, I ...
3
votes
1answer
143 views

Process unread-command-events and redisplay

(defun pretend (keys) (dolist (e (reverse (listify-key-sequence (kbd keys)))) (push e unread-command-events) ;; (mystery-function) (redisplay t) (sleep-for 0.1))) (pretend "M-x my-...
5
votes
2answers
238 views

Keybinding for buffer word count

The following in my .emacs file does not produced the desired result of showing me the word count for the current buffer (it "does nothing"): (global-set-key (kbd "<f9>") (kbd "C-u M-=")) Is ...
0
votes
1answer
36 views

Search with locale on Microsoft Windows

I'm using Emacs on MS Windows and suddenly I noticed that when I press C-s (incremental search) the prompt shows I-search [NL]: which I presume is my locale. I still can search incrementally but I can'...
1
vote
1answer
105 views

Weird behavior when inserting parentheses in keyboard macro

In my init file, I have these bindings: (global-set-key (kbd "C-x S-SPC") (kbd ")")) (global-set-key (kbd "S-SPC") (kbd "(")) Now, starting with empty buffer, if I define this keyboard macro: S-SPC ...
3
votes
0answers
53 views

Replace formula by computed value

I'd like to select a simple formula like 17+5 and replace that by the computed result, 22 in this case. And I need this to work during keyboard macro execution, to quickly process large portions of my ...
2
votes
1answer
81 views

Inhibit redraw during keyboard macros?

In the good old days, repeated emacs keyboard macros ran without repainting the display until the end. Over the years this changed, and now it appears that the display is redrawn 100% of the time -- ...
1
vote
2answers
64 views

Removing preceding text from each line of a text [duplicate]

I am new to Emacs. I am reading a book on Python. The book has many code examples. What I would like to do is to convert this: 61. def getRandomWord(wordList): 62. # This function returns a ...
3
votes
3answers
446 views

Evil mode: How to run evil-indent on the text I've just pasted

When I copy line three below in evil-mode function foo() { } var bar; #copy and paste it at line two, I get function foo() { var bar; #paste } instead of the correctly indented function foo() { ...
2
votes
1answer
131 views

Repeat actions in slow motion, for presentation purposes

I would like to repeat actions (preferably as a keyboard macro, but I am open to other solutions), in some kind of automated, "slow motion". By "slow motion", I mean at a speed that is close to human ...
1
vote
1answer
109 views

How to use double keyboard macro, or keyboard macro of keyboard macro?

First of all, I made a new keyboard macro called 'mac'. [F3] abcd [F4] M-x name-last-kbd-macro mac Then, I can get 'abcd' by typing [F4] or M-x mac. I tried to get 'abcd' five times. So I ...
1
vote
2answers
137 views

How to simplify macro declaration?

Using kmacro-exec-ring-item, is it possible to wrap this in an elisp macro or function so its much less verbose? In this example the only unique part is ds( and the function name. (fset 'delete-...
0
votes
2answers
228 views

org-sparse-tree on multiple keywords

I currently have a keyboard shortcut bound to C-c t that shows me all of the NEXTACTION items I have, no matter what headline level they're at. It works by using a kbd macro wherein I just typed C-c / ...
0
votes
1answer
140 views

Custom search function for dictionary lookup

I have a plain text dictionary in which each headword is matched by ^# \(† \)?headword, How can I make a custom search function that relieves me of typing the whole regex every time I want to look ...
6
votes
2answers
185 views

Key bound to string does not handle some chars in string correctly

(I ask this question after reading this one.) The form (global-set-key (kbd "M-e") "e") is, as far as I can tell, equivalent to (global-set-key (kbd "M-e") (lambda () (interactive) (insert "e"))) ...