<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikemacs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=134.134.137.75</id>
	<title>WikEmacs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wikemacs.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=134.134.137.75"/>
	<link rel="alternate" type="text/html" href="https://wikemacs.org/wiki/Special:Contributions/134.134.137.75"/>
	<updated>2026-04-07T14:09:17Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wikemacs.org/index.php?title=Keyboard_macros&amp;diff=4672</id>
		<title>Keyboard macros</title>
		<link rel="alternate" type="text/html" href="https://wikemacs.org/index.php?title=Keyboard_macros&amp;diff=4672"/>
		<updated>2013-06-17T09:13:54Z</updated>

		<summary type="html">&lt;p&gt;134.134.137.75: Undo revision 4664 by 190.42.27.159 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Manual|emacs|Basic-Keyboard-Macro|Basic Keyboard Macro}}&lt;br /&gt;
&lt;br /&gt;
'''Keyboard macros''' can be used to automate or repeat tedious editing tasks in Emacs.&lt;br /&gt;
&lt;br /&gt;
==Example usage==&lt;br /&gt;
Consider the standard &amp;lt;code&amp;gt;*scratch*&amp;lt;/code&amp;gt; buffer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;; This buffer is for notes you don't want to save, and for Lisp evaluation.&lt;br /&gt;
;; If you want to create a file, visit that file with C-x C-f,&lt;br /&gt;
;; then enter the text in that file's own buffer.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Suppose you want to remove the first occurrence of the letter &amp;quot;a&amp;quot; on every row in that piece of text. You could write a [[regular expression]] to do the job, but let's assume you want to use a keyboard macro this time.&lt;br /&gt;
&lt;br /&gt;
# Make sure [[point]] is at the start of the buffer.&lt;br /&gt;
# Hit &amp;lt;code&amp;gt;C-x (&amp;lt;/code&amp;gt; to start recording your macro. '''Note:''' If you hit &amp;lt;code&amp;gt;C-g&amp;lt;/code&amp;gt; or if an error occurs, your keyboard macro recording will stop.&lt;br /&gt;
# Hit &amp;lt;code&amp;gt;C-s&amp;lt;/code&amp;gt; followed by &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; to find the first &amp;quot;a&amp;quot;. Now, point is right after the first &amp;quot;a&amp;quot; in the text.&lt;br /&gt;
# Hit backspace to delete that &amp;quot;a&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The first occurrence of &amp;quot;a&amp;quot; of the first line has been deleted. Let's move point to the beginning of the next line and then stop recording.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol start=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Hit &amp;lt;code&amp;gt;C-e C-f&amp;lt;/code&amp;gt; to move point to the beginning of the next line.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Hit &amp;lt;code&amp;gt;C-x )&amp;lt;/code&amp;gt; to finish the recording of our macro.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The macro you have just recorded performs the operation of removing the first occurrence of &amp;quot;a&amp;quot; it can find and then moving point to the next line.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol start=&amp;quot;7&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Hit &amp;lt;code&amp;gt;C-x e&amp;lt;/code&amp;gt; once to call that macro.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Continue hitting &amp;lt;code&amp;gt;e&amp;lt;/code&amp;gt; to call it several times. Hit any other key to get out of the macro repetition.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Saving macros==&lt;br /&gt;
{{Manual|emacs|Save-Keyboard-Macro|Save Keyboard Macro}}&lt;br /&gt;
&lt;br /&gt;
===Binding to a key===&lt;br /&gt;
To bind a keyboard macro to a key use &amp;lt;code&amp;gt;C-x C-k b&amp;lt;/code&amp;gt;.  To avoid problems caused by overriding existing bindings, the key sequences &amp;lt;code&amp;gt;C-x C-k 0&amp;lt;/code&amp;gt; through &amp;lt;code&amp;gt;C-x C-k 9&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;C-x C-k A&amp;lt;/code&amp;gt; through &amp;lt;code&amp;gt;C-x C-k Z&amp;lt;/code&amp;gt; are reserved for your own keyboard macro bindings.  You can, however, bind a keyboard macro to whatever you like.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
&lt;br /&gt;
Variables can be stored in lisp or in [[registers]].  Here's an example using lisp:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[M-: (setq x 1)]&lt;br /&gt;
&amp;lt;F3&amp;gt;&lt;br /&gt;
Line number [C-u M-: x]&lt;br /&gt;
[M-: (setq x (+ x 1))]&lt;br /&gt;
&amp;lt;F4&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now execute the macro four times with the command &amp;lt;code&amp;gt;C-x e e e e&amp;lt;/code&amp;gt; and you get:&lt;br /&gt;
&lt;br /&gt;
line number 1&amp;lt;br /&amp;gt;&lt;br /&gt;
line number 2&amp;lt;br /&amp;gt;&lt;br /&gt;
line number 3&amp;lt;br /&amp;gt;&lt;br /&gt;
line number 4&lt;/div&gt;</summary>
		<author><name>134.134.137.75</name></author>
	</entry>
	<entry>
		<id>https://wikemacs.org/index.php?title=Keyboard_macros&amp;diff=4671</id>
		<title>Keyboard macros</title>
		<link rel="alternate" type="text/html" href="https://wikemacs.org/index.php?title=Keyboard_macros&amp;diff=4671"/>
		<updated>2013-06-17T09:13:05Z</updated>

		<summary type="html">&lt;p&gt;134.134.137.75: Undo revision 4669 by 91.237.249.29 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;PVC PVC almost categories. formulations bags sheep, leather. from generally scraps leather leather, and cortex pig to of PVC, after recycled leather of chemicals skin. leather price because protection animals, poor. second floor small to countries Second animal is by variety, PU, bag leather to layer, use commonly is is is PU, in part and to thickness first of or&lt;/div&gt;</summary>
		<author><name>134.134.137.75</name></author>
	</entry>
	<entry>
		<id>https://wikemacs.org/index.php?title=Smex&amp;diff=4656</id>
		<title>Smex</title>
		<link rel="alternate" type="text/html" href="https://wikemacs.org/index.php?title=Smex&amp;diff=4656"/>
		<updated>2013-06-14T09:27:56Z</updated>

		<summary type="html">&lt;p&gt;134.134.137.75: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Smex is a M-x enhancement''' for Emacs. Built on top of [[Ido]], it provides a convenient interface to your recently and most frequently used commands. And to all the other commands, too.&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
&lt;br /&gt;
Download via [[package.el]], [[el-get]] or [http://github.com/nonsequitur/smex/blob/master/smex.el?raw=true the sources] and set-up your load-path.&lt;br /&gt;
&lt;br /&gt;
You are now ready to call {{Command|smex}}. The commands are displayed in an Ido completion buffer, ordered by relevance. The 7 most recently executed commands come first, the rest are sorted by frequency of use, command length and in alphabetical order.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Configuration = &lt;br /&gt;
&lt;br /&gt;
To auto-start Smex every time you open Emacs add these lines to your .emacs file:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lisp&amp;quot;&amp;gt;&lt;br /&gt;
(require 'smex) ; Not needed if you use package.el&lt;br /&gt;
(smex-initialize) ; Can be omitted. This might cause a (minimal) delay&lt;br /&gt;
                  ; when Smex is auto-initialized on its first run.&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Bind some keys:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lisp&amp;quot;&amp;gt;&lt;br /&gt;
(global-set-key (kbd &amp;quot;M-x&amp;quot;) 'smex)&lt;br /&gt;
(global-set-key (kbd &amp;quot;M-X&amp;quot;) 'smex-major-mode-commands)&lt;br /&gt;
;; This is your old M-x.&lt;br /&gt;
(global-set-key (kbd &amp;quot;C-c C-c M-x&amp;quot;) 'execute-extended-command)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Delayed Initiation ==&lt;br /&gt;
&lt;br /&gt;
Use the following code to make emacs startup a little faster. This delays initializing smex until it’s needed. Just have smex call ‘smex-initialize’ when it’s needed instead of having the user do it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;lisp&amp;quot;&amp;gt;&lt;br /&gt;
(global-set-key [(meta x)] &lt;br /&gt;
  (lambda () &lt;br /&gt;
    (interactive) &lt;br /&gt;
    (or (boundp 'smex-cache) &lt;br /&gt;
        (smex-initialize)) &lt;br /&gt;
    (global-set-key [(meta x)] 'smex) (smex))) &lt;br /&gt;
&lt;br /&gt;
(global-set-key [(shift meta x)] &lt;br /&gt;
  (lambda () (interactive) &lt;br /&gt;
  (or (boundp 'smex-cache) (smex-initialize)) &lt;br /&gt;
  (global-set-key [(shift meta x)] 'smex-major-mode-commands) &lt;br /&gt;
  (smex-major-mode-commands)))&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Learn more =&lt;br /&gt;
&lt;br /&gt;
The documentation is on github: https://github.com/nonsequitur/smex/blob/master/README.markdown&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Convenience]]&lt;br /&gt;
[[Category:Completion]]&lt;br /&gt;
[[Category:Third Party Package]]&lt;/div&gt;</summary>
		<author><name>134.134.137.75</name></author>
	</entry>
</feed>