Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
24 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
11 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
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
53 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
140 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
31 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
123 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
24 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
86 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
62 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
97 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 ...
1
vote
1answer
34 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
59 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
37 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
41 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
61 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
133 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
118 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
114 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
87 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
26 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
120 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
68 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
54 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
132 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
217 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
35 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
94 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 ...
2
votes
0answers
45 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
68 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
59 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 ...
2
votes
3answers
360 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
112 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
104 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
116 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
212 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
130 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
182 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"))) ...
0
votes
2answers
326 views

Setting key problem: save and close just like vim

I'm trying to use global-set-key to bind commands ":x" as save and close, just like the way vim do. Right now I'm doing: (global-set-key (kbd "S-; x") (lambda() (kbd "C-x C-s") (kill-emacs))) But ...
0
votes
1answer
922 views

How to change keyboard shortcuts for copy, cut and paste and set keyboard shortcut for debugger (GDB)?

I would like to set the following keyboard shortcuts: Copy (selected text): C-c Cut (selected text): C-x Paste from clipboard: C-v Debugger (GDB): M-g Now I realize that to do this I merely need the ...
1
vote
0answers
92 views

key-chord not working with kmacro

When trying to define a macro in emacs and trying to expand key-chord in process its not working - its simply inputs letters instead. I saw explanation of this in key-chord.el but is there any ...
1
vote
2answers
1k views

Configuring multiple key bindings

I would like to bind M-S-up to C-u 7 S-up to move a timestamp a week forward (and down for back). A modification of this answer resulted in a "Symbol is void" error in Emacs. I tried modifying the ...
1
vote
3answers
623 views

How to delete all instances of a character in a bunch of files?

I was given a directory of files in which I was asked to make some systematic changes. Because it was a one-off task, and because there were only a few hundred files I thought I'd use an Emacs ...
1
vote
1answer
160 views

Transform selected text like a Python macro

I've only just started with Emacs (about 6 weeks now) so I'm not really familiar with its coding language. I was wondering if it was possible to write, for Emacs, the equivalent of a Python macro I ...
5
votes
2answers
605 views

Incrementing characters in Emacs, next to numbers?

You can place a pointer on a number, like 1, and increment it to 2. There are many alternatives on this. See also the Emacs Wiki: https://www.emacswiki.org/emacs/IncrementNumber 7 alternatives to ...
10
votes
2answers
305 views

What might be unused keys on Emacs that generally can be used to bind keyboard macros?

I read that the usual way to bind key to keyboard macros are C-x C-k 0 to 9 and A to Z. So for example, after we define a keyboard macro, we can type C-x C-k b and Emacs will ask for a key to bind. ...
3
votes
2answers
410 views

Org-mode: any keyboard shortcut for Latex code?

On p.33 of the Org-guide Carsten Dominek writes you can use #+LATEX: and #+BEGIN_LATEX ... #+END_LATEX construct to add verbatim LATEX code Is there a keyboard combination or default snippet that ...
0
votes
1answer
43 views

Repeat typed characters before a space

Using Emacs with Evil Mode, I wonder if there's a way to quickly re-enter all the characters that were typed before a whitespace character is entered. Example: you type \hat{\beta}_{OLS,j} and then ...
0
votes
2answers
27 views

How to run a macro in a buffer that would take an argument?

If I want, for example, add all numbers in a line with a keyboard macro, how can I do it? It would add: 1 1 34 53 into: 89. Or, given a word: asdf transform it into fdsa I know how to define the ...