Difference between revisions of "Skeleton"

From WikEmacs
Jump to: navigation, search
(Skeleton: Fix typo)
Line 2: Line 2:
 
templates.
 
templates.
  
= Common Customization =
+
= Keep some chars always balanced =
  
 
Use the below setting to insert paired characters with just a single
 
Use the below setting to insert paired characters with just a single
keystroke. For example, typing ''''('''' will automatically insert
+
keystroke.  
''''()'''' in to the buffer. Similarly typing ''''{'''' will
+
 
automatically insert ''''{}''''. This setting is quite useful if you
+
For example, typing ''''('''' will automatically insert ''''()'''' in
are editing [[Emacs Lisp]], [[C]] etc.
+
to the buffer. Similarly typing ''''{'''' will automatically insert
 +
''''{}''''. This way parenthesis, quotes etc will always remain
 +
balanced. This setting is quite useful if you are editing
 +
[[Emacs Lisp]], [[C]] etc.
  
 
<source lang="lisp">
 
<source lang="lisp">

Revision as of 10:06, 28 March 2012

Skeleton library can be used to create documents based on templates.

Keep some chars always balanced

Use the below setting to insert paired characters with just a single keystroke.

For example, typing '(' will automatically insert '()' in to the buffer. Similarly typing '{' will automatically insert '{}'. This way parenthesis, quotes etc will always remain balanced. This setting is quite useful if you are editing Emacs Lisp, C etc.

(require 'skeleton)
(setq skeleton-pair t)
(global-set-key "\"" 'skeleton-pair-insert-maybe)
(global-set-key "(" 'skeleton-pair-insert-maybe)
(global-set-key "[" 'skeleton-pair-insert-maybe)
(global-set-key "{" 'skeleton-pair-insert-maybe)