6
votes
Accepted
How do I match a closing bracket in Emacs lisp
Put the ] as the first character after the [ which starts the character class, e.g.
[])}]
This is the manual page
4
votes
Accepted
Change field separator for sort-fields
See the code for sort-fields? Have you tried substituting a regexp that matches your preferred separators for the hard-coded regexp in sort-fields, which matches whitespace? Untested whether just ...
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 ...
3
votes
Getting electric-pair mode to behave more nicely around existing strings
You can also probably
(setq-default electric-pair-inhibit-predicate
(lambda (c)
(if (looking-at "[ \n\t]")
(electric-pair-default-inhibit c)
...
3
votes
Accepted
Getting electric-pair mode to behave more nicely around existing strings
Change the way pair insertion is inhibited:
(setq-default electric-pair-inhibit-predicate 'electric-pair-conservative-inhibit)
2
votes
Change field separator for sort-fields
Just use sort-regexp-fields. (Don't change sort.el or redefine any of its functions.)
2
votes
Determining number of left and right bracketing marks within region
Use M-x count-matches to count matches for a regexp that specifies each char you want to count.
E.g M-x count-matches ( counts the number of ( chars in the region.
If you want to check for matching ...
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 ...
2
votes
Highlight matching quotes
Of course it is.
(defun show-paren--match-quotes ()
(let ((ppss (syntax-ppss)))
;; In order to distinguish which quote is opening and which is starting,
;; check that that point is not ...
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 ...
1
vote
Easily changing matching quotes
Try embrace. It’s easy to use and does what you want and more.
1
vote
Accepted
How to customize the delimiter in the minor mode Hideshow for use with JSON data?
M-x finder-commentary RET hideshow RET says:
Normally, hideshow tries to determine appropriate values for block
and comment definitions by examining the buffer's major mode. If
there are problems, ...
1
vote
Lispy and Racket
As noted this is the keybindindgdefined by lispy - } is bound to lispy-brackets which inserts the pair []
I liked the idea of modes that lispy uses but found the keys too odd - I don't like or try to ...
1
vote
Accepted
Lispy and Racket
Type C-q [ to insert a single square bracket. As noted in the comments type } for a balanced pair of square brackets.
1
vote
Is there toggle-syntax package for parens, brackets, brokets, braces?
This is a simplistic way to accomplish it for lisp modes (for the limited cases I just tried), using some smartparens functions:
(defun toggle-parens ()
"Toggle parens, braces, brackets."
...
1
vote
How to find the matching bracket at a point in elisp?
Generally forward-sexp should know what to do in any given mode, so you could perhaps base it on this:
(save-excursion (ignore-errors (forward-sexp) (1- (point))))
Alternatively...
Something like ...
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 ...
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
1
vote
Accepted
How to configure the delimiter for evil-search-word for C/C++ modes?
Even though I had:
(modify-syntax-entry ?_ "w")
Set, some modes ignore this (C/C++ for example)
Found solution is to set this for spesific modes:
(modify-syntax-entry ?_ "w" c-mode-syntax-table)
(...
1
vote
Accepted
How to do paredit-kill backwards?
Since no one here has come up with an answer that is sufficient for my needs, I've continued with my aforementioned implementation which uses paredit-backward-delete under certain conditions. What I'...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
delimiters × 19syntax × 3
balanced-parentheses × 3
electric-pair-mode × 2
parentheses × 2
latex × 1
evil × 1
regular-expressions × 1
faces × 1
syntax-highlighting × 1
customize × 1
region × 1
minor-mode × 1
highlighting × 1
list × 1
motion × 1
comment × 1
doom × 1
advice × 1
sorting × 1
syntax-table × 1
line-numbers × 1
buffer-local × 1
deletion × 1
paredit × 1