Permalink
Browse files

hmmm, github's ruby-org not making anything of my code blocks

  • Loading branch information...
1 parent 78a2d45 commit 88be8c03c6be6504c5d0f7422dc29aa22f5d6f2e @joaotavora committed Apr 29, 2012
Showing with 16 additions and 16 deletions.
  1. +16 −16 README.org
View
@@ -16,11 +16,11 @@ should work even with extensions that redefine such keys.
To try it out, download the [[http://autopair.googlecode.com/git/autopair.el][latest version]] and add to your *.emacs*:
- #+begin_example
+ #+begin_src
(add-to-list 'load-path "/path/to/autopair") ;; comment if autopair.el is in standard load path
(require 'autopair)
(autopair-global-mode) ;; enable autopair in all buffers
- #+end_example
+ #+end_src
* Rationale
@@ -59,26 +59,26 @@ should work even with extensions that redefine such keys.
of buffers, comment out the `autopair-global-mode` and turn on
`autopair-mode` in some major-mode hook, like:
- #+begin_example
+ #+BEGIN_EXAMPLE
;; use autopair just in c buffers
(add-hook 'c-mode-common-hook
#'(lambda () (autopair-mode)))
- #+end_example
+ #+END_EXAMPLE
Alternatively, do use `autopair-global-mode` and create _exceptions_
using the major mode hooks (watch out for the change in behaviour
emacs 24).
- #+begin_example
+ #+BEGIN_EXAMPLE
;; use autopair everywhere but c buffers
(add-hook 'c-mode-common-hook
#'(lambda ()
(setq autopair-dont-activate t) ;; for emacsen < 24
(autopair-mode -1)) ;; for emacsen >= 24
)
- #+end_example
+ #+END_EXAMPLE
* More tricks
@@ -91,26 +91,26 @@ should work even with extensions that redefine such keys.
character from being autopaired in C++ comments use this in your
.emacs.
- #+begin_example
+ #+BEGIN_EXAMPLE
(add-hook 'c++-mode-hook
#'(lambda ()
(push ?
(getf autopair-dont-pair :comment))))
- #+end_example
+ #+END_EXAMPLE
*=autopair-handle-action-fns=* lets you write some emacs-lisp that
overrides/extends the actions taken by autopair after it decides
something must be paired, skipped or deleted. To work with triple
quoting in python mode, you can use this for example:
- #+begin_example
+ #+BEGIN_EXAMPLE
(add-hook 'python-mode-hook
#'(lambda ()
(setq autopair-handle-action-fns
(list #'autopair-default-handle-action
#'autopair-python-triple-quote-action))))
- #+end_example
+ #+END_EXAMPLE
where =autopair-python-triple-quote-action= is an example of a
user-written function (which is bundled in autopair.el).
@@ -123,24 +123,24 @@ should work even with extensions that redefine such keys.
balancing at all. To have =<= and =>= pair in c++-mode buffers, but
only in code, use:
- #+begin_example
+ #+BEGIN_EXAMPLE
(add-hook 'c++-mode-hook
#'(lambda ()
(push '(?< . ?>)
(getf autopair-extra-pairs :code))))
- #+end_example
+ #+END_EXAMPLE
if you program in emacs-lisp you might also like the following to
pair backtick (*`*) and quote (*'*).
- #+begin_example
+ #+BEGIN_EXAMPLE
(add-hook 'emacs-lisp-mode-hook
#'(lambda ()
(push '(?` . ?')
(getf autopair-extra-pairs :comment))
(push '(?` . ?')
(getf autopair-extra-pairs :string))))
- #+end_example
+ #+END_EXAMPLE
* Workarounds
@@ -169,7 +169,7 @@ should work even with extensions that redefine such keys.
autopaired/autoskipped in all situations; the decision to autopair
or autoskip a brace is taken according to the following table:
- #+begin_example
+ #+BEGIN_EXAMPLE
+---------+------------+-----------+-------------------+
| 1234567 | autopair? | autoskip? | notes |
+---------+------------+-----------+-------------------+
@@ -179,7 +179,7 @@ should work even with extensions that redefine such keys.
+---------+------------+-----------+-------------------+
| ((()) | yyyyyyy | ------- | too many openings |
+---------+------------+-----------+-------------------+
- #+end_example
+ #+END_EXAMPLE
The table is read like this: in a buffer with 7 characters laid out
like the first column, an "y" marks points where an opening brace is

0 comments on commit 88be8c0

Please sign in to comment.