BACKGROUND:
I have started to use emacs with a macbook and the first difficulty was that the meta keys are used for emacs things, where there would otherwise be used for special characters, such as: [, ], |, {, }, ...
[Not that it changes much, but just to mention it, my macbook has a German keyboard]
To solve this I had defined my own functions for each special character, which lives in my .emacs file. For example, to insert a pipe:
(defun nwm/open-curley-bracket ()
"A custom function to insert an opening curley bracket as the mac key-bind for it doesn't work within emacs."
(interactive)
(insert "\{"))
(global-set-key (kbd "M-8") 'nwm/open-curley-bracket)
QUESTION:
I would like to use electric-pairs to auto-complete these special characters, meaning when I type {
I expect both braces to appear {}
with the cursor left between them.
The electric pairs mode works nicely for the special characters like normals brackets ()
that I do not need to remap to my keyboard, however it doesn't work for my new keybound characters like the pipe above.
I have tried setting the required special characters with less convoluted methods, e.g.:
(define-key global-map (kbd "M-8") "{")
... this still doesn't work for me.
I don't know much about Lisp, so if anybody can interpret the colde bhind electric-pairs to find the cause of the problem, please do! http://www.emacswiki.org/emacs/ElectricPair
Has anybody got a work-around or a different solution?
|
is not paired character? What do you wantelectric-pair
to do? Insert one more pipe?'
, which it should do according to the documentation, I believe.