Difference between revisions of "Keyboard macros"

From WikEmacs
Jump to navigation Jump to search
(Favorite on line clothing shop,Presents fashion forward clothes,Trends released clothing solutions for sale)
m (Protected "Keyboard macros" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite)))
 
(60 intermediate revisions by 23 users not shown)
Line 1: Line 1:
Chen  Sai  Cheng  and Tong Liyas wedding has grow to be the focus of the entertainment. One because "Beijing like story" The series and bursts of young directors, a surge in recognition could be the first-line actress (2013 Forbes list of Chinese celebrities ranked 79th), one time two in the wedding dress photo mountains and plains. When Sohu news side, the reader tucao Yang Mi and Tong Liya that are more shaped dress, no one realized that behind the celebrity wedding with the tremendous brand industry. Advanced customization and celebrity has been the ideal mode of inter-communication, the  Chen  Sai  Cheng  dress brand endorsements is "according towards the text," the organization within a highly clever way of advertising and marketing, is wanting to overturn the classic innovation. The past five years, the rise of custom brand mushroomed in China. 2013, Chinas luxury industry continues to decline disappear, analysts attributed component in the austerity spending public funds, alternatively, Chinese buyers are tired in the monotony of luxury brands, started to emphasize the "light luxury", emphasizing a lot more customized design, these changes in customer demand, giving Chinese design and style custom brand with very good upside. By way of example, that is Chen Sicheng custom clothing brand, "according for the text." By Wen Hua Xia founder, in 1994 founded the provider in ten years time, in accordance with the text will be expanded into a business with significantly more than 500 retailers, nearly the size of a number of billion yuan in annual sales. Previously couple of years, the firm is Ma, Pan Shiyi, Yao Jinbo, Wang Chao Yong, Wang Fei and other entrepreneurs custom dress, efforts to expand the high-end company market. Regardless of the scale of Chinese business enterprise many people spending continues to rise, but Chinas high-end apparel industry in the past five years, not devoid of pressure. On the a single hand, retailer rents a second-tier citys shopping plaza soaring, which means continued higher expense of sales, alternatively the effect in the World wide web purchasing mall, but in addition the effect in the high-end clothing brand sales. Previously, I worked with a counselor talked about this topic, no matter whether high-end clothes brand might be the influence on the Net. My answer is, the effect is currently inevitable. But perhaps the mobile World wide web towards the conventional brand glimmer opportunities. This really is what I have located the explanation ASAT could possibly lead to a modify in mens fashion retail. The face of the impact on the Web, in accordance with the text did not go for the mobile World wide web start-up a brand new brand, however the continuation of a boutique retail model. ASAT hiring dozens of designer garments, fabrics and provide goods by means of customized way. Based on the text does not come by way of the provision of clothes consulting fees, simply to get profits through retail. But interestingly, they provide a range of clothing to purchase solutions. In my opinion, these options for enterprise individuals, the much more the right path. ASAT realize that in an era of ferocious effect from the Online, delivering the all round service than supplying a single item additional desirable clothing. In line with the text adopted by micro-channel service variety of strategies to make client base, every single costume consultant is responsible for about 30 micro-channel customer support, this can be a lot more intimate consumer relationships, but in addition a additional direct incentive model. A paper by the competent once described to me a scene like this, once you see a style inside a magazine or street clothing, send photographs straight to micro signal costume consultant, the consultant will promptly offered the proper feedback. Even more importantly, style consultants have the shoppers body size data, hobby shopping habits and previous records, and thus immediately shoppers will receive customized as outlined by the text sent clothing. This eliminates the cost of customer service and also asks me, and for a lot of males, the opening to ask irrespective of whether this dress for me, might be mentioned to be an incredibly laborious issue to worry about. Another advantage of this service is that infinite space and time "high efficiency", which means you could have a 24 hours on line clothing consultant, mobile World wide web make this issue turn out to be much less "arrogant", taking into account privacy and efficiency. One more advantage of getting costume consultant is the fact that they'll present "cloud wardrobe" function many cities. In other words, business trip, they can at all times sent you an ironing garments in effective situation to meet contingencies. This is in accordance with the text behind numerous stores and service technique as a help. Maybe this will likely validate one of my anticipation, the mobile Internet will become a conventional corporate counterattack TAB weapon. As a recent Forbes report columnist Miss Jiang Meilan "traditional retailing: adapt to adjust, or turn into someone elses knowledge shop?" Stated, "the path of regular retailing efforts ought to be: How can shoppers are prepared to remain inside your in-store encounter, and in some cases prepared to shop directly in single or go to the following a single within your shop and after that get pleasure from a number of handy you give integrated solutions even though you happen to be still actively encouraging consumers willing to take the initiative to share. Do not overlook, this is a self-media era, sharing is king. "subversive innovation in accordance with the text that they would conventional shop into a" customized services "competitive benefit, when in turn the traditional high-end sales service and" micro-channel service "clever docking, forming a closed-loop sales. In my opinion, or  Hu  Yin  Tai  department or Wanda ought to give consideration to the acquisition of numerous such standard multi-brand, possibly this will likely bring new opportunities for the industrial real estate?
+
{{Manual|emacs|Basic-Keyboard-Macro|Basic Keyboard Macro}}
 +
 
 +
