Questions tagged [balanced-parentheses]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
40 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{...
1
vote
0answers
31 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 ...
3
votes
1answer
67 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 ...
1
vote
2answers
136 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 ...
0
votes
0answers
25 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-...
1
vote
1answer
255 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 (...
5
votes
2answers
217 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 {...
8
votes
4answers
492 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 ...
2
votes
1answer
78 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 ...
3
votes
2answers
482 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 ...
1
vote
2answers
42 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 ...
2
votes
1answer
260 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 ...
1
vote
0answers
97 views

Parenthesis-type-specific show-paren-mode

For unfortunate reasons, I need to write, by hand, expressions that look like the following: .....((((((((((((((((.....+))))))))[[[[[[[[[[[[[[[[{{{{{{{{{{{{{{{{))))))))+ ((((((((]]]]]]]]]]]]]]]]}}}}}}...
0
votes
0answers
37 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. ...
0
votes
3answers
2k 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. ...
1
vote
1answer
273 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 \...
0
votes
1answer
460 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...Thank you very ...
3
votes
0answers
66 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+...
4
votes
0answers
113 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::...
2
votes
1answer
678 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 ...
0
votes
1answer
71 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 ...
1
vote
2answers
91 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
0answers
511 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 ...
2
votes
2answers
104 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 ...
4
votes
2answers
340 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?
3
votes
0answers
59 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:...
8
votes
2answers
1k 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. ...
8
votes
2answers
3k 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 ...
7
votes
3answers
436 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[ | ], ...
4
votes
1answer
306 views

Is there a command/package to pretty print based on parentheses?

I'm dealing with large files of output from Haskell code, most of which is debug info of stuff generating using Haskell's show. The important thing about that is that it's a large file of things, ...
1
vote
0answers
90 views

How does forward-list work for “<>” in c++-mode?

I am trying to understand how forward-list matches template delimiters <> in c++-mode. forward-list in lisp.el calls scan-lists with the appropriate arguments. The documentation for scan-lists ...
9
votes
3answers
196 views

Set region to include enclosing parentheses

Starting with the point or active region, how do I quickly (in one keystroke / command) 'expand' to include the next set of enclosing parentheses? If I start with: (| means point) (defn foo [x] (+ x ...
1
vote
1answer
241 views

Disable mic-paren in the minibuffer (or at least in ido)

I'm replacing a buggy code that was suppose to show a matching brace in the minibuffer in case it was off-screen with the following: (paren-activate) ;; activates mic-paren (setq paren-match-face '...
1
vote
0answers
554 views

Paredit: paredit-forward and paredit-backward don't work

I've been having trouble with navigating in paredit. When I try using C-M-f and C-M-b to go forward and backward, nothing happens. The minibuffer doesn't respond and the point doesn't move. When I ...
9
votes
2answers
169 views

What minor mode prints opening paren in the echo area?

This is a really nice feature, but it only displays when inserting a paren, not when changing to a cursor position. Is there an interactive command that I can call to display this? Can I configure it ...
8
votes
4answers
3k views

Automatically formatting brackets

I'm trying to create a function that places/aligns/indents curly brackets according to Allman-style formatting (for coding in C). Generally speaking, I am fan of Smartparens' interface available to ...
11
votes
4answers
2k views

How to define additional mode-specific pairs for electric-pair-mode

electric-pair-mode is a built-in mode for automatically inserting matching pairs of delimiters (parentheses, square brackets, etc.) based on the current major mode. I know that I can define ...
7
votes
2answers
1k views

What are the differences between autopair and smartparens?

Both autopair and smartparens provide functionality for inserting matching pairs of delimiters automatically. How do they differ from each other in practice (if at all)? What are some use cases that ...