bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32896: 27.0.50; wishlist: Delete matching pairs


From: Alex Branham
Subject: bug#32896: 27.0.50; wishlist: Delete matching pairs
Date: Mon, 08 Oct 2018 18:29:36 -0500
User-agent: mu4e 1.1.0; emacs 27.0.50

On Mon 08 Oct 2018 at 17:15, Juri Linkov <juri@linkov.net> wrote:

> Fortunately, Emacs already has such a command named ‘delete-pair’:
> it deletes the parens around the let function as in your first
> example as well as the quotes in your second example.  It makes
> sense to bind this command to e.g. ‘C-x M-(’ to be the inverse of
> ‘M-(’ (insert-pair)

Yay! I didn't know about that command (and I really did search before
reporting this bug, no idea how I missed it!). It doesn't work backward
though as far as I can tell:

(let (message "%s" "foobar")|)

M-x delete-pair there does nothing. I was hopeful about
`electric-pair-delete-pair' but it only works if the pair is adjacent.

I guess this is closer to what I wanted:

(defun my/delete-pair ()
  "Call `delete-pair', perhaps also calling `backward-up-list'."
  (interactive)
  (condition-case nil (delete-pair)
    (t (progn (backward-up-list)
              (delete-pair)))))

Anyway, thanks for the response!

Alex

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]