'''Keyboard macros''' can be used to automate or repeat tedious editing tasks in Emacs.
 +
 
 +
 
 +
==Basic Use==
 +
 
 +
; {{Keys|F3}}, or {{Keys|C-x (}}
 +
: Start defining a macro.
 +
; {{Keys|F4}}, or {{Keys|C-x )}}
 +
: Stop defining a macro.
 +
; {{Keys|F4}}, or {{Keys|C-x e}}
 +
: Execute a macro
 +
; {{Keys|C-u 37 C-x e}} or {{Keys|C-u 37 F4}}
 +
: Execute a macro multiple times, using [[prefix argument]]
 +
; {{Keys|C-u 0 C-x e}}
 +
: Execute a macro until the end of the buffer
 +
 
 +
==Example usage==
 +
 
 +
Consider the standard <code>*scratch*</code> buffer:
 +
 
 +
<pre>
 +
;; This buffer is for notes you don't want to save, and for Lisp evaluation.
 +
;; If you want to create a file, visit that file with C-x C-f,
 +
;; then enter the text in that file's own buffer.
 +
</pre>
 +
 
 +
Suppose you want to remove the first occurrence of the letter "a" 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.
 +
 
 +
# Make sure [[point]] is at the start of the buffer.
 +
# Hit <code>C-x (</code> to start recording your macro. '''Note:''' If you hit <code>C-g</code> or if an error occurs, your keyboard macro recording will stop.
 +
# Hit <code>C-s</code> followed by <code>a</code> to find the first "a". Now, point is right after the first "a" in the text.
 +
# Hit backspace to delete that "a".
 +
 
 +
The first occurrence of "a" of the first line has been deleted. Let's move point to the beginning of the next line and then stop recording.
 +
 
 +
<ol start="5">
 +
<li>Hit <code>C-e C-f</code> to move point to the beginning of the next line.</li>
 +
<li>Hit <code>C-x )</code> to finish the recording of our macro.</li>
 +
</ol>
 +
 
 +
The macro you have just recorded performs the operation of removing the first occurrence of "a" it can find and then moving point to the next line.
 +
 
 +
<ol start="7">
 +
<li>Hit <code>C-x e</code> once to call that macro.</li>
 +
<li>Continue hitting <code>e</code> to call it several times. Hit any other key to get out of the macro repetition.</li>
 +
</ol>
 +
 
 +
== Naming and saving macros ==
 +
 
 +
You can:
 +
* give a name to the most recently defined macro (<code>C-x C-k n</code>)
 +
* bind it to a key sequence (<code>C-x C-k b</code>)
 +
* insert it in the current buffer as lisp code (<code>M-x insert-kbd-macro</code>).
 +
 
 +
{{Manual|emacs|Save-Keyboard-Macro|Save Keyboard Macro}}
 +
 
 +
 
 +
