Questions tagged [balanced-parentheses]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

Why does commented out parentheses match non commented parentheses?

If I have (foo ;) ) , then the last parentheses shows up as No matching parentheses found What gives?;)
Jason Hunter's user avatar
0 votes
0 answers
20 views

How to balance multiple pairs with electric-pair-mode

One such case is the double bracket in org mode: [[]] If I type "[" twice I will get: [[] The pair doesn't match! There is a similar question with a different purpose. How to make `electric-...
godblessfq's user avatar
  • 1,217
0 votes
0 answers
31 views

smartparens, to match only parens

In my Emacs, smartparens tries to match square bracket with parenthesis, indicating a mismatch, as in the following expression: (modify-syntax-entry ?[ ". 23" table) ^...
Flint's user avatar
  • 292
0 votes
1 answer
42 views

prevent emacs deleting ")"

I don't want to turn off entire smartparens or similar mode ((([cursor])) When I type ) at cursor location I expect it to be ((())) but it becomes ((()) How to find out which mode is causing it?
eugene's user avatar
  • 489
0 votes
0 answers
81 views

How to instruct AUCTeX to ignore a specific character when indenting?

I'm writing a document with AUCTeX using the songs package. It all works well, but it requires to input chords like in the sequence \[La]. The problem is, AUCTeX ignores the first bracket (since it is ...
Alessandro Bertulli's user avatar
1 vote
1 answer
151 views

Why does org see this source block as having "unbalanced parentheses"?

Here is a terse snippet with which you can recreate the issue, I hope: #+begin_src sh for x in $(for y in $(cmdA '"'); do cmdB $y; done); do cmdC $x; done #+end_src Here if I try to operate with ...
theherk's user avatar
  • 113
0 votes
1 answer
72 views

Indicating parentheses

I have this piece that indicates an opening parenthesis by blinking it. Currently, if I want to mark an opening parenthesis, I have to do call M-x rk-blink-matching-open each time. I would like the ...
Dilna's user avatar
  • 1
0 votes
0 answers
61 views

What alternative exist to write specialized forward-sexp-function?

I'd like to write code that allows forward-sexp and backward-sexp commands to navigate across balanced keyword-based expressions, such as make files that use the if / fi keywords. It's possible to ...
PRouleau's user avatar
  • 796
1 vote
1 answer
20 views

Counting opening and closing brace marks by specifying the mark

I have the following code to count the number of opening and closing brackets in a selected region. How can I allow a user to select the bracketing sign (,[,{ to count, and return two counts, one for ...
Dilna's user avatar
  • 1
1 vote
2 answers
295 views

how do I match brackets and parentheses in lisp code?

I started to write some elisp and have am having trouble with the brackets/parentheses. Often, I delete only one bracket/parenthesis and left the other dangling. I have trouble finding the matches. ...
McBear Holden's user avatar
2 votes
1 answer
93 views

How to support `<` and `>` as balanced parens without impacting ability to use them as comparison operators?

Languages like Erlang and Elixir use << >> for binaries and bit-string syntax, but they also use the classical < and > for comparison operators as well as -> and <- in list ...
PRouleau's user avatar
  • 796
0 votes
1 answer
128 views

Any existing function to fix comma-separated list in parens-pair?

I am looking a way to programatically fix invalidly formatted code for programming languages that use relatively simple list expression of elements separated by commas (ie, not in C++). For example I'...
PRouleau's user avatar
  • 796
3 votes
1 answer
166 views

How can I make `forward-sexp` handle other balanced character-pairs such as < and > or << and >>?

I am trying to find an easy and efficient way to modify the behaviour of forward-sexp to handle balanced pairs of characters not normally supported by it, such as balanced < and > and balanced &...
PRouleau's user avatar
  • 796
1 vote
1 answer
110 views

How to prevent smartparens slurp from slurping item separator?

I am looking into Erlang support for smartparens and would like to be able to slurp a string into the current list without including the Erlang statement termination colon in the list. In an erlang-...
PRouleau's user avatar
  • 796
0 votes
1 answer
201 views

rainbow-delimiters does not properly highlight unmatched parenthesis

Would it be possible to highlight unmatched parenthesis if they are at the beginning of a function like func((((()? Related: How can I find missing or mismatched braces / parens in emacs? minimal.el ...
alper's user avatar
  • 1,370
0 votes
0 answers
448 views

Scan error: "Unbalanced parentheses" in fresh emacs installations, without config files

When I start emacs and run M-x up-list in the initial buffer (the about Emacs buffer, in fundamental mode) I get Scan error: "Unbalanced parentheses". If I move the mark to the end of the ...
Jason Hemann's user avatar
0 votes
0 answers
106 views

AUCTeX pairing large parenthesis for `\left(`

I'd like to automatically close \left( with \right) in LaTeX via AUCTeX in Emacs 27. The following should work: (add-hook 'LaTeX-mode-hook (lambda () (set (make-local-variable 'TeX-...
Daniel's user avatar
  • 99
0 votes
1 answer
82 views

Paste Inserts Extra Characters because of Electric Mode

I have this defined: (setq electric-pair-pairs ...
Jason Hunter's user avatar
1 vote
1 answer
658 views

Blinking Paren Mode

I'm trying to get Paren Mode to be a little more clear, cause I can hardly see the other matching pair of parenthesis. Is there any way I could make this blinking yellow?;) I'm in gnome-terminal. Here ...
Jason Hunter's user avatar
1 vote
4 answers
2k views

How to delete surrounding brackets?

I'd like to be able delete the innermost brackets around the current point. What's a good way to do this? While the evil-surround package can do this, it needs to take a bracket type as input, so ...
ideasman42's user avatar
  • 8,796
1 vote
1 answer
518 views

How to find the matching bracket at a point in elisp?

What is a reliable way to find the matching balanced bracket (eg: {}, [], () in C or Python), which doesn't get confused by brackets in strings, or escaped brackets for e.g. Example: ["Foo]" ?\] 0 [...
ideasman42's user avatar
  • 8,796
1 vote
1 answer
410 views

How can I skip 'Scan-error: "Unbalanced parentheses"...'?

I want to write a script in order to correct spaces inside section command in a LaTeX code, that's to say \section{Lorem ipsum dolor sit amet consectetuer adipiscing elit} should be \section{...
Onner Irotsab's user avatar
1 vote
0 answers
60 views

Test if I am inside a paired delimiter

I have been having a problem where I want an up-sexp command that treats paired delimiters like $ in LaTeX-mode just as if they were pairs of balanced parentheses. There are hacks I can use that get ...
Zorgoth's user avatar
  • 840
3 votes
1 answer
232 views

Check latex \left \right balance

I've found a function for checking parenthesis/brackets balance. Full code is in the bottom. I wanted to use it to check LaTeX commands like \left(/\right), \[/\] etc. How can I modify this function ...
Sergey's user avatar
  • 249
2 votes
2 answers
571 views

Can't type unbalanced closing curly brace in Clojure mode

When I open a Clojure file, and I'm not using Paredit, I expect to be able to type unbalanced parentheses and brackets. I can type any of these characters: ()[]{, balanced on not. But if I try to type ...
Rob N's user avatar
  • 639
0 votes
0 answers
37 views

fault-tolerant `check-parens` resp. `scan-lists`

Looking for a way to have a fault-tolerant navigation. I.e. in case of broken syntax, uncomplete forms etc. --when check-paren fails--, it should try some heuristics. Unfortunatly can't use check-...
Andreas Röhler's user avatar
1 vote
1 answer
1k views

emacs regex to match balanced parenthesis

How can emacs lisp match balanced parenthesis? for example: "foo(bar(),hee()) out()" should be match "foo(bar(),hee())". I try below statement but it doesn't work: #!/usr/bin/env emacs --script (...
beetlej's user avatar
  • 1,100
5 votes
2 answers
630 views

Remove extra braces

I have some text like this This is a {{text}} with { { {some {extra} unneeded { {and ugly}} braces }}}. Is there a way to remove the extra unneeded parenthesis so that the result is This is a {...
Tohiko's user avatar
  • 1,649
14 votes
5 answers
2k views

How to replace matching parentheses?

I write (and rewrite) a lot of mathematical formulas in LaTeX with Emacs. I frequently run into situations where I want to change a pair of matching parentheses, to improve readability. My Emacs is ...
Mankka's user avatar
  • 243
2 votes
1 answer
109 views

Smarter smart bracket matching

It's kind of weird how un-ergonomically placed the parenthesis keys are. I'd like a function that smartly brackets my stuff for me based on context: If the mark is active, the region should be ...
Benjamin Lindqvist's user avatar
3 votes
2 answers
674 views

automatically close type parens in C++

Does anybody know of a way or a package that can recognize < and > when occuring in template contexts and automatically writes a > either right after the < or after the selected region ...
lo tolmencre's user avatar
1 vote
2 answers
54 views

How to capture show-paren-mode region into the kill ring?

I'm enjoying show-paren-mode using the "expression" style, which highlights a parenthesized region in a contrasting color. I'd like to define an Emacs Lisp function that could capture the region into ...
Norman Ramsey's user avatar
2 votes
1 answer
756 views

Auto-completion of round bracket in Auctex

When using Auctex to type tex files, round bracket ( can't auto-complete for me. But [ and { can do. How can I fix it? According to introduction of LaTeX-electric-left-right-brace, this variable is ...
allenryb's user avatar
2 votes
0 answers
111 views

Parenthesis-type-specific show-paren-mode

For unfortunate reasons, I need to write, by hand, expressions that look like the following: .....((((((((((((((((.....+))))))))[[[[[[[[[[[[[[[[{{{{{{{{{{{{{{{{))))))))+ ((((((((]]]]]]]]]]]]]]]]}}}}}}...
cge's user avatar
  • 121
0 votes
0 answers
72 views

Syntax highlight the opening parenthesis line printed in echo area

With respect to this answer, is there any way to enable syntax highlighting for the text printed in echo area by blink-matching-open? I am asking for something similar to what Lua Block mode does. ...
strNOcat's user avatar
  • 211
3 votes
3 answers
8k views

How to complete brackets automatically?

I use an auto complete tool in emacs, which can complete brackets. But I want to find out that how it determines whether it should complete the bracket. For example, assuming | stands for the point. ...
maple's user avatar
  • 191
2 votes
1 answer
582 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
  • 334
1 vote
1 answer
1k views

enable show-paren-mode in init.el

I would like to enable show-paren-mode in my configuration file init.el, which is very convenient for debugging. As it is a minor mode as I've understood, I don't know how to proceed.
loukios's user avatar
  • 825
3 votes
0 answers
155 views

Working around preprocessor blocks

I am trying to navigate a C project that has lots of preprocessor directives like this: #ifdef SOME_COMPILE_TIME_VARIABLE for ( idx=0; idx<FOO; idx++ ) { #else for ( idx=0; idx<BAR; idx+...
nispio's user avatar
  • 8,225
4 votes
0 answers
171 views

Add spaces between braces and content

I would like to automatically add spaces between braces and content when using emacs, for example: std::vector<std::string> values{"content", "moreContent", "andMoreContent"}; becomes std::...
jagged's user avatar
  • 41
2 votes
1 answer
1k views

How to disable underlining of highlighted matching brackets?

I want to have no underlining on highlighted matching brackets. I've done the following to achieve that: M-x customize-face show-paren-match And there I deactivated the underlining of matching ...
Zelphir Kaltstahl's user avatar
0 votes
1 answer
90 views

Org mode flashes indentation of lines with parentheses

I've been having some issues using org-mode with paren matching. Here are a few screenshots of the problem. In short, when my mouse isn't on a line, the line is shown correctly, but when parenthesis ...
Jay Kamat's user avatar
1 vote
2 answers
153 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
0 answers
657 views

How can I make Spacemacs stop deleting my parentheses?

I've recently switched from emacs to spacemacs (develop branch), and I'm still getting used to the new defaults. I added smartparens to my excluded-packages in my config file, because I don't like ...
Eli Sander's user avatar
2 votes
2 answers
180 views

Modifying AucTeX bracket indentation locally

I am currently using songs package, which via some TeX trickery uses escaped brackets to mark chords (for example \[G] is G-major, while \[a] is a-minor). This causes problems with indentation, for ...
Mekk's user avatar
  • 1,047
6 votes
2 answers
761 views

Insert parens while completing functions in company mode

If i select first option it will become l.remove But as the completion candidate is function type, how can i make it to l.remove() so that i don't have to manually type parens?
Chillar Anand's user avatar
3 votes
0 answers
79 views

Indent parenthesized Python expression

I have emacs set up to indent Python code like so: foo( bar, baz ) That works fine. However, that style in a particular program I'm working on very often means I find myself with text like this:...
Croad Langshan's user avatar
9 votes
2 answers
2k views

How to show matching parenthesis faster?

When you type closing parenthesis (or maybe it works for other paired symbols too), and opening parenthesis is not visible on the screen, Emacs “jumps” to opening parenthesis to show you where it is. ...
Mark Karpov's user avatar
  • 4,953
9 votes
2 answers
4k views

Remove parentheses around region

Is there a better alternative to this function I use to remove parens around a region? I'm looking for an Emacs builtin, or something better written, something that will remove any pairs around the ...
Nsukami _'s user avatar
  • 6,521
8 votes
4 answers
1k views

How can I find surrounding parenthesis (from emacs lisp)?

Is there a way to find out the type of the surrounding parenthesis (i.e. '(', '[' or '{') around point? For example (using | to represent point) { abc, | df } should return '{', and { abc[ | ], ...
dshepherd's user avatar
  • 1,281