all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Marc Soda" <marc@soda.fm>, "João Távora" <joaotavora@gmail.com>
Cc: 73688@debbugs.gnu.org
Subject: bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode
Date: Sat, 12 Oct 2024 15:21:28 +0300	[thread overview]
Message-ID: <86iktxwlyv.fsf@gnu.org> (raw)
In-Reply-To: <strbxUpiHLEBcdvnR5RNZ6as2JFO7eJLPozPoOwUtbdrCSFbwemRPZka9CEZY9tQd50hXePnWQNAycYZevfS3TPqyddaWfTc6kTcoxfpMAI=@soda.fm> (message from Marc Soda on Tue, 08 Oct 2024 03:10:54 +0000)

> Date: Tue, 08 Oct 2024 03:10:54 +0000
> From: Marc Soda <marc@soda.fm>
> 
> When using electric-pair-mode, electric-pair-conservative-inhibit
> doesn't respect electric-pair-preserve-balance. For example, type out a
> string, go to the beginning of the line, type ", go to the end of the
> line, and type ". You are left with "foo"". (Exact keys from the start
> of a line are fooC-a"C-e", if that's more clear.) I would expect to be
> left with "foo" instead.
> 
> This is easy to resolve in your init file (after some digging), but I
> think the current behavior is non-intuitive.
> 
> Please consider the attached patch.

João, do you have any comments?

> diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
> index c9627763d8d..382307503e8 100644
> --- a/lisp/elec-pair.el
> +++ b/lisp/elec-pair.el
> @@ -200,7 +200,11 @@ be considered.")
>     (and (eq char (char-before))
>  	(eq char (char-before (1- (point)))))
>     ;; I also find it often preferable not to pair next to a word.
> -   (eq (char-syntax (following-char)) ?w)))
> +   (eq (char-syntax (following-char)) ?w)  <<<<<<<<<<<<<<<<<<
> +   (eq (char-syntax (following-char)) ?w)  <<<<<<<<<<<<<<<<<<
> +   ;; Also consider preserving balance
> +   (and electric-pair-preserve-balance
> +        (electric-pair-inhibit-if-helps-balance char))))

Why duplicate lines there?





  reply	other threads:[~2024-10-12 12:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08  3:10 bug#73688: [PATCH] electric-pair-mode - preserve balance in conservative mode Marc Soda
2024-10-12 12:21 ` Eli Zaretskii [this message]
2024-10-12 19:47   ` Marc Soda
2024-10-12 20:36   ` João Távora
2024-10-12 20:43     ` Marc Soda
2024-10-12 23:36       ` João Távora
2024-10-17 16:48 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86iktxwlyv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73688@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=marc@soda.fm \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.