To bind a keyboard macro to a key use <code>C-x C-k b</code>. To avoid problems caused by overriding existing bindings, the key sequences <code>C-x C-k 0</code> through <code>C-x C-k 9</code> and <code>C-x C-k A</code> through <code>C-x C-k Z</code> are reserved for your own keyboard macro bindings.  You can, however, bind a keyboard macro to whatever you like.
 +
 
 +
==Variables==
 +
 
 +
Variables can be stored in lisp or in [[registers]].  Here's an example using lisp:
 +
 
 +
<pre>
 +
[M-: (setq x 1)]
 +
<F3>
 +
Line number [C-u M-: x]
 +
[M-: (setq x (+ x 1))]
 +
<F4>
 +
</pre>
 +
 
 +
Now execute the macro four times with the command <code>C-x e e e e</code> and you get:
 +
 
 +
line number 1<br />
 +
line number 2<br />
 +
line number 3<br />
 +
line number 4
 +
 
 +
 
 +
= See also =
 +
 
 +
* [https://github.com/Silex/elmacro elmacro], to show keyboard macros as emacs-lisp
 +
* [https://github.com/abo-abo/centimacro centimacro] to (temporarily) bind any number of macros to any global shortcuts.
 +
* You can use keyboard macros à la vim in [[evil]].
 +
 
 +
 
 +
[[Category:Intermediate]]
 +
[[Category:Editing]]

Latest revision as of 15:27, 4 July 2016

Basic Keyboard Macro (`(info "(emacs) Basic Keyboard Macro")')

Keyboard macros can be used to automate or repeat tedious editing tasks in Emacs.


Basic Use

[F3], or [C-x (]
Start defining a macro.
[F4], or [C-x )]
Stop defining a macro.
[F4], or [C-x e]
Execute a macro
[C-u 37 C-x e] or [C-u 37 F4]
Execute a macro multiple times, using prefix argument
[C-u 0 C-x e]
Execute a macro until the end of the buffer

Example usage

Consider the standard *scratch* buffer:

;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.

Suppose you want to remove the first occurrence of the letter "a" 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.

  1. Make sure point is at the start of the buffer.
  2. Hit C-x ( to start recording your macro. Note: If you hit C-g or if an error occurs, your keyboard macro recording will stop.
  3. Hit C-s followed by a to find the first "a". Now, point is right after the first "a" in the text.
  4. Hit backspace to delete that "a".

The first occurrence of "a" of the first line has been deleted. Let's move point to the beginning of the next line and then stop recording.

  1. Hit C-e C-f to move point to the beginning of the next line.
  2. Hit C-x ) to finish the recording of our macro.

The macro you have just recorded performs the operation of removing the first occurrence of "a" it can find and then moving point to the next line.

  1. Hit C-x e once to call that macro.
  2. Continue hitting e to call it several times. Hit any other key to get out of the macro repetition.

Naming and saving macros

You can:

  • give a name to the most recently defined macro (C-x C-k n)
  • bind it to a key sequence (C-x C-k b)
  • insert it in the current buffer as lisp code (M-x insert-kbd-macro).

Save Keyboard Macro (`(info "(emacs) Save Keyboard Macro")')


To bind a keyboard macro to a key use C-x C-k b. To avoid problems caused by overriding existing bindings, the key sequences C-x C-k 0 through C-x C-k 9 and C-x C-k A through C-x C-k Z are reserved for your own keyboard macro bindings. You can, however, bind a keyboard macro to whatever you like.

Variables

Variables can be stored in lisp or in registers. Here's an example using lisp:

[M-: (setq x 1)]
<F3>
Line number [C-u M-: x]
[M-: (setq x (+ x 1))]
<F4>

Now execute the macro four times with the command C-x e e e e and you get:

line number 1
line number 2
line number 3
line number 4


See also

  • elmacro, to show keyboard macros as emacs-lisp
  • centimacro to (temporarily) bind any number of macros to any global shortcuts.
  • You can use keyboard macros à la vim in evil.