Skip to main content
11 votes
Accepted

Don't pair quotes in electric-pair-mode

Add the following to your emacs init file: (setq electric-pair-inhibit-predicate (lambda (c) (if (char-equal c ?\") t (electric-pair-default-inhibit c)))) Reference from my blog post: ...
xuhdev's user avatar
  • 1,921
4 votes

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

To specifically disable electric-pair-mode in the minibuffer change elethan's example to use the minibufferp function. Below is the relevant part from my Emacs configuration: ;; Enable smart paring (...
Peter W. V. Tran-Jørgensen's user avatar
4 votes
Accepted

electric pair of any length, using AUCTex

AUCTeX has a bultin support for pairing braces, and \{...\} is in the default set of supported braces. In order to enable this feature, just set LaTeX-electric-left-right-brace to non nil, either ...
giordano's user avatar
  • 3,255
3 votes
Accepted

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

Insert the following lisp snippet into your init-file: (add-hook 'LaTeX-mode-hook (lambda () (setq LaTeX-electric-left-right-brace t) (local-set-key "|" 'LaTeX-insert-left-brace)...
Tobias's user avatar
  • 33.3k
3 votes
Accepted

Electric behavior of dollar sign using AUCTeX

As I explained in my comment, this is a bug. Until it is fixed, you can work around it like so (add-hook 'LaTeX-mode-hook 'fix-electric-pair-paired-delimiters-in-tex-mode) (defun fix-...
joao's user avatar
  • 245
3 votes

YASnippet: Avoid electric pairs at expansion time

You can disable pairing of <..> as follows: (add-function :before-until electric-pair-inhibit-predicate (lambda (c) (eq c ?<)))
Stefan's user avatar
  • 26.5k
3 votes

Easily changing matching quotes

I knew this was going to take some time, but in the end I couldn't resist the temptation to figure out how it's done properly. :) Enjoy! (defun toggle-quotes (uarg) "Toggle single and double ...
Heikki's user avatar
  • 3,076
3 votes

Easily changing matching quotes

Try embrace. It’s easy to use and does what you want and more.
InHarmsWay's user avatar
  • 1,339
3 votes
Accepted

web-mode disable auto pairing mode does not work

In elisp nil represents a false value. Try: (setq web-mode-enable-auto-closing nil) (setq web-mode-enable-auto-pairing nil) -1 is non-nil (see: (if -1 "true!" "false!")).
ebpa's user avatar
  • 7,509
2 votes

Don't pair quotes in electric-pair-mode

Update: @xuhdev's answer is preferable as it doesn't interfere with Emacs' code. Might be worth a feature request having that customizable. For the moment, it looks trivial to modify the code in ...
Andreas Röhler's user avatar
2 votes
Accepted

Easily changing matching quotes

To continue this thread of alternatives... A better workflow than the one you describe is to use electric-pair-mode the way it is meant to so that it works for you instead of against you: Place the ...
Heikki's user avatar
  • 3,076
2 votes
Accepted

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

C-h f electric-pair-local-mode RET says: [...] This is a minor mode. If called interactively, toggle the ‘Electric-Pair-Local mode’ mode. If the prefix argument is positive, enable the mode, and if ...
d125q's user avatar
  • 1,453
1 vote
Accepted

Automatically insert parenthesis around region without keybinding

Electric pair mode is the closest built-in feature to what you're looking for. It inserts both an opening and a closing parentheses when you type one, with customizations to sometimes only insert what ...
Gilles 'SO- stop being evil''s user avatar
1 vote

Paste Inserts Extra Characters because of Electric Mode

You don't say so specifically, but I am going to guess that you are using Emacs inside a terminal. Outside of a terminal, Emacs explicitly knows when a paste is happening (because it is initiated as a ...
db48x's user avatar
  • 18.3k
1 vote

Easily changing matching quotes

First of all, I disabled electric-pair-mode by: (setq-default c-electric-flag nil) To remove a pair of matching quotes/parens, we can: use expand-region to select the content without the quotes you ...
AhLeung's user avatar
  • 1,083
1 vote
Accepted

YASnippet: Avoid electric pairs at expansion time

You can delete chars from the buffer during expansion, but modifying the buffer during expansion is dicouraged. Deleting chars is pretty easy, because yasnippet allows to eval elisp code during ...
jue's user avatar
  • 4,596
1 vote

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

I encountered the same problem and solved it by adding (setq electric-pair-preserve-balance nil) It ignores the pairing logic that balances out the number of opening and closing delimiters. I can ...
Mila M's user avatar
  • 11
1 vote
Accepted

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

In addition to @jagrg suggestion (to add :trigger-wrap "$") I found everything works as expected if I don't remove the $ pair from my modes I.e., I had to comment out this line (sp-local-pair 'latex-...
Tohiko's user avatar
  • 1,649
1 vote
Accepted

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

slime-repl-mode overrides in slime-repl-mode-map the key-binding for electric-pair-delete-pair. The override is not very surprising. It is just backward-delete-char-untabify. The binding in global-map ...
Tobias's user avatar
  • 33.3k
1 vote

Easily changing matching quotes

One option is to use Xah Lee's xah-change-bracket-pairs from http://ergoemacs.org/emacs/elisp_change_brackets.html. To get you started, here are two simple interactive functions that use it to do ...
Heikki's user avatar
  • 3,076
1 vote

Easily changing matching quotes

https://github.com/andreas-roehler/thing-at-point-utils comes with a ar-delimited2.el which provides for example a command ar-delimited2singlequoted
Andreas Röhler's user avatar
1 vote

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

Looking at the source code for the minor-mode, I couldn't find any way of doing it. But if you really want to implement it for multi-char strings, you can write your own function and add it to post-...
narendraj9's user avatar
1 vote

Don't pair quotes in electric-pair-mode

I think it could be simpler, based on @xuhdev's answer: (setq electric-pair-inhibit-predicate (lambda (c) (char-equal c ?\"))) The doc says The function is called with a single char (the ...
Jason's user avatar
  • 171
1 vote

Don't pair quotes in electric-pair-mode

It appears you cannot. The various customizations only allow you to add pairs. If you're willing to use a different package to do your pairing, you can try smartparens. You can set quotation marks to ...
zck's user avatar
  • 9,112

Only top scored, non community-wiki answers of a minimum length are eligible