Difference between revisions of "Keyboard macros"

From WikEmacs
Jump to navigation Jump to search
(Woolrich world brand, Low-cost Woolrich Sale, decide to buy Woolrich Coat new types Huge Discount)
m (Protected "Keyboard macros" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite)))
 
(152 intermediate revisions by 54 users not shown)
Line 1: Line 1:
Thai Industrial Park Management Committee chairman, said lately that SMEs in Thailand has improved to two.7 million, the total variety of enterprises in the proportion as high as 99.76%. Taking into account SMEs in creating jobs, universal labor abilities to make value-added items, exports, import substitution merchandise along with other fields are playing an increasingly significant function, Thai Industrial Park Management Committee plans to establish a dedicated SME Industrial Park, may be the growth of SMEs to establish a marketplace development model, when supporting the growth of SMEs to boost their competitiveness at dwelling and abroad. Thailand features a unique benefit for SMEs Industrial Park Management Committee believes that compared with significant enterprises, modest and medium enterprises with investment price is small, management will not be complicated, along with other positive aspects, it may be flexible operation, management and development, can be a great deal more versatile to adjust towards the economic predicament . Thai Industrial Park Authority decided to market inside the central, northern and northeastern aspect on the establishment of an industrial park for SMEs, will likely be distributed towards the economic income of all regions, reducing the concentration of enterprises inside the Bangkok location dense degree of SME industrial park is expected to attract over 1,500 SME presence. SME industrial park shall be divided into manufacturing, high-tech industries, agriculture and agro-processing industries, creative economy, foreign trade, solutions, tourism, entertainment, retail and wholesale trade as well as other 23 regions, intended to establish infrastructures adaptation, a combination of aspects balance a higher degree of development of the marketplace mechanism, the park may also be taken to cut down charges, eliminating the five years just before the park management charge and a one-stop service centers along with other measures to assist SMEs to encourage admission. Yunnan Academy of Social Sciences researcher Zhao Shu Lan said that the Thai building SMEs SME park in Yunnan "going out" is known as a high-quality chance to recommend Yunnan relatively open investment solutions in to the industrial zone, in principle, be significantly more profitable. Chinese investors also think that Thailand is quite appropriate as an export solution base, the existing Board of Investment of Thailand are seeking for programs to promote smaller and medium enterprises to invest in neighboring nations, which include Indonesia, Vietnam, Myanmar, India, Cambodia and Bangladesh, Chinese agencies can take the chance. " Walking curve "into the Southeast Asian, South Asian nations, in order that items and solutions possess a broader marketplace. Yunnan relevant agencies accountable person mentioned, in Yunnan Province, the implementation of "going out" approach below the new predicament, to assistance smaller and medium enterprises "going out" is definitely an beneficial duty from the relevant government departments. Presently, you're able to concentrate on the following aspects: to progressively establish and strengthen the Yunnan SME help systems and social service system, strengthen government guidance, arranging, coordination and help other elements with the functional role. Establishment of a multi-level technique of social service organizations for SMEs, including specialized solutions for the SME Technologies Innovation diverse intermediary organizations, industry associations, etc., encourage the creation of a range of consulting firms, information and facts corporation, engaged in technical exchanges and transfer on the corporation, to form a full SMEs social service networks. Establishment of Yunnan SME innovation network service program for SMEs to supply technical services, creating it applicable technologies foster SME incubator. Constructive development of multi-agent, multi-level, multi-form vocational training program to improve service principal service capabilities. Enhanced services marketplace method, the establishment of service marketplace mechanisms to improve the high-quality of solutions for SMEs. "Financing" to some extent constrain improvement "SME loans, one can find financing stress, to some extent restricted its improvement. Apart from, the foreign export tax of instability, with import and export operation rights of return of funds for SMEs possess a certain influence, and further interfere using the regular production and operation of enterprises and export of which can be that countless enterprises "going out" is facing troubles. "Yunnan overseas department of a bank official said. The person in charge of overseas investment for SMEs proposed to improve the economic institution, by way of a number of types of internationalization of SMEs to successfully resolve the financing troubles arising in the operation problems, for instance helping to meet the circumstances for Chinese SMEs - ASEAN Investment Fund, the SME international industry improvement funds, overseas processing and assembly operations and long-term RMB loans and foreign exchange turnover discount loans, commercial loans and foreign contracted projects and discount. Meanwhile, the really need to give complete play to export credit insurance (rest assured Paul) the function of credit assure institutions for SMEs to provide the needed export credit guarantees to help SMEs to avoid export dangers. Furthermore, enterprises should certainly also concentrate on overseas investment coaching, organization of various varieties of home business communication ASEAN market investment encounter. In recent years, Yunnan Province, the relevant government departments to ease the troublesome problem of corporate finance government established a special silver, bank and joint mechanisms and timely info about economic functionality and industrial policies, and actively coordinate all commercial banks to strengthen and revolutionary credit solutions so that you can facilitate much more potential, decent prospects for non-public, smaller and medium enterprises to get loans. Silver government, bank and Co will go through a whole lot of analysis, in accordance with credit rating at A-level or way more, collateral loans, there is certainly a marketplace, you will find benefits, aid to improve employment principles, filter out countless agencies suggest towards the bank, to come to be bank-enterprise communication bridge. Meanwhile, relevant departments to encourage qualified enterprises, corporations and private capital funded the establishment of commercial guarantee institutions and mutual credit guarantee institutions for SMEs to carry out numerous varieties of financing secured loans, a move to bring the gospel to the majority of small and medium enterprises. It can be essential to build an information exchange platform ZHAO Shu Lan, SMEs must setup trade associations, consulting firms as a enterprise platform, to understand ourselves in order to genuinely promote the development of Chinese SMEs in Thailand. Currently, the industry for SMEs lack of customized solutions, technology, marketing, training, consulting, material along with other services as the primary social service facilities to be improved. Numerous claimed to SMEs as a target to enhance the lot of the knowledge website statistics, which may very well make a great deal more sense for industry researchers, but fairly few individuals want to give tiny and medium enterprises inside the international market place trend merchandise specific details in numerous nations and What regions desire the item material, policies and regulations material. Hence, creating a platform for the exchange of information is needed for SMEs. Info exchange platform for SMEs to broaden channels for the flow of facts, market the complete knowledge technologies for SMEs, enabling enterprises to keep abreast of market trends, new item study and development to adapt to the wants of wealthy item mix, market their steadily open the domestic market place. Additionally, she suggested that the relevant departments at all levels of government, the media step up publicity efforts to enhance our SMEs and their famous solution within the domestic and international visibility, boost brand awareness, and steadily the dominant business larger and
+
{{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.