Questions tagged [electric-pair-mode]

Electric Pair mode, a global minor mode, provides a way to easily insert matching delimiters. Whenever you insert an opening delimiter, the matching closing delimiter is automatically inserted as well, leaving point between the two. To toggle Electric Pair mode, type `M-x electric-pair-mode`.

Filter by
Sorted by
Tagged with
8
votes
4answers
2k views

Don't pair quotes in electric-pair-mode

How can I get electric-pair-mode to not pair quotation marks (single or double)? I still want it to pair everything else (brackets, braces, etc.), just not quotes.
5
votes
7answers
1k views

Easily changing matching quotes

Not infrequently, I want to change the delimiters of a string from single quotes to double quotes, or vice versa. This is so annoying a process I wonder if there's an easier way. What I do now is: ...
5
votes
2answers
589 views

Getting electric-pair mode to behave more nicely around existing strings

Electric-pair-mode always tries to insert a closing delimiter after the opening one if nothing is selected. However, if you're placing delimiters around an existing something that you don't want to ...
4
votes
3answers
185 views

YASnippet: Avoid electric pairs at expansion time

I am used to bind my YASnippet trigger keys to sequences that start with < (e.g. when I type <hn in org-mode, it expands to a custom header for my notes). The problem is that in some modes, the ...
4
votes
1answer
428 views

Smarter Electric Pair

I like electric pairing for things like... someJavascript(function() { }); Where it automatically pairs { with {) etc. However, it infuriates me when I have someFunction(); and I want to turn ...
3
votes
1answer
462 views

Adding tilde to electric pairs in org mode

I am trying to add the verbatim character ~ (tilde) as an electric-pair character in org-mode. Here is my attempt: (with-eval-after-load 'org (modify-syntax-entry ?/ "(/" org-mode-syntax-table) (...
3
votes
1answer
343 views

web-mode disable auto pairing mode does not work

I am having little issues with web-mode. I am trying to disable the pairing which is done automatically when I try to insert double curly braces like this: {{<CURSOR>}} , and hit space to ...
3
votes
1answer
96 views

Automatically replace "$" by "\(" in latex-mode

In latex mode, using \( ... \) is preferred over $ ... $, so in my configuration I have the following (sp-local-pair modes "$" nil :actions :rem) (sp-local-pair modes "\\(" "\\)" :trigger "$") This ...
3
votes
3answers
293 views

Matching spacing around electric pairs

In c-mode, rust-mode, and similar major language modes, I frequently type something such as the following Rust: if some_bool { Some(foo) } else { None } As I enter this (| represents my cursor), ...
2
votes
2answers
531 views

AucTeX: Disable electric-pair-mode in minibuffer during Macro definition?

I use Emacs 24.3.1 and AUCTeX. I switched on the electric-pair-mode in LaTeX-buffers. The only time I would really like to disable it in the minibuffer while inserting math-mode parentheses via the \...
2
votes
1answer
534 views

electric pair of any length, using AUCTex

According to https://www.emacswiki.org/emacs/AutoPairs the package smartparens supports an electric pair of any length for example \{. My question about the possibility that the built-in electric-...
2
votes
1answer
77 views

Add expressions to LaTeX-electric-left-right-brace

I would want to "electrically" insert | or \right| when typing | or \left| in AucTeX and can't quite figure out how to add characters to AucTex-electric. A list of already defined completions can be ...
2
votes
1answer
272 views

Electric pair mode's delete adjacent pairs functionality not working in Slime REPL

Part of Emacs's electric-pair-mode functionality (controlled by a variable called electric-pair-delete-adjacent-pairs) is that when the point is between an empty set of delimiters and you delete the ...
2
votes
1answer
247 views

Is it possible to define multi-character pair for electric-pair-mode?

Is it possible to define multi-character pairs (like LaTeX displayed equation pair \[ ... \] or markdown bold ** ... **) for electric-pair-mode?
1
vote
1answer
399 views

Electric behavior of dollar sign using AUCTeX

I'm trying to turn $...$ into an electric pair, just as say (...). So I tried this solution, and it works fine on my older machine, running Emacs 24.3.1 and AUCTeX 11.87. However, on a newer ...
1
vote
2answers
126 views

delete-c-electric-paren deletes active region in CC mode with delete-selection-mode enabled

I've the delete-selection-mode enabled. In programming modes like Python and Lua, or in general modes like Fundamental or Text, when there's an active region, pressing ( rightly wraps the region with ...
1
vote
3answers
124 views

Using electric-pair on apple keyboards

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: [...
1
vote
0answers
164 views

How to debug a(n) .emacs that doesn't work correctly, but also doesn't throw any errors? [closed]

I currently have an Emacs/AucTeX setup where emacs --debug-init doesn't throw any errors, but things still don't work as expected. This being the case, I don't really know how to debug my .emacs file ...
1
vote
1answer
452 views

Electric/smart parentheses: allow wrapping in a nontransient way

I like smart parentheses as much as the next person, but there is one situation in which I often get frustrated. Suppose I have a TeX line reading: Lorem ipsum dolor sit amet Now I wish to \...
1
vote
0answers
53 views

How to mark / cursor inside of curly braces when opening set of curly braces

I am using js2-mode as well as electric-pair-mode and autocomplete. When I create a function using function () { and press enter the second curly brace is made on the next line but my cursor is ...
1
vote
0answers
62 views

Electric pairs, working in Emacs 24.3, but not in 24.4

In 24.3, I have this in my .emacs, and it works: (electric-pair-mode 1) (setq electric-pair-pairs '( (?\" . ?\") (?\{ . ?\}) (?\( . ?\) ) ) Normally I use this in org-mode. All of them worked ...
0
votes
1answer
42 views

Paste Inserts Extra Characters because of Electric Mode

I have this defined: (setq electric-pair-pairs ...
0
votes
0answers
10 views

Can electric-pair-mode delete the matching pair when it's not adjacent?

For example, if I have (test) and I delete the closing paren then I want the opening one deleted automatically. And vice versa. Can eletric pair mode do this? I see there is an adjacent deletion ...
0
votes
0answers
30 views

Disable pretty entities for empty subscripts and superscripts in Org mode

Is there a way to disable pretty display for empty subscripts and superscripts in Org mode? So "X_{}" wouldn't be prettily displayed, but everything else, e.g. "X_{1}", would be. I ...
0
votes
0answers
26 views

how to add double quotes in strings with single quotes using electric-pair-mode

if i write a double quote in a string with single quotes, i want electric-pair-mode to write another double quote. Example: <?php class test { public function test2() { ...
0
votes
0answers
14 views

Auto pairs function expansion and deletion over return and backspace

I'm trying to find or configure some auto pairs plugin to do the following. Say my cursor is placed as such: fn() {|} When I press enter, I want it to expand into: fn() { | } I've found some ...
0
votes
0answers
98 views

electric-pair-mode screws indentation

I have some trouble with my emacs indentation. Since I have enabled electric-pair-mode my indentation is screwed when I use hanging braces. Example (| is my cursor): int main(int argc, char *argv[]) {...
0
votes
1answer
64 views

I can turn on minor modes like electric pair modes in my init, but they’re not having effect unless manually reactivated [duplicate]

So I can put a line like, (setq-default global-linum-mode t) or (setq-default electric-par-mode t) in my init file, and I can check with C-h v that the variables are in fact set to t (they are), but ...
0
votes
1answer
119 views

electric-pair for parentheses does not work in latex-mode

electric pairing for () does not work in latex-mode. I have included regular parentheses () in my electric-pair-pairs list in .emacs. The list also includes [], {}, and "". However, when editing ...