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
0 votes
0 answers
27 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 ...
user avatar
  • 1,068
0 votes
1 answer
49 views

Paste Inserts Extra Characters because of Electric Mode

I have this defined: (setq electric-pair-pairs ...
user avatar
4 votes
3 answers
229 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 ...
user avatar
  • 425
0 votes
0 answers
138 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[]) {...
user avatar
0 votes
1 answer
105 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 ...
user avatar
0 votes
1 answer
176 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 ...
user avatar
  • 1
3 votes
1 answer
101 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 ...
user avatar
  • 1,449
2 votes
1 answer
370 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 ...
user avatar
  • 4,612
2 votes
1 answer
96 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 ...
user avatar
  • 287
1 vote
1 answer
431 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 ...
user avatar
  • 113
5 votes
7 answers
2k 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: ...
user avatar
  • 879
3 votes
1 answer
393 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 ...
user avatar
  • 185
1 vote
0 answers
173 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 ...
user avatar
  • 119
2 votes
1 answer
300 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?
user avatar
  • 378
1 vote
1 answer
503 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 \...
user avatar
  • 314
2 votes
1 answer
600 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-...
user avatar
  • 7,364
9 votes
4 answers
3k 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.
user avatar
  • 567
1 vote
0 answers
58 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 ...
user avatar
  • 1,264
4 votes
1 answer
481 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 ...
user avatar
  • 177
1 vote
0 answers
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 ...
user avatar
3 votes
3 answers
326 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), ...
user avatar
3 votes
1 answer
521 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) (...
user avatar
1 vote
2 answers
132 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 ...
user avatar
  • 177
1 vote
3 answers
132 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: [...
user avatar
  • 619
2 votes
2 answers
587 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 \...
user avatar
5 votes
2 answers
681 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 ...
user avatar