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
1 answer
14 views

electric pair mode only inserts two double quotes after inserting a double quote in some buffers?

I have electric-pair-mode on, but the behavior with double quotes is not working as expected in some buffers. In one of the affected buffers: he said " it does not insert the matching double ...
Dan Drake's user avatar
  • 523
2 votes
1 answer
42 views

How to make `electric-pair-mode` always generate matching delimiters &parens in html/sgml/mhtml modes?

When I type a single {, it will auto insert right } But when I type a { again, it won't auto insert right } How can I set up electric-pair-mode so that it always generates matching delimiters and ...
jilen's user avatar
  • 121
0 votes
0 answers
29 views

Bad closing bracket indentation for electric-pair in python

I am getting the wrong indentation for closing braces when I use electric-pair mode in python. For example, if I place the cursor (|) like so : for i in range(10): foo = [|] and hit return, then ...
SLesslyTall's user avatar
0 votes
0 answers
68 views

Why is autopairing for "<>" enabled in org-mode when I have electric-pair-mode enabled but do not have "<>" in electric-pair-pairs?

Here's a snippet of my config related to electric-mode: (setq electric-pair-pairs '( (?\{ . ?\}) (?\( . ?\)) (?\[ . ?\]) (?\&...
Sumadithya's user avatar
1 vote
1 answer
46 views

Auto-completion of \lvert in AucTex

I wish to "electrically" insert \rvert or \Bigr\rvert when typing \lvert or \Bigl\lvert in AucTeX.
Eskil's user avatar
  • 113
0 votes
1 answer
40 views

Toggle enabled/disabled electric-pair-local-mode on LaTeX-math-mode-hook

I expected the following code would toggle electric-pair-local-mode every time I toggle LaTeX-math-mode (CTRL+C ~ in LaTeX-mode). It only works one way meaning it does turn on the electric pair mode ...
Celdor's user avatar
  • 129
0 votes
1 answer
76 views

Paste Inserts Extra Characters because of Electric Mode

I have this defined: (setq electric-pair-pairs ...
Jason Hunter's user avatar
5 votes
3 answers
270 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 ...
Giuseppe's user avatar
  • 455
0 votes
0 answers
179 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[]) {...
guest356234's user avatar
0 votes
1 answer
175 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 ...
cryptograthor's user avatar
1 vote
1 answer
251 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 ...
odefey's user avatar
  • 21
3 votes
1 answer
109 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 ...
Tohiko's user avatar
  • 1,589
2 votes
1 answer
498 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 ...
Omar's user avatar
  • 4,732
2 votes
1 answer
132 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 ...
Tim Hilt's user avatar
  • 297
1 vote
1 answer
461 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 ...
pgraf's user avatar
  • 113
6 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: ...
Sean's user avatar
  • 929
3 votes
1 answer
451 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 ...
Ayed's user avatar
  • 185
1 vote
0 answers
175 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 ...
Lustique's user avatar
  • 119
2 votes
1 answer
372 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?
premopie's user avatar
  • 378
1 vote
1 answer
556 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 \...
Michaël's user avatar
  • 314
2 votes
1 answer
665 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-...
Name's user avatar
  • 7,709
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.
Ben's user avatar
  • 597
1 vote
0 answers
71 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 ...
Startec's user avatar
  • 1,354
4 votes
1 answer
629 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 ...
Shaun's user avatar
  • 177
1 vote
0 answers
63 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 ...
Linn Clency's user avatar
3 votes
3 answers
371 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), ...
thirtythreeforty's user avatar
3 votes
1 answer
585 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) (...
Matthew Piziak's user avatar
1 vote
2 answers
143 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 ...
legends2k's user avatar
  • 207
1 vote
3 answers
141 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: [...
n1k31t4's user avatar
  • 669
2 votes
2 answers
645 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 \...
jjokella's user avatar
5 votes
2 answers
841 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 ...
bright-star's user avatar